/*
 * assets/dictionary/slovo-dictionary.css
 * v1 (2026-10-10): Личный словарь ученика (Задача 6).
 * v2 (2026-10-31): layout по датам (сайдбар + основная колонка),
 *                  по образцу страницы ДЗ (.slovo-lms-hw-*).
 */

.slovo-dict-app {
    max-width: 100%;
    width: 100%;
}

/* Внутри layout основная колонка растягивается на всю ширину. */
body.slovo-lms-body .slovo-lms-hw-main .slovo-dict-app {
    max-width: 100%;
    width: 100%;
}

/* ---------- Заголовок и статистика ---------- */

.slovo-dict-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.slovo-dict-title {
    margin: 0;
    font-size: 22px;
}

.slovo-dict-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.slovo-dict-stat {
    padding: 4px 10px;
    border: 1px solid #d0d8e0;
    border-radius: 999px;
    font-size: 12px;
    color: #4a5568;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.slovo-dict-stat:hover {
    border-color: #007cba;
    color: #007cba;
}

.slovo-dict-stat.is-active {
    background: #007cba;
    border-color: #007cba;
    color: #fff;
}

.slovo-dict-stat b {
    font-weight: 700;
}

/* ---------- Кнопка-фильтр «Из книг» ---------- */

.slovo-dict-source-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.slovo-dict-source-btn:hover {
    background: #f3f4f6;
}

.slovo-dict-source-btn.is-active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

/* ---------- Панель управления ---------- */

.slovo-dict-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.slovo-dict-search {
    flex: 1 1 240px;
    min-height: 42px;
    padding: 8px 14px;
    border: 1px solid #d0d8e0;
    border-radius: 8px;
    font-size: 14px;
}

/* ---------- Форма добавления ---------- */

.slovo-dict-add-form {
    margin-bottom: 16px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.slovo-dict-add-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.slovo-dict-input {
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid #d0d8e0;
    border-radius: 8px;
    font-size: 14px;
}

.slovo-dict-add-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slovo-dict-add-status {
    font-size: 13px;
    color: #6b7280;
}

/* ---------- IT68: Форма импорта слов ---------- */

.slovo-dict-import-form {
    margin-bottom: 16px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.slovo-dict-import-hint {
    margin: 0 0 10px;
    font-size: 13px;
    color: #6b7280;
}

.slovo-dict-import-file,
body.slovo-lms-body .slovo-dict-import-file {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 14px;
    color: #374151;
}

.slovo-dict-import-file input[type="file"] {
    font-size: 13px;
}

.slovo-dict-import-text,
body.slovo-lms-body .slovo-dict-import-text {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 110px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid #d0d8e0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.slovo-dict-import-status {
    font-size: 13px;
    color: #6b7280;
}

/* ---------- Карточки слов ---------- */

.slovo-dict-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slovo-dict-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.slovo-dict-card:hover {
    border-color: #c3d3e0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.slovo-dict-card-term {
    font-size: 16px;
    font-weight: 700;
    color: #23282d;
}

.slovo-dict-card-def {
    font-size: 14px;
    color: #007cba;
}

.slovo-dict-card-tr {
    font-size: 12px;
    color: #6b7280;
}

.slovo-dict-card-ctx {
    margin-top: 3px;
    font-size: 12px;
    font-style: italic;
    color: #9ca3af;
}

.slovo-dict-card-side {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.slovo-dict-status {
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.slovo-dict-status--new {
    background: #eef7fd;
    color: #007cba;
}

.slovo-dict-status--learning {
    background: #fff8e5;
    color: #b57300;
}

.slovo-dict-status--mastered {
    background: #e6f6ec;
    color: #1e7e34;
}

.slovo-dict-speak,
.slovo-dict-edit,
.slovo-dict-delete {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: #f0f4f8;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.slovo-dict-speak:hover { background: #e3f0fc; }
.slovo-dict-edit:hover  { background: #fff3cd; }
.slovo-dict-delete:hover { background: #fde8e8; }

/* ---------- Модалка тренировки (наборы родных модулей) ---------- */

.slovo-dict-train {
    margin-top: 0;
}

.slovo-dict-train-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.slovo-dict-train-head h3 {
    margin: 0;
    font-size: 17px;
}

/* Выпадающий список упражнений (кнопка — в шапке сайдбара). */

.slovo-dict-train-dropdown {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin-top: 10px;
}

/* Кнопка-триггер «Тренировка ▼» на всю ширину сайдбара. */
.slovo-dict-train-caret,
body.slovo-lms-body .slovo-dict-train-caret {
    flex: 1 1 auto;
    width: 100%;
    justify-content: center;
    font-size: 14px;
}

/* ============================================================
   МОДАЛКА ТРЕНИРОВКИ + ВЫПАДАЮЩИЙ СПИСОК УПРАЖНЕНИЙ
   ============================================================ */

.slovo-dict-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.slovo-dict-modal-overlay.is-visible {
    display: flex;
}

.slovo-dict-modal-content,
body.slovo-lms-body .slovo-dict-modal-content {
    position: relative;
    box-sizing: border-box;
    /* IT64: модалка тренировки — 70% экрана. */
    width: 70vw;
    max-width: none;
    height: 70vh;
    max-height: none;
    overflow-y: auto;
    padding: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
}

.slovo-dict-modal-content .slovo-dict-train,
body.slovo-lms-body .slovo-dict-modal-content .slovo-dict-train {
    margin-top: 0;
}

.slovo-dict-modal-close,
body.slovo-lms-body .slovo-dict-modal-close {
    margin-top: 16px;
}

/* ---------- Модалка редактирования слова (замена prompt) ---------- */

.slovo-dict-edit-modal-content,
body.slovo-lms-body .slovo-dict-edit-modal-content {
    width: 520px;
    max-width: calc(100% - 32px);
    height: auto;
    max-height: 85vh;
}

.slovo-dict-edit-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 16px;
}

.slovo-dict-edit-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.slovo-dict-edit-field > span {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.slovo-dict-edit-status,
body.slovo-lms-body .slovo-dict-edit-status {
    margin-left: 8px;
    font-size: 13px;
    color: #475569;
}

/* ---------- IT62/IT64: ВКЛАДКИ ТРЕНИРОВКИ (явные, с рамкой) ---------- */

.slovo-dict-train-tabs,
body.slovo-lms-body .slovo-dict-train-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 16px;
}

.slovo-dict-train-tab,
body.slovo-lms-body .slovo-dict-train-tab {
    padding: 10px 20px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px 6px 0 0;
    margin-bottom: -2px;
    color: #6b7280;
}

.slovo-dict-train-tab:hover,
body.slovo-lms-body .slovo-dict-train-tab:hover {
    background: #f3f4f6;
}

.slovo-dict-train-tab.is-active,
body.slovo-lms-body .slovo-dict-train-tab.is-active {
    background: #fff;
    border-bottom: 2px solid #3b82f6;
    color: #3b82f6;
    font-weight: 600;
}

.slovo-dict-train-panel,
body.slovo-lms-body .slovo-dict-train-panel {
    display: none;
}

.slovo-dict-train-panel.is-active,
body.slovo-lms-body .slovo-dict-train-panel.is-active {
    display: block;
}

/* Сама кнопка и меню не должны обрезаться сайдбаром. */
body.slovo-lms-body .slovo-lms-hw-sidebar,
body.slovo-lms-body .slovo-lms-hw-sidebar-header,
body.slovo-lms-body .slovo-lms-hw-layout {
    overflow: visible;
}

.slovo-dict-train-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 500;
    min-width: 220px;
    padding: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

.slovo-dict-train-menu.is-open {
    display: block;
}

.slovo-dict-train-menu__item,
body.slovo-lms-body .slovo-dict-train-menu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13.5px;
    color: #334155;
    cursor: pointer;
    white-space: nowrap;
}

.slovo-dict-train-menu__item:hover,
body.slovo-lms-body .slovo-dict-train-menu__item:hover {
    background: #f3f4f6;
}

.slovo-dict-train-menu__item input:disabled + span,
body.slovo-lms-body .slovo-dict-train-menu__item input:disabled + span {
    color: #94a3b8;
}

.slovo-dict-train-start,
body.slovo-lms-body .slovo-dict-train-start {
    display: block;
    width: 100%;
    margin-top: 8px;
}

/* Задача: чекбоксы источников в сайдбаре (перед пунктом даты/«Из книг»). */

.slovo-dict-src-row,
body.slovo-lms-body .slovo-dict-src-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.slovo-dict-src-check,
body.slovo-lms-body .slovo-dict-src-check {
    margin: 12px 8px 0 12px;
    cursor: pointer;
    flex: 0 0 auto;
}

.slovo-dict-src-row .slovo-lms-hw-date-item,
body.slovo-lms-body .slovo-dict-src-row .slovo-lms-hw-date-item {
    flex: 1 1 auto;
    min-width: 0;
}

/* Пункт сайдбара «Из книг». */

body.slovo-lms-body .slovo-lms-hw-date-item--books {
    background: #eef6ff;
}

body.slovo-lms-body .slovo-lms-hw-date-item--books .slovo-lms-hw-date-item-label {
    color: #1d4ed8;
    font-weight: 600;
}

body.slovo-lms-body .slovo-lms-hw-date-item--books.is-current {
    background: #dbeafe;
}

/* ---------- Быстрое добавление (выделение в тексте) ---------- */

.slovo-dict-quickadd {
    position: absolute;
    z-index: 99999;
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    background: #007cba;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 124, 186, 0.4);
}

/* На странице словаря плавающая кнопка «В словарь» не нужна:
   она дублирует «Добавить слово» в тулбаре. */
body:has(.slovo-dict-app) .slovo-dict-quickadd {
    display: none !important;
}

/* ---------- Адаптив ---------- */

@media (max-width: 600px) {
    .slovo-dict-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .slovo-dict-card-side {
        width: 100%;
        justify-content: flex-end;
    }

    .slovo-dict-toolbar {
        flex-direction: column;
    }

    .slovo-dict-search {
        flex: 1 1 auto;
    }
}

/* Мобильные: попап перевода всегда под выделенным словом (не внизу экрана).
   Перебиваем возможные bottom/top:auto/position:fixed из других стилей. */
@media (max-width: 768px) {
    body .slovo-dict-wordpop {
        position: absolute;
        top: auto;
        bottom: auto;
        right: auto;
        max-width: min(320px, calc(100vw - 24px));
    }
}

/* ============================================================
   ЗАДАЧА 2: МИНИ-ПОПАП ПЕРЕВОДА В МОДУЛЯХ (клик по слову)
   ============================================================ */

.slovo-dict-wordpop {
    position: absolute;
    z-index: 100000;
    min-width: 200px;
    max-width: 320px;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid #d5dbe3;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.22);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #1f2937;
}

.slovo-dict-wordpop-word {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 2px;
    word-break: break-word;
}

.slovo-dict-wordpop-ipa {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.slovo-dict-wordpop-def {
    margin-bottom: 10px;
    color: #111827;
}

.slovo-dict-wordpop-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.slovo-dict-wordpop-add {
    flex: 1 1 auto;
    padding: 8px 12px;
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.slovo-dict-wordpop-add:hover:not(:disabled) {
    background: #006ba1;
}

.slovo-dict-wordpop-add:disabled {
    opacity: 0.65;
    cursor: default;
}

.slovo-dict-wordpop-speak {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    background: #64748b;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.slovo-dict-wordpop-speak:hover {
    background: #475569;
}

/* Кликабельные слова в текстах целевых модулей. */
.slovo-dict-clickable,
.slovo-audio-app .slovo-audio-word,
.slovo-video-transcript,
.slovo-reader-text,
.slovo-essay-prompt,
.slovo-text-content {
    cursor: pointer;
}



/* ============================================================
   v2 (2026-10-31) — LAYOUT СЛОВАРЯ ПО ДАТАМ
   ============================================================
   Копия блока .slovo-lms-hw-* из assets/lms/slovo-lms.css (v2.38)
   для страницы словаря: сайдбар с датами + основная колонка.
   Префикс body.slovo-lms-body сохранён (страница — slovo-dashboard).
   ============================================================ */

/* ---------- 1. ОБЩИЙ LAYOUT ---------- */

body.slovo-lms-body .slovo-lms-hw-layout {
    display: flex;
    align-items: stretch;
    gap: 0;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
    min-height: 70vh;
}

body.slovo-lms-body .slovo-lms-hw-sidebar {
    flex: 0 0 280px;
    width: 280px;
    min-width: 220px;
    max-width: 320px;
    background: #f8fafc;
    border-right: 1px solid #e0e6ed;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

body.slovo-lms-body .slovo-lms-hw-main {
    flex: 1 1 auto;
    min-width: 0;
    background: #fff;
    padding: 24px 28px;
    box-sizing: border-box;
    overflow-x: auto;
}

/* ---------- 2. ШАПКА САЙДБАРА ---------- */

body.slovo-lms-body .slovo-lms-hw-sidebar-header {
    flex-shrink: 0;
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid #e0e6ed;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

body.slovo-lms-body .slovo-lms-hw-back-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.15s;
}

body.slovo-lms-body .slovo-lms-hw-back-inline:hover {
    color: #007cba;
}

body.slovo-lms-body .slovo-lms-hw-sidebar-title {
    font-size: 15px;
    font-weight: 700;
    color: #23282d;
    line-height: 1.3;
}

body.slovo-lms-body .slovo-lms-hw-sidebar-total {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

body.slovo-lms-body .slovo-lms-hw-sidebar-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 0;
}

body.slovo-lms-body .slovo-lms-hw-sidebar-body::-webkit-scrollbar {
    width: 6px;
}
body.slovo-lms-body .slovo-lms-hw-sidebar-body::-webkit-scrollbar-thumb {
    background: #c8d0da;
    border-radius: 3px;
}

body.slovo-lms-body .slovo-lms-hw-sidebar-empty {
    padding: 20px 14px;
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
    font-style: italic;
}

/* ---------- 3. ПУНКТ ДАТЫ В САЙДБАРЕ ---------- */

body.slovo-lms-body .slovo-lms-hw-date-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 16px;
    text-decoration: none;
    color: #23282d;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    box-sizing: border-box;
}

body.slovo-lms-body .slovo-lms-hw-date-item:hover {
    background: #eef2f7;
    color: #23282d;
}

body.slovo-lms-body .slovo-lms-hw-date-item.is-current {
    background: #e3f0fc;
    border-left-color: #007cba;
    color: #007cba;
}

body.slovo-lms-body .slovo-lms-hw-date-item-label {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

body.slovo-lms-body .slovo-lms-hw-date-item-counts {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

body.slovo-lms-body .slovo-lms-hw-date-count {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    background: #f0f4f8;
    color: #6b7280;
    line-height: 1.5;
    white-space: nowrap;
}

/* Изученные (mastered) — зелёный. */
body.slovo-lms-body .slovo-lms-hw-date-count--done {
    background: #d4edda;
    color: #155724;
}

/* Неизученные (new + learning) — жёлтый. */
body.slovo-lms-body .slovo-lms-hw-date-count--new {
    background: #fff3cd;
    color: #856404;
}

/* Совместимость с именами классов страницы ДЗ. */
body.slovo-lms-body .slovo-lms-hw-date-count-done {
    background: #d4edda;
    color: #155724;
}

body.slovo-lms-body .slovo-lms-hw-date-count-new {
    background: #fff3cd;
    color: #856404;
}

/* ---------- 4. ГЛАВНАЯ КОЛОНКА ---------- */

body.slovo-lms-body .slovo-lms-hw-main-header {
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid #eef2f5;
}

body.slovo-lms-body .slovo-lms-hw-main-title {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 700;
    color: #23282d;
    line-height: 1.25;
}

body.slovo-lms-body .slovo-lms-hw-main-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

/* ---------- 5. МОБИЛЬНЫЙ АДАПТИВ ---------- */

@media (max-width: 900px) {
    body.slovo-lms-body .slovo-dict-modal-content {
        width: 100%;
        max-width: calc(100% - 24px);
        max-height: 85vh;
        padding: 16px;
    }

    body.slovo-lms-body .slovo-lms-hw-layout {
        flex-direction: column;
        min-height: auto;
    }

    body.slovo-lms-body .slovo-lms-hw-sidebar {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        max-width: none;
        border-right: none;
        border-bottom: 1px solid #e0e6ed;
        max-height: 40vh;
        /* Меню упражнений не должно обрезаться сайдбаром. */
        overflow: visible;
    }

    body.slovo-lms-body .slovo-lms-hw-sidebar-body {
        max-height: 30vh;
    }

    body.slovo-lms-body .slovo-lms-hw-main {
        padding: 16px 14px;
    }

    body.slovo-lms-body .slovo-lms-hw-main-title {
        font-size: 18px;
    }
}

/* ============================================================
   ИТЕРАЦИЯ 8: ТРЕНИРОВКА СЛОВ ГЛАВЫ В РИДЕРЕ КНИГИ
   (модалка .slovo-dict-modal-overlay переиспользуется как есть;
    ниже — только 3 новых класса разметки модалки)
   ============================================================ */

body.slovo-lms-body .slovo-book-train-message,
.slovo-book-train-message {
    margin: 0 0 14px;
    padding: 12px 14px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    font-size: 14px;
    color: #334155;
    line-height: 1.5;
}

body.slovo-lms-body .slovo-book-train-message p,
.slovo-book-train-message p {
    margin: 0;
}

body.slovo-lms-body .slovo-book-train-modes,
.slovo-book-train-modes {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}

body.slovo-lms-body .slovo-book-train-footer,
.slovo-book-train-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

