/* SL — веб-версия. Светлая тема по образцу интерфейса 1С 8.5 (веб-клиент):
   светло-серый фон, синий акцент, белые панели, светло-синяя подсветка
   выбранной строки/пункта. Соответствует theme.py в Tkinter-версии
   (см. ПЕРЕДАЧА_В_НОВЫЙ_ЧАТ.md, раздел "Интерфейс — тема и цвета"). */

:root {
    --bg-app: #eef1f5;
    --bg-panel: #ffffff;
    --bg-sidebar: #f4f6f9;
    --border: #d7dde5;
    --border-strong: #c2cad4;
    --text-main: #263140;
    --text-muted: #6b7684;
    --accent: #1e6fd9;
    --accent-hover: #185bb3;
    --accent-soft: #e5f0fd;
    --accent-selected: #d3e6fc;
    --accent-personal: #b5651d;
    --accent-personal-soft: #fbf1e7;
    --row-alt: #f7f9fb;
    --danger: #c0392b;
    --radius: 4px;
    --shadow: 0 1px 2px rgba(38, 49, 64, 0.06);
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-app);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.4;
}

a { color: inherit; text-decoration: none; }

/* ---------- элементы форм ---------- */

.text-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-panel);
    color: var(--text-main);
    font-size: 14px;
    font-family: inherit;
}

.text-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-label {
    display: block;
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 14px 0 5px;
}

.btn {
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 8px 16px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-main);
}
.btn-ghost:hover { background: var(--bg-sidebar); }

/* ---------- экран входа ---------- */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #e4eaf3 0%, var(--bg-app) 220px);
}

.login-card {
    width: 340px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 18px rgba(38, 49, 64, 0.10);
    padding: 32px 30px 28px;
}

.login-title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.login-subtitle {
    margin: 4px 0 18px;
    font-size: 13px;
    color: var(--text-muted);
}

.login-error {
    background: #fdecea;
    border: 1px solid #f3c6c1;
    color: var(--danger);
    border-radius: var(--radius);
    padding: 8px 10px;
    font-size: 13px;
    margin-bottom: 6px;
}

.login-btn {
    width: 100%;
    margin-top: 22px;
    padding: 10px;
    font-weight: 600;
}

/* ---------- каркас приложения ---------- */

.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--accent);
    color: #ffffff;
    padding: 0 18px;
    height: 48px;
    flex-shrink: 0;
    box-shadow: var(--shadow);
}

.app-header-title {
    font-size: 15px;
    font-weight: 600;
}

.app-header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.role-badge {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 11px;
}

.app-header .btn-ghost {
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
}
.app-header .btn-ghost:hover { background: rgba(255, 255, 255, 0.14); }

.app-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* ---------- боковая панель — дерево папок ---------- */

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 14px 10px;
}

.sidebar-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0 8px 8px;
}

.all-words-link {
    display: block;
    padding: 7px 8px;
    border-radius: var(--radius);
    font-size: 13.5px;
    margin-bottom: 4px;
}
.all-words-link:hover { background: var(--accent-soft); }

.tree, .tree ul {
    list-style: none;
    margin: 0;
    padding-left: 14px;
}
.tree { padding-left: 0; }

.tree-item {
    display: block;
    padding: 6px 8px;
    border-radius: var(--radius);
    font-size: 13.5px;
    color: var(--text-main);
}

.tree-item:hover { background: var(--accent-soft); }

.tree-item-active {
    background: var(--accent-selected);
    color: var(--accent-hover);
    font-weight: 600;
}

.tree-lang {
    color: var(--text-muted);
    font-size: 11.5px;
}

.accent-personal { color: var(--accent-personal); }

/* ---------- основная область — таблица слов ---------- */

.content {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 18px 22px;
}

.content-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 16px;
    flex-wrap: wrap;
}

.breadcrumb {
    font-size: 15px;
}

.word-count {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 13px;
}

.search-form {
    display: flex;
    gap: 8px;
}

.search-input {
    width: 260px;
}

.word-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.word-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg-sidebar);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.word-table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}

.word-table tbody tr:last-child td { border-bottom: none; }

.row-alt { background: var(--row-alt); }

.word-table tbody tr:hover { background: var(--accent-soft); }

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
}

.tag-shared {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.tag-personal {
    background: var(--accent-personal-soft);
    color: var(--accent-personal);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 28px 0 !important;
}

/* ---------- панель инструментов (кнопки над таблицей) ---------- */

.toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.toolbar .btn {
    font-size: 13px;
    padding: 7px 14px;
}

.sidebar-add-btn {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 12.5px;
    padding: 6px 8px;
}

/* ---------- фильтры ---------- */

.filters-form {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.filter-search { width: 240px; }
.filter-select { width: 130px; }
.filter-lesson { width: 90px; }

/* ---------- действия в строке таблицы (изменить/удалить) ---------- */

.row-actions {
    white-space: nowrap;
    text-align: right;
}

.row-action-link {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 12.5px;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    font-family: inherit;
}
.row-action-link:hover { text-decoration: underline; }

.row-action-danger { color: var(--danger); }

.content-flash {
    margin-bottom: 14px;
}

/* ---------- формы (добавить/изменить слово, создать папку) ---------- */

.form-screen {
    min-height: calc(100vh - 0px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    background: var(--bg-app);
}

.form-card {
    width: 100%;
    max-width: 560px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 18px rgba(38, 49, 64, 0.08);
    padding: 28px 30px;
}

.form-title {
    margin: 0 0 6px;
    font-size: 20px;
    color: var(--text-main);
}

.form-row {
    display: flex;
    gap: 14px;
}

.form-col {
    flex: 1;
    min-width: 0;
}

.form-row.checkboxes {
    margin-top: 16px;
    gap: 22px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    color: var(--text-main);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* ---------- заглушка для разделов "в разработке" ---------- */

.placeholder-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.placeholder-card {
    text-align: center;
    max-width: 420px;
}

.placeholder-card h1 {
    font-size: 20px;
    margin-bottom: 8px;
}

.placeholder-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

/* ---------- сессия обучения ---------- */

.form-card-wide { max-width: 620px; }

.form-subtitle {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.review-block {
    margin-top: 18px;
    padding: 14px;
    background: var(--bg-sidebar);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.form-actions-split {
    justify-content: space-between;
}

.study-screen {
    flex: 1;
    padding: 22px 30px;
    overflow-y: auto;
}

/* ---------- верхняя панель управления сессией (сортировка/урок/интервал/повторение) ---------- */

.study-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.study-review-row {
    background: #fff8ec;
    border-left: 4px solid #c88719;
    margin-bottom: 16px;
}

.study-status-row {
    justify-content: space-between;
}

.status-sep {
    flex: 1 1 auto;
    min-width: 8px;
}

.stat-item {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.stat-words { color: #1a5fb4; }
.stat-remaining { color: #c88719; }
.stat-errors { color: #a51d2d; }
.stat-correct { color: #1a9c7c; }

.study-toggles {
    display: flex;
    gap: 18px;
    margin-bottom: 14px;
    padding: 8px 12px;
    background: #eefaf6;
    border-left: 4px solid #1a9c7c;
    border-radius: var(--radius);
    flex-wrap: wrap;
    align-items: center;
}

.verb-settings-row { align-items: center; }

.verb-question-source {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-label {
    font-size: 12.5px;
    color: var(--text-muted);
    white-space: nowrap;
}

.toolbar-select {
    width: 110px;
    padding: 6px 8px;
    font-size: 12.5px;
}

.toolbar-lesson {
    width: 70px;
    padding: 6px 8px;
    font-size: 12.5px;
}

.toolbar-num {
    width: 56px;
    padding: 6px 6px;
    text-align: center;
    font-size: 12.5px;
}

.toolbar-total {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 4px;
}

.toolbar-shift {
    width: 56px;
    padding: 6px 4px;
    font-size: 12.5px;
    text-align: center;
}

.toolbar-date {
    width: 140px;
    padding: 6px 8px;
    font-size: 12.5px;
}

.study-toolbar .btn {
    padding: 6px 14px;
    font-size: 12.5px;
}

.study-empty-message {
    padding: 40px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.study-question-actions {
    justify-content: flex-start;
    gap: 12px;
}

.study-main {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.study-question-col {
    flex: 1;
    min-width: 0;
    max-width: 460px;
}

.study-question-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.study-question-text {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 20px;
}

.study-answer-input {
    font-size: 16px;
    padding: 10px 12px;
}

.study-result {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 10px;
}

.study-result-text {
    font-size: 20px;
    font-weight: 700;
}

.study-result-correct .study-result-text { color: #26a269; }
.study-result-wrong .study-result-text { color: var(--danger); }

.study-result-word {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
}

.study-result-detail {
    font-size: 13px;
    color: var(--danger);
    margin-bottom: 8px;
}

.study-result-example {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.study-reference-col {
    width: 280px;
    flex-shrink: 0;
}

.study-reference {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
    min-height: 200px;
    font-size: 13.5px;
    line-height: 1.7;
}

.study-reference-hidden {
    color: var(--text-muted);
    font-style: italic;
    font-size: 13px;
}

.ref-line { margin-bottom: 3px; }
.ref-ru { color: #c0479a; }
.ref-translation { color: #26a269; }
.ref-attr0 { color: #1a5fb4; }
.ref-attr1 { color: #26a269; }
.ref-attr2 { color: #a51d2d; }
.ref-attr3 { color: #8f5902; }
.ref-attr4 { color: #613583; }
.ref-attr5 { color: #c64600; }
.ref-breakdown { color: var(--text-muted); font-style: italic; font-size: 12.5px; }

.study-final-stats {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 22px !important;
}

/* ---------- отчёт по повторению ---------- */

.report-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.report-summary {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.report-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
}

.report-status-passed { background: #eef1f5; color: var(--text-muted); }
.report-status-today { background: #fff2e2; color: #c88719; }
.report-status-overdue { background: #fdecea; color: var(--danger); }

.report-bulk-bar {
    margin-top: 14px;
}

/* ---------- импорт из Excel ---------- */

.import-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 4px 0 0;
}

.import-summary h2 {
    font-size: 16px;
    margin: 0 0 10px;
}

.import-subheading {
    font-size: 14px;
    margin: 24px 0 8px;
    color: var(--text-main);
}
