:root {
    --primary-color: #E30A17; /* Turkish Red */
    --secondary-color: #f7b733;
    --success-color: #4caf50;

    /* Level Accent Colors */
    --level-a1-color: #10B981; /* Emerald Green */
    --level-a2-color: #0EA5E9; /* Sky Blue */
    --level-b1-color: #F59E0B; /* Amber / Warm Gold */
    --level-b2-color: #6366F1; /* Purple / Indigo */
    
    /* Light Theme */
    --bg-color: #e9ecf2;
    --text-color: #23262b;
    --text-muted: #666666;
    --card-bg: rgba(255, 255, 255, 0.86);
    --surface-2: rgba(20, 25, 40, 0.045);
    --glass-border: rgba(255, 255, 255, 0.4);
    --hover-bg: rgba(255, 255, 255, 0.95);
    --active-nav-bg: rgba(227, 10, 23, 0.08);
}

body.dark-theme {
    /* Dark Theme */
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --card-bg: rgba(32, 32, 32, 0.82);
    --surface-2: rgba(255, 255, 255, 0.045);
    --glass-border: rgba(255, 255, 255, 0.1);
    --hover-bg: rgba(50, 50, 50, 0.9);
    --active-nav-bg: rgba(227, 10, 23, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.5rem;
    font-weight: 800;
}

h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* Layout */
.app-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    height: 100vh;
}

/* Glassmorphism */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid var(--glass-border);
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    padding: 2.2rem 1.2rem;
    z-index: 10;
    border-right: 1px solid var(--glass-border);
}

.sidebar-header {
    margin-bottom: 2.5rem;
    padding: 0 0.4rem;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
}

.nav-links li {
    margin-bottom: 0.6rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 9999px;
    transition: all 0.2s ease;
}

.nav-links a .nav-icon {
    opacity: 0.65;
    transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-links a:hover {
    background: var(--hover-bg);
    transform: translateX(3px);
}

.nav-links a:hover .nav-icon {
    opacity: 1;
}

.nav-links a.active {
    background: var(--primary-color);
    color: #ffffff;
    font-weight: 700;
    border-radius: 9999px;
    box-shadow: 0 4px 15px rgba(227, 10, 23, 0.35);
    transform: none;
}

.nav-links a.active .nav-icon {
    opacity: 1;
    color: #ffffff;
}

.sidebar-footer {
    text-align: center;
}

/* Main Content */
.main-content {
    padding: 2rem;
    overflow-y: auto;
}

#app-view {
    max-width: 1000px;
    margin: 0 auto;
    animation: fadeIn 0.4s ease-in-out;
}

.view-section {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.view-section.active {
    display: block;
}

/* Buttons */
.btn {
    cursor: pointer;
    border: none;
    padding: 10px 20px;
    font-family: inherit;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(227, 10, 23, 0.4);
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(227, 10, 23, 0.6);
}

.glass-btn {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
}

.glass-btn:hover {
    background: var(--hover-bg);
}

.lesson-link {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease !important;
}

.lesson-link:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15) !important;
}

body.dark-theme .lesson-badge {
    background: rgba(255,255,255,0.1) !important;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Grids */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    .sidebar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }
    .sidebar-header { margin-bottom: 0; }
    .nav-links { display: flex; gap: 10px; margin-bottom: 0; }
    .nav-links li { margin-bottom: 0; }
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

body.dark-theme .slider {
    background-color: #555;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Modal & Slide-over */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    background: var(--bg-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    overflow-y: auto;
    padding: 2rem;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-backdrop.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    z-index: 101;
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--hover-bg);
}

/* Accordion */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.accordion-content.expanded {
    max-height: 2000px;
}

/* Badges */
.badge {
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}

.badge-thick {
    background: rgba(227, 10, 23, 0.1);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.badge-thin {
    background: rgba(33, 150, 243, 0.1);
    color: #2196f3;
    border: 1px solid #2196f3;
}


/* ─── Phase 1: SRS & Dashboard Metric Tiles ──────────────────────────────── */

.metric-tile {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

/* SRS due/new/learned badges on vocab cards */
.srs-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.srs-badge.new {
    background: rgba(33, 150, 243, 0.18);
    color: #2196f3;
    border: 1px solid #2196f3;
}

.srs-badge.due {
    background: rgba(227, 10, 23, 0.12);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.srs-badge.learned {
    background: rgba(76, 175, 80, 0.12);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

/* SRS rating buttons */
.srs-rating-btn {
    cursor: pointer;
    border: none;
    border-radius: 10px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.srs-rating-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}

/* Minimal-pairs block in grammar notes */
.minimal-pairs {
    background: rgba(0,0,0,0.04);
    border-left: 3px solid var(--primary-color);
    padding: 10px 16px;
    border-radius: 0 8px 8px 0;
    margin: 10px 0;
}

body.dark-theme .minimal-pairs {
    background: rgba(255,255,255,0.05);
}

/* Grammar note HTML tables */
.html-content table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 15px;
    font-size: 0.92rem;
}

.html-content th {
    background: rgba(0,0,0,0.06);
    padding: 7px 8px;
    text-align: left;
    font-weight: 700;
}

.html-content td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--glass-border);
}

/* ─── Phase 3+4: Lesson Route, Breadcrumb, TTS, Quiz ─────────────────────── */

/* Breadcrumb navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    padding: 8px 0;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
    transition: opacity 0.2s;
}

.breadcrumb a:hover {
    opacity: 0.75;
    text-decoration: underline;
}

.breadcrumb-sep {
    color: var(--text-muted);
    opacity: 0.5;
    font-weight: 400;
    margin: 0 2px;
}

.breadcrumb-current {
    color: var(--text-muted);
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Lesson page card — remove the card hover lift since it's a full page */
.lesson-page-card {
    transition: none !important;
}

.lesson-page-card:hover {
    transform: none !important;
    box-shadow: 0 8px 32px 0 rgba(0,0,0,0.1) !important;
}

/* Grammar bold tags — indicate TTS-clickable on hover */
.html-content b[title],
.html-content strong[title] {
    border-bottom: 1px dashed rgba(0,0,0,0.2);
    transition: border-color 0.2s, color 0.2s;
}

.html-content b[title]:hover,
.html-content strong[title]:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

body.dark-theme .html-content b[title],
body.dark-theme .html-content strong[title] {
    border-bottom-color: rgba(255,255,255,0.2);
}

/* Quiz feedback box animation */
#quiz-feedback-box {
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Lesson link — now <a> tags instead of <button>, keep the same style */
a.lesson-link {
    display: flex !important;
}

/* Mobile: stack breadcrumb tighter */
@media (max-width: 600px) {
    .breadcrumb {
        font-size: 0.78rem;
    }
    .breadcrumb-current {
        max-width: 110px;
    }
}

/* ─── Phase 5: Pronunciation Practice Mode ──────────────────────────────── */

.mic-icon {
    transition: transform 0.2s, color 0.2s;
    user-select: none;
}

.mic-icon:hover {
    transform: scale(1.1);
}

.mic-icon.listening {
    color: var(--primary-color) !important;
    animation: pulseMic 1.2s infinite;
}

@keyframes pulseMic {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.glow-correct {
    animation: glowSuccess 1.5s ease-out;
}

@keyframes glowSuccess {
    0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
    50% { box-shadow: 0 0 20px 10px rgba(76, 175, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

.glow-incorrect {
    animation: glowError 1.5s ease-out;
}

@keyframes glowError {
    0% { box-shadow: 0 0 0 0 rgba(227, 10, 23, 0.7); }
    50% { box-shadow: 0 0 20px 10px rgba(227, 10, 23, 0); }
    100% { box-shadow: 0 0 0 0 rgba(227, 10, 23, 0); }
}

.pronunciation-feedback {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    z-index: 10;
}

.pronunciation-feedback.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* Level Theme Accent Styling */
.level-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-left: 4px solid var(--level-color, var(--primary-color)) !important;
}

.level-card[data-level="A1"] { --level-color: var(--level-a1-color); }
.level-card[data-level="A2"] { --level-color: var(--level-a2-color); }
.level-card[data-level="B1"] { --level-color: var(--level-b1-color); }
.level-card[data-level="B2"] { --level-color: var(--level-b2-color); }

.level-badge-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 800;
    color: #ffffff;
    background-color: var(--level-color, var(--primary-color));
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.progress-pill-track {
    flex: 1;
    max-width: 220px;
    height: 8px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

body.dark-theme .progress-pill-track {
    background: rgba(255, 255, 255, 0.12);
}

.progress-pill-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--level-color, var(--success-color));
    transition: width 0.4s ease;
}

.chevron-icon {
    width: 22px;
    height: 22px;
    transition: transform 0.3s ease;
    stroke: var(--text-color);
    opacity: 0.7;
    flex-shrink: 0;
}

.accordion-header:hover .chevron-icon {
    opacity: 1;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
}

.accordion-content.expanded {
    max-height: 2000px;
    transition: max-height 0.4s cubic-bezier(1, 0, 1, 0);
}

/* ─── Dashboard: Hero + Stat Strip ───────────────────────────────────────── */

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 22px 24px;
    border-radius: 18px;
    margin: 20px 0;
    background: linear-gradient(135deg, rgba(227, 10, 23, 0.10), rgba(227, 10, 23, 0.02));
    border: 1px solid rgba(227, 10, 23, 0.14);
}

body.dark-theme .dashboard-hero {
    background: linear-gradient(135deg, rgba(227, 10, 23, 0.20), rgba(227, 10, 23, 0.04));
    border-color: rgba(227, 10, 23, 0.24);
}

.dashboard-hero-text {
    display: flex;
    align-items: center;
    gap: 14px;
}

.dashboard-hero-streak {
    font-size: 2.2rem;
    line-height: 1;
}

.dashboard-hero-title {
    font-size: 1.05rem;
    font-weight: 800;
}

.dashboard-hero-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.dashboard-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stat-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.stat-chip {
    background: var(--surface-2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.stat-chip:hover {
    transform: translateY(-2px);
}

.stat-chip-icon {
    font-size: 1.15rem;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--stat-color, var(--primary-color));
    background: color-mix(in srgb, var(--stat-color, var(--primary-color)) 16%, transparent);
}

.stat-chip-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--stat-color, var(--text-color));
    line-height: 1.15;
}

.stat-chip-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.section-panel {
    margin: 20px 0 0;
    padding: 16px 18px;
    border-radius: 14px;
    background: var(--surface-2);
    border: 1px solid var(--glass-border);
}

.section-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.badge-chip {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 14px;
    text-align: center;
    min-width: 90px;
    transition: transform 0.2s ease;
}

.badge-chip:hover {
    transform: translateY(-2px);
}

/* ─── Curriculum: level-tinted unit headers, lesson chips ───────────────── */

.unit-title {
    color: var(--level-color, var(--primary-color));
}

.lesson-badge {
    background: var(--surface-2);
}

.lesson-link.is-completed {
    opacity: 0.6;
}

.lesson-link.is-completed .lesson-badge {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success-color);
}


