/* =============================================
   LESSON IMAGES – CRITICAL STYLES
   Для страниц создания и просмотра уроков
   ============================================= */

/* ----- Глобальные контейнеры и картинки ----- */
.lesson-block {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.325rem;
    padding: 1.2rem;
    margin-bottom: 1.25rem;
}
.lesson-block:hover {
    background-color: #f8f9fa;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.04);
}

/* =============================================
   ИЗОБРАЖЕНИЯ – ИНТЕРАКТИВНОСТЬ И ВЫДЕЛЕНИЕ
   ============================================= */
.lesson-image {
    width: 100% !important;
    max-width: 1000px !important;
    height: auto !important;
    display: block !important;
    margin: 0 auto !important;
    background-color: #2d3047;
    border-radius: 12px;
    border: 3px solid transparent;
    transition: none !important;
    cursor: pointer;
    box-shadow: none !important;
    transform: none !important;
}
.lesson-image:hover {
    box-shadow: none !important;
    transform: none !important;
}
.lesson-image.selected {
    border-color: #4bd3ff !important;
    box-shadow: 0 0 15px rgba(75, 211, 255, 0.3) !important;
    transform: none !important;
}
@media (max-width: 768px) {
    .lesson-image:hover,
    .lesson-image.selected {
        transform: none !important;
    }
}

/* ----- УНИФИКАЦИЯ КОНТЕЙНЕРОВ (все режимы) ----- */
.image-preview-container {
    position: relative;
    text-align: center;
    box-sizing: border-box;
}
.image-preview-item {
    position: relative;
    display: inline-block;
    max-width: 1000px;
    width: 100%;
    line-height: 0;
}

/* Режим просмотра (админка и фронт) */
.view-mode .image-preview-container {
    max-width: 1000px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-sizing: content-box !important;
    overflow: visible !important;
    max-height: none !important;
}
.view-mode .image-preview-item {
    display: block !important;
    width: 100% !important;
    max-width: 1000px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    overflow: visible !important;  /* убрали прокрутку */
    max-height: none !important;   /* сбросили ограничение */
}
.view-mode .image-preview-item .lesson-image {
    display: block !important;
    width: 100% !important;
    max-width: 1000px !important;
    height: auto !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 3px solid transparent !important;
    box-shadow: none !important;
    transition: none !important;
    transform: none !important;
    background-color: #2d3047 !important;
    border-radius: 12px !important;
    cursor: pointer !important;
}
.view-mode .image-preview-item .lesson-image:hover {
    box-shadow: none !important;
    transform: none !important;
    border-color: transparent !important;
}
.view-mode .image-preview-item .lesson-image.selected {
    border-color: #4bd3ff !important;
    box-shadow: 0 0 15px rgba(75, 211, 255, 0.3) !important;
    transform: none !important;
}

/* Режим создания (create-mode) */
.image-preview-container.create-mode .image-preview-item .lesson-image {
    display: block !important;
    width: 100% !important;
    max-width: 1000px !important;
    height: auto !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 3px solid transparent !important;
    box-shadow: none !important;
    transition: none !important;
    transform: none !important;
    background-color: #2d3047 !important;
    border-radius: 12px !important;
    cursor: pointer !important;
}
.image-preview-container.create-mode .image-preview-item .lesson-image:hover {
    box-shadow: none !important;
    transform: none !important;
    border-color: transparent !important;
}
.image-preview-container.create-mode .image-preview-item .lesson-image.selected {
    border-color: #4bd3ff !important;
    box-shadow: 0 0 15px rgba(75, 211, 255, 0.3) !important;
    transform: none !important;
}

/* ----- Подсказки (hints) – общие для create и show ----- */
.text-hint.create-mode,
.hint-popover {
    position: absolute;
    box-sizing: border-box;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden;          /* оставляем для обрезки контента, но внутри будет свой скролл */
    min-height: 30px;
    min-width: 30px;
    pointer-events: auto;      /* разрешаем взаимодействие (для скролла) */
}
/* добавляем прокрутку для текстовых попапов, чтобы длинный текст скроллился внутри */
.hint-popover {
    overflow-y: auto !important;
    max-height: 100% !important;
}
.text-hint.create-mode.editing {
    outline: 2px dashed #007bff;
    z-index: 1001 !important;
}
.hint-popover.transparent {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}
/* Выравнивание */
.text-hint.create-mode[data-text-align="left"],
.hint-popover[data-text-align="left"] {
    text-align: left !important;
    justify-content: flex-start !important;
}
.text-hint.create-mode[data-text-align="center"],
.hint-popover[data-text-align="center"] {
    text-align: center !important;
    justify-content: center !important;
}
.text-hint.create-mode[data-text-align="right"],
.hint-popover[data-text-align="right"] {
    text-align: right !important;
    justify-content: flex-end !important;
}

/* Шрифты по data-атрибутам */
.hint-popover[data-font-family="Arial, sans-serif"] { font-family: Arial, sans-serif !important; }
.hint-popover[data-font-family="'Georgia', serif"] { font-family: 'Georgia', serif !important; }
.hint-popover[data-font-family="'Verdana', sans-serif"] { font-family: 'Verdana', sans-serif !important; }
.hint-popover[data-font-family="'Trebuchet MS', sans-serif"] { font-family: 'Trebuchet MS', sans-serif !important; }
.hint-popover[data-font-family="'Courier New', monospace"] { font-family: 'Courier New', monospace !important; }
.hint-popover[data-font-family="'Comic Sans MS', cursive"] { font-family: 'Comic Sans MS', cursive !important; }
.hint-popover[data-font-family="'Lucida Handwriting', cursive"] { font-family: 'Lucida Handwriting', cursive !important; }
.hint-popover[data-font-weight="normal"] { font-weight: normal !important; }
.hint-popover[data-font-weight="bold"] { font-weight: bold !important; }
.hint-popover[data-font-weight="lighter"] { font-weight: lighter !important; }
.hint-popover[data-font-size="12"] { font-size: 12px !important; }
.hint-popover[data-font-size="14"] { font-size: 14px !important; }
.hint-popover[data-font-size="16"] { font-size: 16px !important; }
.hint-popover[data-font-size="18"] { font-size: 18px !important; }
.hint-popover[data-font-size="20"] { font-size: 20px !important; }
.hint-popover[data-font-size="24"] { font-size: 24px !important; }
.hint-popover[data-font-size="28"] { font-size: 28px !important; }
.hint-popover[data-font-size="32"] { font-size: 32px !important; }
.hint-popover[data-font-size="36"] { font-size: 36px !important; }
.hint-popover[data-font-size="40"] { font-size: 40px !important; }

/* ----- Линии (simple-line-hint) ----- */
.simple-line-hint {
    position: absolute;
    transform-origin: 0 0;
    pointer-events: none;
    border: none;
}
.simple-line-hint.selected {
    background: #007bff !important;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.5);
}
.simple-line-hint {
    pointer-events: auto;
    cursor: pointer;
}
.simple-line-hint:hover {
    filter: brightness(1.3);
}

/* ----- Вставленные изображения (pasted) ----- */
.pasted-image-hint {
    position: absolute;
    overflow: hidden;
    border-radius: 4px;
    border: 2px solid #4bd3ff;
    box-shadow: 0 0 0 2px rgba(75, 211, 255, 0.5), 0 4px 12px rgba(0, 0, 0, 0.2);
}
.pasted-image-hint.no-border {
    border: none;
    box-shadow: none;
    border-radius: 0;
}
.pasted-image-hint img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}
.pasted-image-container {
    position: absolute;
    cursor: move;
    background-color: rgba(0, 0, 255, 0.1);
    box-sizing: border-box;
}
.pasted-image-container.with-border img {
    border: 2px solid black;
    border-radius: 6px;
}
.pasted-image-container.no-border img {
    border: none;
    border-radius: 0;
}

/* ----- Видео-подсказки ----- */
.video-hint {
    position: absolute;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    z-index: 10;
    border-radius: 4px;
    padding: 0 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.video-hint:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}
.video-hint.create-mode {
    cursor: move;
}
.video-hint.create-mode.editing {
    outline: 2px dashed #007bff;
}

/* ----- Аудиоплеер (светлая версия) ----- */
.audio-player {
    margin-top: 15px;
    padding: 20px 24px;
    background: linear-gradient(90deg, rgba(131,58,180,0.06) 0%, rgba(253,29,29,0.06) 50%, rgba(252,176,69,0.06) 100%);
    border: 1px solid rgba(131,58,180,0.15);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s ease;
}
.audio-player:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.08);
}
.audio-player h5 {
    color: #2d3047;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 1.1rem;
}
.audio-player audio {
    width: 100%;
    border-radius: 6px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    outline: none;
}
.audio-controls {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: center;
}
.audio-controls button {
    padding: 8px 18px;
    background: rgba(131, 58, 180, 0.08);
    color: #833ab4;
    border: 1px solid rgba(131, 58, 180, 0.25);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.9rem;
    font-weight: 500;
}
.audio-controls button:hover {
    background: rgba(131, 58, 180, 0.15);
    border-color: #833ab4;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(131,58,180,0.15);
}
.speed-btn.active {
    background: linear-gradient(90deg, rgba(131,58,180,1) 0%, rgba(253,29,29,1) 50%, rgba(252,176,69,1) 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(131,58,180,0.3);
}
.speed-btn.active:hover {
    background: linear-gradient(90deg, rgba(131,58,180,0.9) 0%, rgba(253,29,29,0.9) 50%, rgba(252,176,69,0.9) 100%);
    transform: translateY(-2px);
}

/* ----- Модальные окна (transparent) ----- */
.transparent-modal {
    background-color: rgba(255, 255, 255, 0.56);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}
.transparent-modal .modal-header {
    background: rgba(255, 255, 255, 0.4);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px 12px 0 0;
    cursor: move;
}
.transparent-modal .modal-body {
    background: rgba(255, 255, 255, 0.3);
}
.transparent-modal .modal-footer {
    background: rgba(255, 255, 255, 0.4);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 0 0 12px 12px;
}
.modal-dialog.draggable {
    margin: 0;
    position: fixed;
    right: 20px;
    top: 20px;
    left: auto;
    transform: none;
}

/* ----- Интерактивные элементы в конструкторе ----- */
.toolbar {
    background: #f8f9fa;
    padding: 5px;
    border-radius: 0.25rem;
    border: 1px solid #dee2e6;
    margin-bottom: 10px;
    display: flex;
    gap: 5px;
}
.hint-option.compact {
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    margin-bottom: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.hint-option.compact:hover {
    background: #f8f9fa;
    border-color: #007bff;
}
.audio-preview-container {
    border: 2px dashed #dee2e6;
    padding: 15px;
    border-radius: 8px;
    background: #f8f9fa;
    margin-top: 10px;
}

/* ----- Кнопки удаления и ручки ----- */
.line-delete-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 15px;
    height: 15px;
    background: red;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-weight: bold;
}
.hint-remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: red;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #007bff;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    pointer-events: auto;
}
.resize-handle.nw {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}
.resize-handle.ne {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}
.resize-handle.sw {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}
.resize-handle.se {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

/* ----- Клавиатурная подсказка (keyboard-hint) ----- */
.keyboard-hint {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 0.85rem;
    z-index: 9999;
    max-width: 260px;
    line-height: 1.5;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}
.keyboard-hint kbd {
    background: #333;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 1px 6px;
    color: #fff;
    font-size: 0.8em;
    display: inline-block;
    margin: 0 2px;
}

/* ----- Временная линия при рисовании (temp-line) ----- */
.temp-line {
    position: absolute;
    background: #ff0000;
    height: 2px;
    transform-origin: 0 0;
    pointer-events: none;
    z-index: 1000;
}

/* =============================================
   СЛОВАРИ – СВЕТЛАЯ ТЕМА (общая для админки и фронта)
   ============================================= */
.vocabulary-card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
.vocabulary-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}
.vocabulary-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f3f5;
    background: #f8f9fa;
}
.vocabulary-header-nouns {
    background: rgba(131,58,180,0.08);
    border-left: 4px solid #833ab4;
}
.vocabulary-header-verbs {
    background: rgba(253,29,29,0.08);
    border-left: 4px solid #fd1d1d;
}
.vocabulary-header-set_phrases {
    background: rgba(252,176,69,0.08);
    border-left: 4px solid #fcb045;
}
.vocabulary-header-topic_words {
    background: rgba(40,167,69,0.08);
    border-left: 4px solid #28a745;
}
.vocabulary-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #2d3047;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.vocabulary-body {
    padding: 1.5rem;
    background: #ffffff;
}
.word-columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
}
.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
    min-height: 50px;
}
.word-item:hover {
    background: #f1f3f5;
    border-color: #ced4da;
    transform: translateY(-1px);
}
.word-english {
    font-weight: 600;
    color: #2d3047;
    font-size: 1rem;
    background: rgba(131,58,180,0.06);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    border: 1px solid rgba(131,58,180,0.15);
    transition: all 0.2s;
    cursor: pointer;
}
.word-english:hover {
    background: rgba(131,58,180,0.12);
    color: #833ab4;
}
.word-russian {
    color: #495057;
    font-weight: 500;
    font-size: 0.95rem;
    background: rgba(108,117,125,0.06);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    border: 1px solid rgba(108,117,125,0.12);
    transition: all 0.2s;
}
.word-russian:hover {
    background: rgba(108,117,125,0.1);
}

/* Тематические слова (badges) */
.topic-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #2d3047;
    transition: all 0.2s;
    cursor: pointer;
}
.topic-badge:hover {
    background: rgba(131,58,180,0.08);
    border-color: #833ab4;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.04);
}

@media (max-width: 768px) {
    .word-columns {
        grid-template-columns: 1fr;
    }
    .word-item {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 0.8rem 1rem;
    }
    .word-english, .word-russian {
        text-align: center;
    }
}

/* ----- Адаптивность ----- */
@media (max-width: 768px) {
    .keyboard-hint {
        max-width: 180px;
        font-size: 0.75rem;
        padding: 8px 12px;
        bottom: 10px;
        right: 10px;
    }
    .audio-controls {
        gap: 6px;
    }
    .audio-controls button {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    .modal-dialog.draggable {
        right: 10px;
        top: 10px;
        max-width: 90%;
    }
}
@media (max-width: 575.98px) {
    .image-preview-container.view-mode {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}