/* style.css – все стили для приложения */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f9fd;
    color: #1a2a3a;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app {
    display: flex;
    flex: 1;
}

/* ===== МОБИЛЬНЫЙ ХЕДЕР ===== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #e6f2f9;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #c0dae8;
}
.mobile-title {
    font-size: 18px;
    font-weight: 600;
    color: #1d5a7a;
}
.menu-toggle {
    background: none;
    border: none;
    font-size: 24px;
    color: #1d5a7a;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.menu-toggle:hover {
    background: rgba(0,0,0,0.05);
}
.menu-toggle:active {
    transform: scale(0.95);
}

/* ===== КНОПКА "НАВЕРХ" ===== */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(42, 122, 154, 0.5);
    color: white;
    border: none;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    z-index: 900;
}
.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
}
.scroll-top-btn:hover {
    background: rgba(42, 122, 154, 0.9);
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.scroll-top-btn:active {
    transform: scale(0.95);
}

/* ===== БОКОВАЯ ПАНЕЛЬ ===== */
.sidebar {
    width: 270px;
    background: #e6f2f9;
    border-right: 2px solid #c0dae8;
    padding: 20px 10px;
    overflow-y: auto;
    height: 100vh;
    position: sticky;
    top: 60px;
    flex-shrink: 0;
}
.sidebar h2 {
    font-size: 18px;
    color: #1d5a7a;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 2px solid #b3d4e8;
    padding-bottom: 10px;
}
.lesson-nav {
    list-style: none;
    padding: 0;
}
.lesson-nav li {
    padding: 10px 14px;
    margin: 4px 0;
    border-radius: 8px;
    cursor: pointer;
    background: white;
    transition: all 0.2s;
    border-left: 4px solid transparent;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.lesson-nav li:hover {
    background: #d4e8f2;
    transform: translateX(4px);
}
.lesson-nav li.active {
    background: #b3d9ec;
    border-left-color: #1d6f9c;
    font-weight: bold;
    color: #0b3d55;
}
.lesson-nav li .num {
    background: #8bb9d1;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}
.lesson-nav li.active .num {
    background: #1d6f9c;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid #b3d4e8;
    padding-bottom: 10px;
}
.sidebar-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}
.sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #1d5a7a;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.sidebar-close:hover {
    background: rgba(0,0,0,0.05);
}

/* Кнопка сброса */
.reset-btn {
    width: 100%;
    padding: 10px 16px;
    margin-top: 16px;
    background: #f0e6e6;
    color: #7a3a3a;
    border: 1px solid #d4b8b8;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.reset-btn:hover {
    background: #e6d0d0;
    border-color: #b88a8a;
}
.reset-btn:active {
    transform: scale(0.97);
}

/* ===== ОСНОВНАЯ ОБЛАСТЬ ===== */
.main {
    flex: 1;
    padding: 30px 40px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}
.lesson-content {
    display: none;
    animation: fadeIn 0.3s ease;
}
.lesson-content.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0.4; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.lesson-title {
    font-size: 28px;
    color: #1a5a7a;
    border-bottom: 4px solid #b3d9e8;
    padding-bottom: 12px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}
.lesson-title .arabic-title {
    font-family: 'Amiri', serif;
    font-size: 26px;
    color: #2d6e8a;
}

.section-title {
    font-size: 20px;
    margin: 30px 0 12px 0;
    color: #1f5a78;
    border-left: 6px solid #7fc1db;
    padding-left: 14px;
    background: #f0f8fe;
    line-height: 1.4;
}

/* ===== ТАБЛИЦЫ ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 20px;
    font-size: 14px;
    background: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    border-radius: 10px;
    overflow: hidden;
}
th {
    background: #d9edf7;
    color: #1b4a62;
    font-weight: 600;
    padding: 10px 8px;
    border: 1px solid #b8d2e0;
    text-align: center;
}
td {
    border: 1px solid #d0e0e8;
    padding: 8px 10px;
    vertical-align: middle;
}
tr:nth-child(even) {
    background: #f8fcff;
}

.arabic {
    font-family: 'Amiri', serif;
    font-size: 32px;
    direction: rtl;
    text-align: right;
    unicode-bidi: embed;
    line-height: 1.6;
    padding: 6px 10px;
}
.text-block .arabic {
    font-size: 34px;
}
.exercise .arabic {
    font-size: 30px;
}

.pronunciation {
    font-style: italic;
    color: #6a7f8a;
    font-size: 14px;
    display: block;
    margin-top: 3px;
}
.translation {
    font-size: 15px;
    color: #1a3b4a;
}

.hidden-pronunciation .pronunciation {
    display: none !important;
}
.hidden-translation .translation {
    display: none !important;
}

/* ===== КНОПКА ОЗВУЧКИ ===== */
.audio-btn {
    background: none;
    border: none;
    color: #2a7a9a;
    font-size: 24px;
    cursor: pointer;
    padding: 0 6px;
    transition: transform 0.15s;
    vertical-align: middle;
}
.audio-btn:hover {
    transform: scale(1.2);
    color: #0f4a6b;
}

/* ===== ТЕКСТОВЫЕ БЛОКИ ===== */
.text-block {
    background: #f5faff;
    padding: 16px 20px;
    border-left: 6px solid #7bb8d0;
    margin: 20px 0;
    border-radius: 0 10px 10px 0;
}
.text-block .translation {
    margin-top: 6px;
    color: #1f3f50;
    font-size: 16px;
}
.text-block .pronunciation {
    margin-top: 4px;
    font-size: 15px;
}

/* ===== ЗАМЕТКИ ===== */
.note-block {
    background: #faf3e8;
    padding: 14px 18px;
    border-left: 6px solid #e8b87a;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}
.note-content {
    font-size: 15px;
    color: #4a3a2a;
}

/* ===== УПРАЖНЕНИЯ ===== */
.exercise-block {
    background: #f0f7fc;
    padding: 16px 20px;
    border-radius: 10px;
    border: 1px solid #d4e4ed;
    margin: 14px 0;
}
.exercise-text {
    margin: 6px 0;
    font-size: 14px;
}
.exercise-subheader {
    font-size: 16px;
    font-weight: bold;
    color: #1a5a7a;
    margin: 12px 0 6px 0;
    padding: 4px 10px;
    background: #e6f2f9;
    border-radius: 6px;
    display: inline-block;
}
.exercise-block .table-wrap {
    margin: 4px 0 16px 0;
}
.exercise-block table {
    font-size: 13px;
}
.exercise-block .arabic {
    font-size: 20px;
}

/* ===== АКТИВНЫЙ СЛОВАРЬ И ПОВТОРЕНИЕ ===== */
.vocabulary-block ul,
.revision-block ul {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px 16px;
}
.vocabulary-block li,
.revision-block li {
    padding: 6px 10px;
    background: #f8fcff;
    border-radius: 6px;
    border: 1px solid #e2ecf3;
}
.vocab-arabic {
    font-family: 'Amiri', serif;
    font-size: 20px;
    direction: rtl;
    display: inline-block;
}
.vocab-translation {
    color: #1f4b61;
}

/* ===== ЧИТАЕМ БЕЗ ПЕРЕВОДА ===== */
.reading-block ul {
    list-style: none;
    padding: 0;
}
.reading-phrase {
    font-family: 'Amiri', serif;
    font-size: 22px;
    padding: 8px 12px;
    margin: 6px 0;
    background: #f5faff;
    border-radius: 8px;
    border-left: 4px solid #7bb8d0;
}
.reading-phrase .audio-btn {
    font-size: 20px;
}

/* ===== ПЕРЕКЛЮЧАТЕЛИ ===== */
.toggle-bar {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    background: #eaf3f9;
    padding: 10px 18px;
    border-radius: 30px;
    margin-bottom: 25px;
    align-items: center;
}
.toggle-bar label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #1d4b63;
    cursor: pointer;
}
.toggle-bar input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2d7a9a;
}
.voice-status {
    font-size: 13px;
    color: #1d6f9c;
    margin-left: auto;
}

/* ===== АДАПТИВНОСТЬ (МОБИЛЬНАЯ ВЕРСИЯ) ===== */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    /* Отступ для контента, чтобы не перекрывался хедером */
    .app {
        margin-top: 60px;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 999;
        transition: left 0.3s ease;
        box-shadow: 2px 0 12px rgba(0,0,0,0.1);
        padding-top: 16px;
        border-right: 2px solid #c0dae8;
        background: #e6f2f9;
        overflow-y: auto;
    }
    .sidebar.open {
        left: 0;
    }
    .sidebar-close {
        display: block;
    }

    /* Затемнение фона при открытом меню */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.3);
        z-index: 998;
    }
    .sidebar-overlay.active {
        display: block;
    }

    .main {
        padding: 16px;
    }

    .lesson-nav {
        display: block;
    }
    .lesson-nav li {
        flex: none;
        justify-content: flex-start;
    }

    .toggle-bar {
        flex-wrap: wrap;
        padding: 8px 14px;
        gap: 10px;
        border-radius: 16px;
    }
    .voice-status {
        margin-left: 0;
        width: 100%;
        font-size: 12px;
    }

    .arabic {
        font-size: 26px;
    }
    .text-block .arabic {
        font-size: 28px;
    }
    .lesson-title {
        font-size: 20px;
    }
    .lesson-title .arabic-title {
        font-size: 20px;
    }
    .section-title {
        font-size: 17px;
    }

    .scroll-top-btn {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

@media (max-width: 400px) {
    .sidebar {
        width: 260px;
        left: -260px;
    }
    .sidebar.open {
        left: 0;
    }
    .lesson-title {
        font-size: 18px;
    }
    .arabic {
        font-size: 22px;
    }
    .text-block .arabic {
        font-size: 24px;
    }
    .scroll-top-btn {
        bottom: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}