/* --- CSS STYLING --- */
:root {
    --primary: #002395; /* Default Primary (French Blue) */
    --accent: #ED2939; /* Default Accent (French Red) */
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #333333;
    --border: #e0e0e0;
    --success: #28a745;
}

[data-theme="dark"] {
    --primary: #8ab4f8;
    --accent: #ff8a80;
    --bg: #121212;
    --surface: #1e1e1e;
    --text: #e0e0e0;
    --border: #333333;
}

* { box-sizing: border-box; transition: background 0.3s, color 0.3s; }
body { font-family: 'Segoe UI', Roboto, sans-serif; margin: 0; background: var(--bg); color: var(--text); height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* Mobile Header */
.mobile-header {
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 15px;
    z-index: 101;
    flex-shrink: 0;
}

.mobile-header button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
}

.mobile-title {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--primary);
    flex-grow: 1;
}

/* Layout */
/* Sidebar becomes Drawer */
.sidebar {
    width: 85%;
    max-width: 320px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.sidebar.open {
    transform: translateX(0);
}

.main {
    flex-grow: 1;
    overflow-y: auto;
    position: relative;
    width: 100%;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Sidebar Components */
.brand { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.brand-header { display: flex; justify-content: space-between; align-items: center; font-size: 1.1rem; font-weight: bold; color: var(--primary); }

/* Selectors */
.selector-label { font-size: 0.8rem; color: #666; margin-bottom: 4px; font-weight: 600; }
.course-select, .level-select {
    width: 100%; padding: 8px; border-radius: 4px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text); font-weight: 600; cursor: pointer; margin-bottom: 8px;
}

.progress-container { padding: 15px 20px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.3s ease; }
.nav-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex-grow: 1; }
.nav-item { display: flex; align-items: center; padding: 12px 20px; cursor: pointer; border-bottom: 1px solid var(--border); }
.nav-item.active { background: rgba(0,0,0,0.05); border-left: 4px solid var(--primary); } /* Generic active background */
.nav-item.completed .status-icon { color: var(--success); }
.status-icon { width: 24px; margin-right: 10px; font-size: 0.8rem; color: var(--border); text-align: center;}

/* Title Styling in Sidebar */
.lesson-meta { display: flex; flex-direction: column; }
.lesson-meta .main-title { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.lesson-meta .sub-title { font-size: 0.8rem; color: #666; margin-top: 2px; font-style: italic; }

/* Content Components */
.header { position: sticky; top: 0; background: var(--surface); padding: 15px 20px; border-bottom: 1px solid var(--border); z-index: 100; }
.lesson-content { padding: 20px; width: 100%; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
h2 { margin-top: 0; color: var(--primary); border-bottom: 2px solid var(--accent); display: inline-block; padding-bottom: 5px; font-size: 1.3rem; }

/* Elements */
.vocab-table { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 0.9rem; }
.vocab-table th, .vocab-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
.phonetic { font-style: italic; color: #666; font-size: 0.85rem; }

/* Modular Content Boxes */
.grammar-box { background: rgba(0,0,0,0.02); border-left: 4px solid var(--primary); padding: 15px; margin: 15px 0; border-radius: 0 4px 4px 0; }
.grammar-box h4 { margin: 0 0 10px 0; color: var(--primary); font-size: 0.9rem; text-transform: uppercase; }

.rule-translation { font-weight: 500; margin-bottom: 8px; }
.rule-original { font-style: italic; color: #555; font-size: 0.95rem; margin-bottom: 15px; padding-left: 10px; border-left: 2px solid var(--border); }

.comparison-box { background: rgba(0,0,0,0.02); border-left: 4px solid var(--accent); padding: 15px; margin: 15px 0; border-radius: 0 4px 4px 0; font-size: 0.95rem; }
.comparison-box h4 { margin: 0 0 10px 0; color: var(--accent); font-size: 0.9rem; text-transform: uppercase; }

/* Test Components */
.test-question { margin-bottom: 20px; }
.options { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.option { padding: 12px 15px; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; font-size: 1rem; }
.option:hover { background: rgba(0,0,0,0.03); border-color: var(--primary); }
.option.selected { background: var(--primary); color: white; border-color: var(--primary); }
.option.correct { background: var(--success); color: white; }
.option.incorrect { background: var(--accent); color: white; }
button.primary-btn { background: var(--primary); color: white; border: none; padding: 12px 20px; border-radius: 4px; cursor: pointer; font-size: 1rem; font-weight: bold; width: 100%; }
.result-box { margin-top: 20px; padding: 15px; border-radius: 4px; display: none; font-weight: bold; text-align: center; }

/* Toggle */
.toggle-switch { position: relative; width: 50px; height: 26px; display: inline-block; }
.toggle-switch input {
    opacity: 0; width: 0; height: 0;
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; cursor: pointer; z-index: 10;
}
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 26px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(24px); }
