:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --accent: #06b6d4;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --sidebar-width: 320px;
    --header-height: 70px;
}

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    direction: rtl;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.nav-container {
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
}

.nav-menu a:hover {
    color: var(--primary);
}

.hamburger, .sidebar-toggle, .close-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-main);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    color: white;
    padding: calc(var(--header-height) + 4rem) 2rem 5rem 2rem;
    text-align: center;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    font-family: serif;
}

.hero-desc {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.btn-primary {
    background-color: white;
    color: var(--primary);
    padding: 0.85rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transition: transform 0.2s, background-color 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    background-color: #f1f5f9;
}

/* Main Container & Grid */
.container {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 700;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.level-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.level-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px -3px rgba(0,0,0,0.1);
}

.level-badge {
    display: inline-block;
    background: #e0e7ff;
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.level-card h3 {
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
}

.level-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.card-btn {
    align-self: flex-start;
    background: var(--primary);
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.card-btn:hover {
    background: var(--primary-dark);
}

/* Platform Layout (level.html) */
.level-page-body {
    overflow: hidden;
}

.platform-layout {
    display: flex;
    margin-top: var(--header-height);
    height: calc(100vh - var(--header-height));
}

.level-indicator {
    background: #eef2ff;
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
}

.home-link {
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Sidebar */
.lesson-sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 90;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 1.1rem;
}

.sidebar-search {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-search input {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    font-size: 0.9rem;
    background: var(--bg-color);
}

.sidebar-progress-container {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
}

.progress-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    width: 0%;
    transition: width 0.3s ease;
}

.sidebar-nav-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Accordion Lessons */
.lesson-group {
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.lesson-group-header {
    background: #f8fafc;
    padding: 0.85rem 1rem;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lesson-group-header i {
    transition: transform 0.3s;
}

.lesson-group.active .lesson-group-header i {
    transform: rotate(180deg);
}

.lesson-group-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: white;
}

.lesson-group.active .lesson-group-body {
    max-height: 500px;
}

.session-item {
    padding: 0.7rem 1.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.session-item:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.session-item.active {
    background: #eef2ff;
    color: var(--primary);
    font-weight: 700;
    border-right: 4px solid var(--primary);
}

.session-item.completed i.fa-check-circle {
    color: var(--success);
}

/* Lesson Content Area */
.lesson-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem;
    background: var(--bg-color);
}

.content-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.content-card h1 {
    font-size: 2rem;
    margin-bottom: 1.25rem;
    color: var(--text-main);
}

.content-card p {
    font-size: 1.05rem;
    margin-bottom: 1.25rem;
    color: var(--text-muted);
}

/* Audio & Pronunciation Cards */
.audio-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin: 1rem 0;
}

.french-word {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    font-family: serif;
    direction: ltr;
    text-align: left;
}

.arabic-translation {
    font-size: 1rem;
    color: var(--text-muted);
}

.btn-audio {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.2s;
}

.btn-audio:hover {
    background: var(--primary-dark);
}

/* Interactive Exercises */
.exercise-box {
    margin-top: 2rem;
    padding: 1.5rem;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #fafafa;
}

.exercise-box h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--primary);
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.option-btn {
    padding: 0.85rem 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    transition: all 0.2s;
}

.option-btn:hover {
    border-color: var(--primary);
    background: #eef2ff;
}

.option-btn.correct {
    background: #d1fae5;
    border-color: var(--success);
    color: #065f46;
}

.option-btn.incorrect {
    background: #fee2e2;
    border-color: var(--danger);
    color: #991b1b;
}

.feedback-msg {
    margin-top: 1rem;
    font-weight: 700;
    padding: 0.75rem;
    border-radius: 6px;
    display: none;
}

.feedback-msg.success {
    background: #d1fae5;
    color: #065f46;
    display: block;
}

.feedback-msg.error {
    background: #fee2e2;
    color: #991b1b;
    display: block;
}

/* Navigation Buttons Bottom */
.lesson-nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-nav {
    padding: 0.75rem 1.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-nav:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 80;
}

/* Responsive */
@media (max-width: 900px) {
    .nav-menu {
        display: none;
    }

    .hamburger, .sidebar-toggle {
        display: block;
    }

    .lesson-sidebar {
        position: fixed;
        right: -100%;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        transition: right 0.3s ease;
    }

    .lesson-sidebar.open {
        right: 0;
    }

    .close-sidebar {
        display: block;
    }

    .sidebar-backdrop.active {
        display: block;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }
}

