/* ============================================
   АДАМ — Приложение для изучения осетинского языка
   Mobile-first design
   ============================================ */

:root {
    --primary: #6C63FF;
    --primary-dark: #5A52D5;
    --primary-light: #E8E6FF;
    --accent: #FF6B6B;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #F44336;
    --bg: #F5F5FA;
    --card-bg: #FFFFFF;
    --text: #2D2D3A;
    --text-secondary: #6B6B80;
    --text-light: #9999AA;
    --border: #E8E8F0;
    --shadow: 0 2px 12px rgba(108, 99, 255, 0.08);
    --shadow-lg: 0 8px 32px rgba(108, 99, 255, 0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ---- App Container ---- */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
}

/* ---- Header ---- */
.app-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(108, 99, 255, 0.25);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: white;
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-subtitle {
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    font-weight: 500;
}

/* ---- Main ---- */
.app-main {
    padding: 20px 16px 40px;
    padding-bottom:0px;
}

/* ---- Page Header ---- */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 8px 0 4px;
    color: var(--text);
}

.page-header .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

/* ---- Back Button ---- */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 4px 0;
}

.back-btn:hover {
    color: var(--primary-dark);
}

/* ============================================
   COURSES LIST
   ============================================ */
.courses-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.course-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform 0.15s, box-shadow 0.15s;
}

.course-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--text);
}

.course-icon {
    font-size: 36px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.course-info {
    flex: 1;
    min-width: 0;
}

.course-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px;
}

.course-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 6px;
    line-height: 1.4;
}

.course-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-light);
}

.course-meta i {
    margin-right: 3px;
}

.badge-custom {
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.course-arrow {
    color: var(--text-light);
    font-size: 14px;
}

/* ---- Add Course ---- */
.add-course-section {
    margin-top: 20px;
}

.btn-add-course {
    width: 100%;
    padding: 16px;
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    background: transparent;
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-add-course:hover {
    background: var(--primary-light);
}

/* ---- Modal ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 480px;
    padding: 24px 20px 32px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header-custom h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

/* ---- Forms ---- */
.form-group-custom {
    margin-bottom: 16px;
}

.form-group-custom label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.input-custom {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
    background: var(--card-bg);
    transition: border-color 0.2s;
    outline: none;
}

.input-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.input-custom::placeholder {
    color: var(--text-light);
}

/* ---- Buttons ---- */
.btn-primary-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-primary-custom:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-secondary-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    margin-top: 12px;
}

.btn-secondary-custom:hover {
    background: #d5d2ff;
    color: var(--primary-dark);
}

/* ============================================
   LESSONS
   ============================================ */
.lessons-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lesson-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.lesson-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.lesson-number {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.lesson-header h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
}

/* ---- Theory ---- */
.theory-section {
    background: #FFF8E1;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    overflow: hidden;
}

.theory-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: #F57F17;
}

.toggle-icon {
    margin-left: auto;
    transition: transform 0.3s;
}

.theory-section.expanded .toggle-icon {
    transform: rotate(180deg);
}

.theory-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    padding: 0 16px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.theory-section.expanded .theory-content {
    max-height: 800px;
    padding: 0 16px 16px;
}

.theory-content h4,
.theory-content h5 {
    font-size: 15px;
    margin: 12px 0 8px;
    color: var(--text);
}

.theory-content p,
.theory-content li {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.theory-content .table {
    font-size: 13px;
    margin-top: 8px;
}

/* ---- Tasks ---- */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s;
}

.task-item:hover {
    background: var(--primary-light);
    color: var(--text);
}

.task-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
}

.task-icon.lexicon {
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
}

.task-icon.conjugation {
    background: linear-gradient(135deg, #FF9800, #FFB74D);
}

.task-info {
    flex: 1;
}

.task-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 2px;
}

.task-info p {
    font-size: 12px;
    color: var(--text-light);
    margin: 0;
}

.task-play {
    color: var(--primary);
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 24px;
    color: var(--text-light);
}

.empty-state i {
    font-size: 32px;
    margin-bottom: 8px;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* ============================================
   FLASHCARDS
   ============================================ */
.cards-page,
.conjugation-page {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 140px);
}

.cards-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.cards-progress {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
}

.progress-bar-custom {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px;
    transition: width 0.4s ease;
}

.flashcard-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
    margin-bottom: 20px;
}

.flashcard {
    display: none;
    width: 100%;
    max-width: 360px;
}

.flashcard.active {
    display: block;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    min-height: 380px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.flashcard-inner.flipped {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 380px;
    backface-visibility: hidden;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}

.flashcard-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.card-image {
    max-width: 100%;
    max-height: 180px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 16px;
}

.card-image img {
    width: 100%;
    height: 180px;
    object-fit: contain;
}

.card-word {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.card-word.russian {
    color: white;
}

.card-verb-type {
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 12px;
}

.flashcard-back .card-verb-type {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-audio {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 18px;
    cursor: pointer;
    margin: 8px 0;
    transition: transform 0.15s, background 0.15s;
}

.btn-audio:hover {
    transform: scale(1.1);
    background: var(--primary-dark);
}

.card-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 12px;
}

.flashcard-back .card-hint {
    color: rgba(255, 255, 255, 0.6);
}

/* ---- Card Actions ---- */
.cards-actions {
    display: flex;
    gap: 12px;
    padding: 16px 0;
}

.btn-exit {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px;
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.btn-exit:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-next {
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-next:hover {
    background: var(--primary-dark);
}

/* ============================================
   CONJUGATION TEST
   ============================================ */
.questions-container {
    flex: 1;
    margin-bottom: 20px;
}

.question-card {
    display: none;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow-lg);
}

.question-card.active {
    display: block;
}

.question-label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.question-sentence {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 24px;
    line-height: 1.3;
}

.answer-section {
    margin-bottom: 16px;
}

.answer-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 18px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.answer-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.answer-feedback {
    display: none;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-top: 12px;
    font-size: 14px;
    font-weight: 500;
}

.answer-feedback.correct {
    background: #E8F5E9;
    color: #2E7D32;
}

.answer-feedback.incorrect {
    background: #FFEBEE;
    color: #C62828;
}

.btn-hint {
    background: none;
    border: none;
    color: var(--warning);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hint-text {
    background: #FFF3E0;
    color: #E65100;
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    margin-top: 8px;
    font-style: italic;
}

.btn-check {
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.btn-check:hover {
    background: #43A047;
}

.score-bar {
    background: var(--primary-light);
    color: var(--primary);
    text-align: center;
    padding: 8px;
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
}

.conjugation-result {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    flex: 1;
}

.result-icon {
    font-size: 56px;
    color: var(--warning);
    margin-bottom: 16px;
}

.conjugation-result h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

.result-score {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}

.conjugation-result p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 24px;
}
/* ============================================
   LISTENING (Аудирование) - исправленное расположение
   ============================================ */
.listening-page {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 140px);
}

/* Ключевое изменение - форма занимает всё доступное пространство */
#listeningForm {
    flex: 1;
    display: flex;
    flex-direction: column;
}



.question-card {
    display: none;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

    .question-card.active {
        display: block;
        animation: fadeIn 0.4s ease;
    }

/* Кнопки теперь будут внизу */
.cards-actions {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    margin-top: 20px;
    background: var(--bg); /* Чтобы кнопки не сливались с фоном */
    flex-shrink: 0; /* Запрещаем сжатие */
}

/* Остальные стили остаются без изменений */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-label {
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-section {
    margin-bottom: 24px;
}

.btn-play-audio {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

    .btn-play-audio:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }

.question-sentence {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 20px;
    line-height: 1.4;
}

.answer-section {
    margin-bottom: 16px;
}

.answer-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

    .answer-input:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-light);
    }

.answer-feedback {
    display: none;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-top: 12px;
    font-size: 14px;
    font-weight: 500;
}

    .answer-feedback.correct {
        background: #E8F5E9;
        color: #2E7D32;
        border-left: 4px solid var(--success);
    }

    .answer-feedback.incorrect {
        background: #FFEBEE;
        color: #C62828;
        border-left: 4px solid var(--danger);
    }

.btn-hint {
    background: none;
    border: none;
    color: var(--warning);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hint-text {
    background: #FFF3E0;
    color: #E65100;
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    margin-top: 8px;
}

.score-bar {
    background: var(--primary-light);
    color: var(--primary);
    text-align: center;
    padding: 10px;
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Стили для результата */
.listening-result {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    flex: 1;
}

.result-icon {
    font-size: 56px;
    color: var(--warning);
    margin-bottom: 16px;
}

.listening-result h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

.result-score {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}

/* Кнопка проверки как в спряжении */
.btn-check {
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

    .btn-check:hover {
        background: #43A047;
    }

.btn-next {
    flex: 2;
    background: var(--primary);
}

    .btn-next:hover {
        background: var(--primary-dark);
    }

.btn-exit {
    flex: 1;
}

@media (max-width: 480px) {
    .question-card {
        padding: 20px 16px;
    }

    .question-sentence {
        font-size: 16px;
    }

    .answer-input {
        font-size: 14px;
        padding: 12px 14px;
    }
}
/* ============================================
   CONSTRUCTOR
   ============================================ */
.constructor-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.constructor-cards h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.mini-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mini-card {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.mini-card-img {
    height: 80px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mini-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-card-img i {
    font-size: 24px;
    color: var(--text-light);
}

.mini-card-text {
    padding: 8px 10px;
}

.mini-card-text strong {
    display: block;
    font-size: 13px;
    color: var(--text);
}

.mini-card-text span {
    display: block;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

.btn-add-card {
    width: 100%;
    padding: 16px;
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    background: transparent;
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.card-form {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.audio-recorder {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-record {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-record:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-record.recording {
    border-color: var(--danger);
    color: var(--danger);
    background: #FFEBEE;
}

.recording-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
}

.recording-dot {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.image-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

    .tab-btn.active {
        background: linear-gradient(135deg, var(--primary), var(--primary-dark));
        color: white;
        border-color: var(--primary);
    }

.image-tab-content {
    margin-top: 15px;
}

.btn-generate-image {
    margin-top: 10px;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

    .btn-generate-image:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }

.btn-remove-image {
    margin-top: 10px;
    padding: 5px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.image-preview {
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    background: #f9f9f9;
    text-align: center;
}

    .image-preview img {
        max-width: 100%;
        max-height: 200px;
        object-fit: contain;
    }

.file-hint {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.file-input {
    position: relative;
    display: inline-block;
    cursor: pointer;
    width:100%;
}

    .file-input input {
        position: absolute;
        opacity: 0;
        width: 100%;
        height: 100%;
        cursor: pointer;
    }

    .file-input label {
        display: inline-block;
        background: var(--primary);
        color: white;
        padding: 12px 24px;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        width:100%;
        text-align:center;
    }

    .file-input:hover label {
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
    }
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.btn-cancel {
    width: 100%;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}

.constructor-footer {
    margin-top: 12px;
}

.btn-done {
    background: var(--success);
}

.btn-done:hover {
    background: #43A047;
}
.constructor-footer {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
    margin-top: 20px;
    border-radius:10px;
}

.footer-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
}

/* Кнопка чата в футере */
.btn-chat-footer {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

    .btn-chat-footer i {
        font-size: 18px;
    }

    .btn-chat-footer span {
        font-size: 14px;
    }

    .btn-chat-footer:active {
        transform: scale(0.98);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }


    .btn-done span {
        font-size: 14px;
    }

/* Для мобильных устройств */
@media (max-width: 768px) {
    .constructor-footer {
        padding: 10px 12px;
    }

    .btn-chat-footer, .btn-done {
        padding: 10px 16px;
    }

        .btn-chat-footer i, .btn-done i {
            font-size: 16px;
        }

        .btn-chat-footer span, .btn-done span {
            font-size: 13px;
        }
}




/* Модальное окно чата */
.chat-modal {
    max-width: 500px;
    width: 100%;
    height: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.chat-message {
    margin-bottom: 15px;
    display: flex;
}

    .chat-message.user {
        justify-content: flex-end;
    }

    .chat-message.assistant {
        justify-content: flex-start;
    }

.message-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    word-wrap: break-word;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    transition: border-color 0.3s;
}

    .chat-input:focus {
        outline: none;
        border-color: #667eea;
    }

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

    .chat-send-btn:hover {
        transform: scale(1.05);
    }

.chat-loader {
    text-align: center;
    padding: 10px;
    color: #667eea;
    font-size: 14px;
}


    .modal-overlay.show {
        display: flex;
        animation: fadeIn 0.3s ease;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}
.quick-question-btn {
    display: inline-block;
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
    border-radius: 15px;
    padding: 5px 12px;
    margin: 5px 5px 0 0;
    font-size: 12px;
    color: #667eea;
    cursor: pointer;
    transition: all 0.2s;
}

    .quick-question-btn:hover {
        background: #667eea;
        color: white;
        border-color: #667eea;
    }

.chat-message.assistant .message-bubble a {
    word-break: break-all;
}
/* ============================================
   Quill
   ============================================ */
/* --- КНОПКА ЖИРНОГО ШРИФТА (Bold) --- */
/* Скрываем стандартную иконку */
.my-cool-action-bar .ql-bold svg {
    display: none !important;
}
/* Подставляем букву Ж */
.my-cool-action-bar .ql-bold::after {
    content: "Ж";
    font-weight: bold;
    font-size: 16px;
}

.my-cool-action-bar .ql-italic svg {
    display: none !important;
}

.my-cool-action-bar .ql-italic::after {
    content: "К";
    font-style: italic;
    font-weight: 500;
    font-size: 16px;
}

.my-cool-action-bar .ql-underline svg {
    display: none !important;
}

.my-cool-action-bar .ql-underline::after {
    content: "Ч";
    text-decoration: underline;
    font-size: 16px;
}

.quill-wrapper {
    max-width: 100%;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ql-container.ql-snow {
    height: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden; 
}

.ql-editor {
    flex: 1;
    overflow-y: auto; 
    padding: 15px;
    line-height: 1.6;
}

.ql-editor::-webkit-scrollbar {
    width: 8px;
}

.ql-editor::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.ql-editor::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.ql-editor::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
.table-responsive-custom {
    width: 100%;
    overflow-x: auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    margin-top: 15px;
}

.app-custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 15px;
}

.app-custom-table thead tr {
    background-color: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.app-custom-table th {
    padding: 14px 16px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.app-custom-table th i {
    margin-right: 6px;
    color: #64748b;
}

.app-custom-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s ease;
}

.app-custom-table tbody tr:hover {
    background-color: #f1f5f9;
}

.app-custom-table tbody tr:last-child {
    border-bottom: none;
}

.app-custom-table td {
    padding: 16px;
    vertical-align: middle;
}

.table-cell-sentence {
    color: #1e293b;
    font-weight: 500;
}

.table-cell-answer strong {
    color: #28a745;
    font-size: 16px;
}

.hint-badge {
    display: inline-block;
    background-color: #fef3c7;
    color: #d97706;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #fde68a;
}

.hint-none {
    color: #94a3b8;
}

.table-empty-state {
    padding: 30px;
    text-align: center;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px dashed #cbd5e1;
    color: #64748b;
    font-style: italic;
    margin-top: 15px;
}
/* ============================================
   RESPONSIVE
   ============================================ */
@media (min-width: 481px) {
    .app-container {
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
    }
}
