/* frontend/css/style.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #64748b;
    --card-bg: #ffffff;
    --body-bg: #f1f5f9;
    --text: #334155;
    --border: #e2e8f0;
}

body.dark {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --secondary: #a78bfa;
    --card-bg: #1e293b;
    --body-bg: #0f172a;
    --text: #e2e8f0;
    --border: #334155;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--body-bg);
    color: var(--text);
    min-height: 100vh;
    transition: all 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 10px;
}

header p {
    color: var(--gray);
}

.theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 8px 16px;
    cursor: pointer;
    color: var(--text);
    font-size: 0.9rem;
}

.nav-buttons-top, .nav-buttons-bottom {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-home, .btn-back {
    background: var(--gray);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-home:hover, .btn-back:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.audience-switch {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.audience-btn {
    padding: 12px 28px;
    border: 2px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    border-radius: 40px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
}

.audience-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.audience-btn:hover:not(.active) {
    background: rgba(99, 102, 241, 0.1);
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.level-card, .class-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid var(--border);
    text-align: center;
}

.level-card:hover, .class-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -12px rgba(0, 0, 0, 0.2);
}

.level-card.coming-soon, .class-card.coming-soon {
    opacity: 0.6;
    cursor: not-allowed;
}

.level-card.coming-soon:hover, .class-card.coming-soon:hover {
    transform: none;
}

.level-icon, .class-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.level-title, .class-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 8px;
}

.level-badge {
    background: var(--primary);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.85rem;
    color: white;
    display: inline-block;
    margin-top: 12px;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 15px 25px;
    text-align: center;
    min-width: 120px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray);
}

.day-block {
    margin-bottom: 24px;
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.day-header {
    background: var(--card-bg);
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.day-header h3 {
    margin: 0;
}

.day-status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.day-status-badge.completed {
    background: var(--success);
    color: white;
}

.day-status-badge.current {
    background: var(--primary);
    color: white;
}

.day-content {
    padding: 20px;
    background: var(--body-bg);
    display: none;
}

.day-content.open {
    display: block;
}

.grammar-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.grammar-card h3 {
    color: var(--primary);
    margin-bottom: 16px;
}

.grammar-rule {
    background: rgba(99, 102, 241, 0.1);
    padding: 16px;
    border-radius: 12px;
    margin: 16px 0;
    white-space: pre-wrap;
}

.grammar-example {
    background: var(--body-bg);
    padding: 10px;
    border-radius: 8px;
    margin: 8px 0;
    font-style: italic;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.vocab-item {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.vocab-item:hover {
    transform: translateY(-2px);
}

.vocab-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.vocab-word {
    font-weight: bold;
    font-size: 1rem;
}

.vocab-transcription {
    font-size: 0.7rem;
    color: var(--gray);
}

.vocab-translation {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 4px;
}

.vocab-example {
    font-size: 0.7rem;
    color: var(--gray);
    margin-top: 8px;
    font-style: italic;
}

.exercise-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
    border: 1px solid var(--border);
}

.exercise-card.correct {
    border-left-color: var(--success);
}

.exercise-card.incorrect {
    border-left-color: var(--danger);
}

.exercise-question {
    font-size: 1rem;
    margin-bottom: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.option {
    padding: 8px 12px;
    background: var(--body-bg);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.option:hover {
    background: rgba(99, 102, 241, 0.1);
}

.option.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.fill-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text);
    margin-bottom: 16px;
}

.fill-input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-check {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-check:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-next {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-next:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.explanation {
    margin-top: 16px;
    padding: 12px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 10px;
    display: none;
    font-size: 0.9rem;
}

.explanation.show {
    display: block;
}

.adaptive-hint {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--warning);
    padding: 16px;
    margin: 20px 0;
    border-radius: 10px;
}

.adaptive-hint h4 {
    color: var(--warning);
    margin-bottom: 8px;
}

.speak-sentence-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 20px;
    transition: all 0.2s;
}

.speak-sentence-btn:hover {
    background: rgba(99, 102, 241, 0.2);
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    z-index: 1000;
    animation: fadeInOut 2s ease forwards;
}

.toast.error {
    background: var(--danger);
}

.toast.info {
    background: var(--warning);
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

.timetable-grid {
    overflow-x: auto;
}

.timetable-row {
    display: grid;
    grid-template-columns: 80px repeat(5, 1fr);
    gap: 8px;
    align-items: center;
    min-width: 500px;
    margin-bottom: 8px;
}

.timetable-time {
    font-weight: bold;
    background: var(--primary);
    color: white;
    padding: 8px;
    border-radius: 8px;
    text-align: center;
}

.timetable-subject {
    background: var(--body-bg);
    padding: 8px;
    border-radius: 8px;
    text-align: center;
}

.certificate-modal {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 600px) {
    .container { padding: 16px; }

    header {
        position: relative;
        padding-top: 50px;
        margin-bottom: 20px;
    }

    header h1 {
        font-size: 1.5rem;
        margin-top: 10px;
    }

    .theme-toggle {
        position: absolute;
        top: 0;
        right: 0;
        left: auto;
        font-size: 0.7rem;
        padding: 5px 10px;
    }

    .nav-buttons-top, .nav-buttons-bottom {
        flex-direction: column;
    }

    .btn-home, .btn-back {
        width: 100%;
        text-align: center;
    }

    .stats-bar { gap: 8px; }
    .stat-card { padding: 8px 12px; min-width: 70px; }
    .stat-value { font-size: 1.2rem; }
    .stat-label { font-size: 0.7rem; }

    .weeks-grid { grid-template-columns: 1fr; }
    .vocab-grid { grid-template-columns: 1fr; }

    .audience-btn { padding: 6px 12px; font-size: 0.8rem; }

    .day-header h3 { font-size: 0.9rem; }
    .day-status-badge { font-size: 0.65rem; }

    .grammar-card, .exercise-card { padding: 12px; }
    .exercise-question { font-size: 0.9rem; }

    .option { padding: 8px 12px; font-size: 0.85rem; }
    .btn-check, .btn-next { padding: 8px 16px; font-size: 0.85rem; }

    .timetable-row {
        min-width: 450px;
        gap: 4px;
    }

    .timetable-time { font-size: 0.7rem; padding: 4px; }
    .timetable-subject { font-size: 0.65rem; padding: 4px; }
}

/* ========== ЗАГОЛОВОК НЕДЕЛИ В РАМКЕ ========== */
.week-title-wrapper {
    display: inline-block;
    background: var(--card-bg) !important;
    padding: 16px 32px;
    border-radius: 16px;
    border: 3px solid var(--primary) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 8px;
}

header .week-title-wrapper h1 {
    margin: 0;
    font-size: 2rem;
    color: var(--text) !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
    background-image: none !important;
}

/* ========== КЛИКАБЕЛЬНЫЕ СЛОВА (БЕЗ ПОДЧЁРКИВАНИЯ) ========== */
.clickable-word,
.clickable-word:link,
.clickable-word:visited,
.clickable-word:hover,
.clickable-word:active,
a .clickable-word,
.clickable-word a {
    text-decoration: none !important;
    border-bottom: none !important;
    cursor: pointer;
    transition: background 0.2s;
}

.clickable-word:hover {
    background: rgba(99, 102, 241, 0.1);
    border-radius: 4px;
}

.tip-section {
    background: linear-gradient(135deg, rgba(249,115,22,0.08), rgba(139,92,246,0.08));
    border-radius: 20px;
    padding: 25px 30px;
    margin: 40px 0 30px;
    border-left: 4px solid var(--primary);
    position: relative;
    overflow: hidden;
}
.tip-label {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.tip-content {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    margin-bottom: 15px;
    padding-right: 20px;
}

.tip-icon {
    font-size: 1.5rem;
    margin-right: 10px;
    vertical-align: middle;
}

.tip-refresh {
    background: none;
    border: none;
    color: var(--gray);
    font-size: 0.7rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 5px 10px;
    border-radius: 20px;
}

.tip-refresh:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

/* ========== БЛОК "О ПРОЕКТЕ" ========== */
.about-section {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 40px;
    margin: 50px 0;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.about-container {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    align-items: flex-start;
}

.about-icon {
    flex: 0 0 120px;
    text-align: center;
    padding-top: 10px;
}

.about-icon-main {
    font-size: 4.5rem;
    display: block;
    margin-bottom: 10px;
}

.about-content {
    flex: 1;
    min-width: 250px;
}

.about-title {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    position: relative;
    padding-bottom: 12px;
}

.about-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
}

.about-text {
    margin-bottom: 16px;
    line-height: 1.6;
    color: var(--text);
    font-size: 1rem;
}

.about-text strong {
    color: var(--primary);
    font-weight: 600;
}

.about-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 25px;
}

.about-badge {
    background: rgba(99, 102, 241, 0.08);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.15);
    transition: all 0.2s ease;
}

.about-badge:hover {
    background: rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

/* ========== БЛОК ОБРАТНОЙ СВЯЗИ ========== */
.feedback-section {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
    border-radius: 24px;
    padding: 35px;
    margin: 50px 0;
    border: 1px solid var(--border);
    text-align: center;
}

.feedback-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 15px;
}

.feedback-subtitle {
    font-size: 1rem;
    color: var(--gray);
    margin-bottom: 25px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.feedback-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.feedback-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 40px;
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.feedback-btn:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feedback-btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.feedback-btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ========== АДАПТИВНОСТЬ ДЛЯ ЭТИХ БЛОКОВ ========== */
@media (max-width: 600px) {
    .about-section {
        padding: 25px;
        margin: 30px 0;
    }
    .about-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
    }
    .about-icon {
        flex: 0 0 auto;
    }
    .about-title::after {
        left: 50%;
        transform: translateX(-50%);
    }
    .about-badges {
        justify-content: center;
    }
    .feedback-section {
        padding: 25px;
        margin: 30px 0;
    }
    .feedback-title {
        font-size: 1.3rem;
    }
    .feedback-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    .feedback-btn {
        justify-content: center;
    }
}

/* ========== ПОДВАЛ (ФУТЕР) ========== */
.site-footer {
    text-align: center;
    padding: 30px 20px 20px;
    margin-top: 40px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--gray);
}

.site-footer a {
    color: var(--gray);
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: var(--primary);
}

.footer-links {
    margin-top: 8px;
}

/* Адаптация для мобильных устройств */
@media (max-width: 600px) {
    .site-footer {
        padding: 20px 16px 16px;
        margin-top: 20px;
        font-size: 0.7rem;
    }
    .footer-links a {
        display: inline-block;
        margin: 4px 6px;
    }
}

/* ========== КНОПКИ ОЗВУЧКИ В СЛОВАРЕ ========== */
.vocab-item button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);          /* наследуем цвет текста темы */
    font-size: 0.85rem;
    transition: color 0.2s, background 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
}

.vocab-item button:hover {
    color: var(--primary);       /* при наведении — акцентный цвет */
    background: rgba(99, 102, 241, 0.1);
}

/* ========== ВЫРАВНИВАНИЕ ТЕКСТА ПО ШИРИНЕ ========== */

/* Для правил в грамматике */
.grammar-rule {
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    word-wrap: break-word;
}

/* Для текстов чтения в упражнениях */
.exercise-card .reading-text,
.exercise-card .reading-text p,
.reading-container {
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    word-wrap: break-word;
}

/* Дополнительно: улучшаем читаемость (опционально) */
.grammar-rule {
    line-height: 1.6;
    padding: 16px;
}

.reading-container {
    line-height: 1.6;
    padding: 16px;
}