/* ============================================
   DESIGN SYSTEM - PREMIUM & VIBRANT
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;700;900&display=swap');

:root {
    /* Core Palette - Deep Space & Neon */
    --bg-app: #0f172a;
    --bg-panel: #1e293b;
    --bg-card: #1e293b;
    /* Fallback */
    --bg-card-glass: rgba(30, 41, 59, 0.7);
    --bg-hover: #334155;

    /* Brand Colors */
    --primary: #6366f1;
    --primary-rgb: 99, 102, 241;
    --primary-bright: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);

    --secondary: #ec4899;
    --secondary-gradient: linear-gradient(135deg, #ec4899 0%, #d946ef 100%);

    --accent: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);

    /* Functional Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.1);
    --border-highlight: rgba(148, 163, 184, 0.2);

    /* Dimensions & Spacing */
    --header-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1.25rem;
    --spacing-lg: 2rem;

    /* Effects */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
    --glass-blur: blur(12px);
    --nav-width: 280px;
}

/* Light Mode Override */
body.light-mode {
    --bg-app: #f1f5f9;
    --bg-panel: #ffffff;
    --bg-card-glass: rgba(255, 255, 255, 0.8);
    --bg-hover: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: rgba(148, 163, 184, 0.2);
    --shadow-glow: 0 4px 20px rgba(99, 102, 241, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Heebo', sans-serif;
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* App-like feel */
}

/* ============================================
   LAYOUT & HEADER
   ============================================ */
.app-header {
    height: var(--header-height);
    background: var(--bg-card-glass);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-lg);
    z-index: 50;
    flex-shrink: 0;
    position: relative;
}

.header-content {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    position: relative;
    /* Context */
}

.logo-icon {
    font-size: 1.8rem;
    -webkit-text-fill-color: initial;
    /* Emoji color fix */
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.nav-btn .icon {
    font-size: 1.4rem;
    line-height: 1;
}

.mobile-menu-btn {
    display: none;
}

.header-nav {
    display: flex;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.3);
    padding: 0.3rem;
    border-radius: 100px;
    border: 1px solid var(--border);
}

.mobile-nav-header {
    display: none; /* Only show on mobile */
}

body.light-mode .header-nav {
    background: rgba(255, 255, 255, 0.5);
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem 1.2rem;
    border-radius: 100px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn .icon {
    font-size: 1.1rem;
    opacity: 0.7;
}

.nav-btn:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.nav-btn.active {
    background: var(--bg-panel);
    color: var(--primary-bright);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

body.light-mode .nav-btn.active {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ============================================
   MAIN AREA
   ============================================ */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
    background: radial-gradient(circle at top left, rgba(99, 102, 241, 0.08), transparent 40%),
        radial-gradient(circle at bottom right, rgba(236, 72, 153, 0.08), transparent 40%);
}

.view {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 4rem;
    animation: fadeUp 0.4s ease-out;
}

.view.active {
    display: block;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.view-header h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -1px;
}

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
    border-color: var(--primary-bright);
}

.dashboard-stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.2rem;
}

.stat-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ============================================
   SECTIONS & CARDS
   ============================================ */
.content-section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::before {
    content: '';
    display: block;
    width: 6px;
    height: 24px;
    background: var(--primary-gradient);
    border-radius: 4px;
}

.exams-grid,
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border);
}

.empty-icon {
    font-size: 3rem;
    opacity: 0.5;
    display: block;
    margin-bottom: 1rem;
}

/* Course & Exam Card Styling */
.course-card,
.exam-card {
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.course-card:hover,
.exam-card:hover {
    border-color: var(--border-highlight);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(-4px);
}

.exam-card::before,
.course-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--course-color, var(--primary));
}

.course-card h3,
.exam-card h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

/* course-card-header: course name on right, badges on left */
.course-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

/* Course code badge — top-left corner, click to copy */
.course-code-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0 0.6rem;
    height: 26px;
    box-sizing: border-box;
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.07);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.course-code-badge:hover {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-bright);
    border-color: rgba(99, 102, 241, 0.4);
}

.course-code-badge.copied {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.4);
}

.course-code-badge.copied::after {
    content: ' ✓';
}

.course-code-hash {
    opacity: 0.5;
    font-weight: 700;
}

/* exam-card-header: course name on right, code badge on left */
.exam-card .exam-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}



/* ── Course card countdown badge ──────────────────────────────────── */
.cc-countdown {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0.6rem 0 0;
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    transition: all 0.2s ease;
}

.cc-countdown-main {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}

.cc-date {
    font-size: 0.82rem;
    font-weight: 700;
    margin-right: 0.8rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    color: var(--primary-bright);
}

.course-card:hover .cc-date {
    opacity: 1;
    pointer-events: auto;
}

.cc-countdown.moad-b .cc-date {
    color: var(--warning);
}

.cc-countdown.assignment .cc-date {
    color: var(--info, #4facfe);
}

.cc-countdown.moad-b {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
}

.cc-countdown.assignment {
    background: rgba(79, 172, 254, 0.1);
    border-color: rgba(79, 172, 254, 0.3);
}

.cc-days {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary-bright);
    line-height: 1;
}

.cc-countdown.moad-b .cc-days {
    color: var(--warning);
}

.cc-countdown.assignment .cc-days {
    color: var(--info, #4facfe);
}

.cc-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 0.1rem;
}

.cc-type {
    margin-right: auto;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-bright);
}

.cc-badge-moad-b {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.cc-badge-assignment {
    background: rgba(79, 172, 254, 0.15);
    color: var(--info, #4facfe);
}

.cc-grade-banner {
    margin: 0.6rem 0 0;
    padding: 0.5rem 0.9rem;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    color: var(--success);
}

/* Graded course cards go slightly dimmer */
.course-card.graded {
    opacity: 0.75;
}

.course-card.graded:hover {
    opacity: 1;
}


.course-meta,
.exam-info {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.progress-bar-container {
    height: 10px;
    /* Slightly thicker */
    background: rgba(255, 255, 255, 0.05);
    /* Light background */
    border-radius: 10px;
    margin: 1rem 0 0.5rem;
    overflow: hidden;
    width: 100%;
}

.progress-bar {
    width: 100%;
    height: 100%;
}

.progress-fill {
    height: 100%;
    background: var(--course-color, var(--success));
    border-radius: 10px;
    transition: width 1s ease;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    margin-top: 0.5rem;
}

.status-badge.on-track {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.status-badge.behind {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.status-badge.critical {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.status-badge.waiting-grade {
    background: rgba(251, 191, 36, 0.18);
    color: #f59e0b;
    font-weight: 700;
    animation: pulse-badge 1.8s ease-in-out infinite;
}

@keyframes pulse-badge {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.65;
    }
}


/* ============================================
   TASKS LIST
   ============================================ */
.general-task-card,
.task-preview-item {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all 0.2s;
}

.general-task-card:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.task-checkbox-wrapper {
    display: flex;
    width: 100%;
    align-items: flex-start;
    gap: 1rem;
}

.task-checkbox-large,
.task-preview-check {
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-muted);
    border-radius: 8px;
    /* Softer shape */
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-top: 2px;
}

.task-checkbox-large:hover,
.task-preview-check:hover {
    border-color: var(--primary);
}

.task-checkbox-large.completed,
.task-preview-check.completed {
    background: var(--success);
    border-color: var(--success);
}

.task-checkbox-large.completed::after,
.task-preview-check.completed::after {
    content: '✓';
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
}

.task-card-title,
.task-preview-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    transition: color 0.2s;
}

.completed .task-card-title,
.completed .task-preview-title {
    color: var(--text-muted);
    text-decoration: line-through;
}

.task-card-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.task-action-btn-small {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.general-task-card:hover .task-action-btn-small {
    opacity: 1;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

/* ============================================
   FORMS & INPUTS
   ============================================ */
.input-field {
    width: 100%;
    background: var(--bg-app);
    border: 2px solid var(--border);
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 1rem;
    transition: border-color 0.2s;
    margin-bottom: 1rem;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* ============================================
   MODALS
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    padding: 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

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

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.close-modal-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-modal-btn:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg);
}

/* Updated Notification Badge Style for Timeline */
/* Updated Notification Badge Style for Timeline */
.days-badge.notification-style {
    position: absolute;
    top: -14px;
    right: 1.5rem;
    left: auto;
    background: var(--course-color, #ef4444);
    color: white;
    border-radius: var(--radius-md);
    padding: 0.3rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
    border: 2px solid var(--bg-panel);
    z-index: 10;
    line-height: 1;
}

.days-badge.notification-style::before {
    display: none;
}

/* Timeline Meta - Hidden by default, shown on hover */
.timeline-course-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 0.5rem;
    opacity: 0;
    /* Hidden by default */
    transform: translateY(10px);
    transition: all 0.3s ease;
    height: 0;
    /* Collapse space */
    overflow: hidden;
}

.timeline-course:hover .timeline-course-meta {
    opacity: 0.8;
    transform: translateY(0);
    height: auto;
    /* Expand */
    margin-bottom: 1rem;
}

/* Timeline Progress Bar - Make it taller/more visible */
.timeline-progress-bar {
    height: 16px;
    /* Taller */
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
}

.timeline-expected-marker {
    /* Hide marker as requested: "not seeing the marker on the graph" implied removing it or fixing it? 
       User said: "don't see the marker ... that is the target" -> implying they WANT to see it or they DON'T mimic the request? 
       "ugam lo roim et ha-saman" -> "Also don't see the marker". 
       So I need to make sure it IS visible.
    */
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 4px;
    /* Thicker */
    background: white;
    /* clearer color? or keep warning */
    background: var(--text-main);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    z-index: 5;
    border-radius: 2px;
}

/* Timeline status badge position update */
.timeline-status-container {
    margin-bottom: 0.5rem;
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* ============================================
   GRADE COMPOSITION (DYNAMIC)
   ============================================ */
.grade-composition-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    margin-top: 0.5rem;
}

.grade-optional {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

#dynamic-grade-components-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.grade-component-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    position: relative;
}

.grade-component-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.grade-component-inputs {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.grade-component-inputs input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.5rem;
    color: var(--text-main);
    font-size: 0.9rem;
}

.grade-component-inputs input:focus {
    border-color: var(--primary);
    outline: none;
}

.grade-input-group {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.grade-input-group span {
    padding: 0.3rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 0.85rem;
    border-left: 1px solid var(--border);
    /* RTL layout */
}

.grade-input-group input {
    border: none;
    background: transparent;
    width: 50px;
    text-align: center;
    padding: 0.3rem;
}

.grade-component-remove {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

.grade-component-remove:hover {
    opacity: 1;
    transform: scale(1.1);
}

.grade-components-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.grade-total-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.grade-total-value {
    font-weight: 700;
    font-size: 1.05rem;
    min-width: 3rem;
    text-align: left;
}

.grade-total-value.ok {
    color: var(--success);
}

.grade-total-value.over {
    color: var(--danger);
}

.grade-total-value.under {
    color: var(--text-muted);
}

.grade-total-track {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 100px;
    overflow: hidden;
}

.grade-total-fill {
    height: 100%;
    border-radius: 100px;
    transition: width 0.3s ease, background 0.3s;
    background: var(--text-muted);
}

.grade-total-fill.ok {
    background: var(--success);
}

.grade-total-fill.over {
    background: var(--danger);
}

/* Assignment deadline chips in timeline */
.timeline-deadline-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.7rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid;
    margin-top: 0.3rem;
    margin-left: 0.4rem;
}

.timeline-deadline-chip.upcoming {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--primary-bright);
}

.timeline-deadline-chip.overdue {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: var(--danger);
}

.timeline-deadline-chip.soon {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
    color: var(--warning);
}

.timeline-deadline-chip.future {
    background: rgba(156, 163, 175, 0.1);
    border-color: rgba(156, 163, 175, 0.25);
    color: var(--text-muted);
}

.timeline-deadlines-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.days-badge.notification-style {
    flex-direction: row;
    gap: 0.4rem;
}

.days-badge .days-num {
    font-size: 1.05rem;
    font-weight: 800;
}

.days-badge .days-label {
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 0.9;
}

/* Event countdown banner on dashboard cards */
.event-countdown {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.5rem 0 0.25rem;
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.event-countdown.exam {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: var(--primary-bright);
}

.event-countdown.assignment {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: var(--warning);
}

.event-countdown .event-name {
    font-weight: 700;
}

.event-countdown .event-date {
    opacity: 0.75;
    font-size: 0.8rem;
}

/* מועד ב׳ amber variant */
.event-countdown.moad-b-event {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--warning);
}

.moad-b-tag {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 100px;
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    font-size: 0.8rem;
    font-weight: 800;
    margin-right: 0.2rem;
}


/* Grade component chips on course cards */
.grade-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.5rem 0;
}

.grade-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* Exam dates group (מועד א / מועד ב) in course modal */
.exam-dates-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.exam-date-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.skip-moad-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--warning);
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.07);
}

/* Grade prompt panel at bottom of timeline course card */
.grade-prompt-panel {
    margin-top: 1.5rem;
    border-top: 2px solid rgba(99, 102, 241, 0.25);
    padding-top: 1rem;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    background: linear-gradient(to bottom, rgba(99, 102, 241, 0.04), rgba(99, 102, 241, 0.08));
}

.grade-prompt-header {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-bright);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.grade-prompt-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.grade-prompt-row:last-of-type {
    border-bottom: none;
}

.grade-prompt-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.grade-prompt-name {
    flex: 1;
    font-size: 0.88rem;
    color: var(--text-main);
    min-width: 120px;
}

.grade-prompt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.grade-calc {
    font-size: 1rem;
    color: var(--text-main);
}

.grade-calc strong {
    color: var(--success);
    font-size: 1.2rem;
}

.grade-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Small icon button (edit pencil, etc.) ────────────────────────────── */
.btn-icon-sm {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    padding: 0.2rem 0.45rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.btn-icon-sm:hover {
    background: var(--primary);
    color: white;
    border-color: transparent;
}

/* ── Completed courses section (timeline bottom) ──────────────────────── */
.completed-courses-section {
    margin-top: 2.5rem;
    border-top: 2px dashed rgba(255, 255, 255, 0.12);
    padding-top: 1.5rem;
}

.completed-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.completed-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.completed-course-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    position: relative;
    overflow: hidden;
    border-top: 3px solid var(--course-color, var(--primary));
}

.completed-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.completed-color-bar {
    width: 4px;
    height: 36px;
    border-radius: 4px;
    flex-shrink: 0;
}

.completed-card-info {
    flex: 1;
}

.completed-card-info h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 0.1rem;
}

.completed-components {
    margin-bottom: 0.75rem;
}

.moodle-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0 0.6rem;
    height: 26px;
    box-sizing: border-box;
    background: rgba(245, 166, 35, 0.15);
    /* orange/moodle tint */
    color: #c97d00;
    border: 1px solid rgba(245, 166, 35, 0.3);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    z-index: 2;
    /* keep clickable */
}

.moodle-link-btn:hover {
    background: rgba(245, 166, 35, 0.25);
    color: #a86800;
}

.moodle-link-btn.sm {
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
    border: none;
    background: rgba(245, 166, 35, 0.1);
}

.moodle-link-btn.sm:hover {
    background: rgba(245, 166, 35, 0.2);
}

.completed-grade-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.completed-grade-row:last-child {
    border-bottom: none;
}

.cg-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.cg-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-main);
    min-width: 80px;
}

.cg-pct {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.cg-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.completed-final-grade {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.cg-final {
    font-size: 1.15rem;
    font-weight: 800;
}

.cg-final.calculated {
    color: var(--primary-bright);
}

.cg-final.locked {
    color: var(--success);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Filter Buttons as Tabs */
.filter-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    /* Pill shape if preferred, or md */
    transition: all 0.2s;
    flex: 1;
    /* Stretch on mobile, or auto */
    text-align: center;
}

.filter-btn:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

/* Timeline specific updates */
.timeline-container {
    background: var(--bg-card-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
    box-shadow: 0 0 50px -20px var(--primary-glow);
}

.timeline-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    background: var(--bg-panel);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

/* ── Timeline view toggle ──────────────────────────────────────── */
.timeline-view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: var(--bg-panel);
    padding: 0.4rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    width: fit-content;
}

.timeline-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.4rem;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeline-toggle-btn:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.timeline-toggle-btn.active {
    background: var(--primary-gradient);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}

/* ── Monthly Calendar ──────────────────────────────────────────── */
.calendar-view-container {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.cal-grid {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.cal-month {
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}

.cal-month-title {
    background: var(--primary-gradient);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.9rem 1.5rem;
    letter-spacing: 0.5px;
}

/* Unified grid: day names + day cells in ONE grid = guaranteed alignment */
.cal-unified-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

/* Day name header cells (first 7 items in the grid) */
.cal-day-name {
    padding: 0.4rem 0.2rem;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    background: var(--bg-hover);
    border-bottom: 2px solid var(--border);
    border-right: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* In RTL grid: item 1 = rightmost (א'), item 7 = leftmost (ש').
   Header items 1-7: remove border-right from item 1 (rightmost, nth-child 1). */
.cal-day-name:first-child {
    border-right: none;
}

.cal-day {
    min-height: 80px;
    padding: 0.4rem;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    position: relative;
    box-sizing: border-box;
    transition: background 0.15s;
}

/* In the unified grid, the day-name row is items 1-7.
   The next "first column" items start at 8, then 15, 22...
   Use nth-child(7n+8) for day cells that are in the rightmost column (א'),
   and (7n+1) for all first-children that happen to be day-names or days */
.cal-unified-grid>*:nth-child(7n+1) {
    border-right: none;
}

.cal-day.empty {
    background: rgba(0, 0, 0, 0.015);
}

.cal-day.past {
    opacity: 0.4;
}

/* Today: use inset box-shadow so it doesn't affect layout or row height */
.cal-day.today {
    background: rgba(99, 102, 241, 0.075);
    box-shadow: inset 0 0 0 2px var(--primary);
}

.cal-day.today .cal-day-num {
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.cal-day.has-events {
    background: rgba(99, 102, 241, 0.04);
}

.cal-day-num {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 0.2rem;
}

.cal-event-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cal-events-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
}

.cal-event-tag {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--bg-hover);
    font-size: 0.68rem;
    line-height: 1.3;
    overflow: hidden;
}

.cal-event-tag-text {
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
}

.cal-event-tag-label {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
}

/* ── New calendar layout with legend ──────────── */
.cal-layout {
    display: flex;
    gap: 1.5rem;
}

.cal-months-col {
    flex: 1;
    min-width: 0;
}

/* Legend panel */
.cal-legend {
    width: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 100px;
    z-index: 10;
    margin-top: 0;
}

.cal-legend-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.7rem;
    font-size: 0.82rem;
    color: var(--text-main);
}

.cal-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}

.cal-legend-info {
    min-width: 0;
}

.cal-legend-name {
    font-weight: 600;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.cal-legend-types {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 2px;
}

.cal-legend-type {
    font-size: 0.7rem;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 500;
}

.cal-legend-type.exam {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-bright);
}

.cal-legend-type.assign {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent);
}

.cal-legend-divider {
    border-top: 1px solid var(--border);
    margin: 0.75rem 0;
}

.cal-type-indicator {
    font-size: 1rem;
}

/* Day cell improvements */
.cal-day.today {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.cal-day-num.today-num {
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
}

.cal-day-num-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 6px;
    padding: 0 2px;
}

.cal-holiday-tag {
    font-size: 0.72rem;
    background: rgba(255, 77, 77, 0.12);
    color: #ff4d4d;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
}

.holidays-settings-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.holiday-settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.holiday-settings-info {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.holiday-settings-date {
    font-family: monospace;
    color: var(--primary-bright);
    font-weight: 600;
}

.holiday-settings-name {
    font-weight: 500;
}

.holiday-delete-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.2rem;
    transition: transform 0.2s;
}

.holiday-delete-btn:hover {
    transform: scale(1.2);
}

/* Event pill inside a day cell */
.cal-event-pill {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 5px 2px 4px;
    border-radius: 4px;
    margin-bottom: 2px;
    overflow: hidden;
    font-size: 0.67rem;
    line-height: 1.35;
}

.cal-ev-icon {
    font-size: 0.75rem;
    flex-shrink: 0;
}

.cal-ev-course {
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.cal-ev-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}


.semester-info {
    padding: 0.6rem 1.2rem;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.semester-info:nth-child(2) {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.timeline-course {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    /* Increased margin to account for badge sticking out */
    transition: all 0.3s ease;
    position: relative;
    border-left: 4px solid var(--course-color, var(--primary));
    overflow: visible;
    /* Allow badge to stick out */
    z-index: 1;
}

.timeline-course:hover {
    transform: translateY(-2px);
    border-color: var(--border-highlight);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 5;
    /* Bring to front on hover */
}

/* Badge Styling */
.days-badge {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    /* Top Left corner */
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    padding: 0.2rem 0.8rem;
    border-radius: 100px;
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    backdrop-filter: blur(4px);
}

.days-badge::before {
    content: '⏳';
    font-size: 0.8rem;
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.timeline-course-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-left: 4rem;
    /* Space for the badge */
}

.timeline-course-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0;
}

/* Meta Chips */
.timeline-course-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 0.5rem;
    opacity: 0.8;
}

.meta-chip {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.3rem 0.8rem;
    border-radius: 100px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Timeline Progress Bar */
.timeline-progress-wrapper {
    margin-top: 1.5rem;
    position: relative;
    padding: 10px 0;
}

.timeline-progress-bar {
    height: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    position: relative;
    border: 1px solid var(--border);
}

.timeline-progress-fill {
    height: 100%;
    background: var(--course-color, var(--primary));
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transform-origin: left center;
    transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.timeline-expected-marker {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: calc(100% + 7px);
    width: 4px;
    background: var(--warning);
    box-shadow: 0 0 12px var(--warning);
    z-index: 5;
    border-radius: 2px;
}

/* Hover Hint */
.timeline-hover-hint {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.5;
    transition: opacity 0.3s;
}

.timeline-course:hover .timeline-hover-hint {
    opacity: 1;
}

/* Lessons Grid in Timeline - Hover Reveal */
.timeline-lessons-container {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, opacity 0.3s ease-in-out, margin-top 0.3s;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
}

body.light-mode .timeline-lessons-container {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.04);
}

.timeline-course:hover .timeline-lessons-container,
.timeline-course:focus-within .timeline-lessons-container {
    max-height: 800px;
    /* Allow more lessons */
    opacity: 1;
    margin-top: 1.5rem;
    padding: 1.2rem;
    border-color: var(--border);
}

.timeline-lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.timeline-lesson {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.9rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

body.light-mode .timeline-lesson {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.timeline-lesson:hover {
    border-color: var(--course-color, var(--primary));
    transform: translateY(-2px);
    background: var(--bg-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.timeline-lesson.completed {
    opacity: 0.9 !important;
    /* Made more visible than before */
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}

.lesson-link-btn {
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.4rem;
    border-radius: 6px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
}

.lesson-link-btn.inactive {
    display: none;
}

.lesson-link-btn.active {
    opacity: 0.5;
    color: var(--primary);
    border-color: var(--primary-glow);
}

.timeline-lesson:hover .lesson-link-btn.active {
    opacity: 1;
    background: var(--primary);
    color: white;
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

/* Removed inactive hover as it's now hidden */

.timeline-lesson-check {
    width: 22px;
    height: 22px;
    border: 2px solid var(--text-muted);
    border-radius: 6px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.timeline-lesson.completed .timeline-lesson-check {
    background: var(--success);
    border-color: var(--success);
    position: relative;
}

.timeline-lesson.completed .timeline-lesson-check::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.timeline-lesson-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-lesson-week {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================
   SCHEDULE
   ============================================ */
/* ============================================
   SCHEDULE
   ============================================ */
.schedule-container {
    overflow-x: auto;
    padding-bottom: 1.5rem;
}

#weekly-schedule {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1rem;
    width: 100%;
}

.day-column {
    background: var(--bg-card-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    min-height: 450px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: border-color 0.3s;
}

.day-column:hover {
    border-color: var(--primary);
}

.day-header {
    text-align: center;
    padding: 1rem 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
}

.day-name {
    font-weight: 800;
    color: var(--text-main);
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.day-date {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary-bright);
    background: rgba(99, 102, 241, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    display: inline-block;
}

.day-holiday {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #ff4d4d;
    background: rgba(255, 77, 77, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    display: inline-block;
}

.holiday-indicator {
    color: #ff4d4d;
}

.day-column.is-today {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

.day-column.is-today .day-name {
    color: var(--primary-bright);
}

.today-badge {
    background: var(--primary-gradient);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.schedule-item {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-right: 4px solid var(--course-color, var(--primary));
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.schedule-item[draggable="true"] {
    cursor: grab;
}

.schedule-item[draggable="true"]:active {
    cursor: grabbing;
}

.nav-arrow-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Draggable visual cues */
.day-column.droppable {
    background: rgba(99, 102, 241, 0.05);
    border-color: var(--primary);
    border-style: dashed;
}

.schedule-item:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
    border-color: var(--border-highlight);
}

.schedule-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.03));
    opacity: 0;
    transition: opacity 0.2s;
}

.schedule-item:hover::before {
    opacity: 1;
}

.schedule-item-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

.schedule-item-time {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.schedule-item-time::before {
    content: '📚';
    font-size: 0.8rem;
}


/* ============================================
   LESSONS LIST (Within Course)
   ============================================ */
.lessons-section {
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    padding-top: 2rem;
}

/* Grade components section inside course detail modal */
.detail-grade-section {
    margin: 1.25rem 0;
    padding: 1rem 1.25rem;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: var(--radius-md);
}

.detail-grade-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-bright);
    margin-bottom: 0.75rem;
}

.detail-grade-table {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.detail-grade-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.detail-grade-row:last-child {
    border-bottom: none;
}

.detail-pct {
    color: var(--text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

.detail-date {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.detail-moad-b {
    display: inline-block;
    margin-right: 0.5rem;
    padding: 0.1rem 0.4rem;
    border-radius: 100px;
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    font-size: 0.75rem;
}

/* Skip Moad B checkbox */
.skip-moad-b-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-right: 0.5rem;
    padding: 0.2rem 0.55rem;
    border-radius: 100px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--danger, #ef4444);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    user-select: none;
}

.skip-moad-b-label:hover {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.4);
}

.skip-moad-b-label input[type="checkbox"] {
    accent-color: #ef4444;
    width: 13px;
    height: 13px;
    cursor: pointer;
}

.skip-moad-b-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-right: 0.5rem;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    font-size: 0.75rem;
    font-weight: 600;
}

.detail-grade-val {
    min-width: 40px;
    text-align: left;
}

.detail-weighted {
    margin-top: 0.6rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding-top: 0.4rem;
    border-top: 1px solid var(--border);
}

.detail-final-grade {
    margin-top: 0.4rem;
    font-size: 0.95rem;
    color: var(--success);
    font-weight: 600;
}

/* Assignments in General Tasks List */
.general-task-card.assignment-task {
    border-right-width: 4px;
    border-right-style: solid;
    border-right-color: var(--course-color, var(--primary));
    background: rgba(var(--primary-rgb), 0.03);
}

.assignment-tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-bright);
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 800;
    margin-left: 0.4rem;
    vertical-align: middle;
}

.task-checkbox-large.disabled {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--border) !important;
    cursor: default !important;
}

.view-timeline-btn {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-bright);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.view-timeline-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.sync-apple-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1.2rem;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-bright);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sync-apple-btn:hover {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.3);
}

.sync-apple-btn:active {
    transform: translateY(0) scale(0.98);
}

.sync-apple-btn .icon {
    font-size: 1.1rem;
}

.sync-apple-btn.header-sync {
    padding: 0.5rem;
    width: 38px;
    height: 38px;
    justify-content: center;
    border-radius: 10px;
}

.sync-apple-btn.header-sync .icon {
    margin: 0;
}

.sync-apple-btn.compact {
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    color: var(--primary-bright);
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.cal-sidebar {
    display: flex;
    flex-direction: column;
    width: 280px;
    flex-shrink: 0;
}

.icon-svg {
    flex-shrink: 0;
    transition: transform 0.5s ease;
}

.sync-apple-btn:hover .icon-svg {
    transform: rotate(180deg);
}

/* Lesson Details Modal Styles */
.lesson-detail-info {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-card-glass);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.moodle-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f98012 0%, #ff9d45 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-right: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(249, 128, 18, 0.25);
}

.moodle-badge:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(249, 128, 18, 0.4);
    filter: brightness(1.1);
}

.detail-value.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1.2rem;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-bright);
    text-decoration: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
    margin-top: 0.25rem;
}

.detail-value.link-btn:hover {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.detail-label {
    font-weight: 700;
    color: var(--text-muted);
    min-width: 90px;
    font-size: 0.9rem;
}

.detail-value {
    color: var(--text-main);
    font-weight: 600;
    font-size: 1.05rem;
}

.detail-notes {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    margin-top: 0.75rem;
    white-space: pre-wrap;
    color: var(--text-main);
    border: 1px solid var(--border);
    line-height: 1.6;
    font-size: 0.95rem;
    min-height: 80px;
}

.view-tasks-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.view-task-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    background: var(--bg-card-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.view-task-item.completed {
    opacity: 0.6;
}

.view-task-item.completed span {
    text-decoration: line-through;
}

.view-task-check {
    color: var(--success);
    font-weight: bold;
}

.lessons-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.lesson-item {
    background: var(--bg-card-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.2s ease;
}

.lesson-item:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    transform: translateX(4px);
}

.lesson-checkbox {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.lesson-checkbox.completed {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.lesson-checkbox.completed::after {
    content: '✓';
    font-weight: bold;
    font-size: 14px;
}

.lesson-checkbox input {
    display: none;
}

.lesson-content {
    flex: 1;
    min-width: 0;
    /* Text truncation fix */
}

.lesson-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.lesson-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-main);
}

.lesson-name.completed {
    text-decoration: line-through;
    color: var(--text-muted);
}

.lesson-week {
    font-size: 0.8rem;
    color: var(--primary-bright);
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.lesson-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.lesson-link {
    color: var(--accent);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.lesson-link:hover {
    text-decoration: underline;
}

.lesson-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.lesson-item:hover .lesson-actions {
    opacity: 1;
}

.lesson-action-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.lesson-action-btn:hover {
    background: var(--bg-panel);
    color: var(--text-main);
    border-color: var(--text-muted);
}

/* ============================================
   SETTINGS & MISC
   ============================================ */
.settings-container {
    max-width: 800px;
    margin: 0 auto;
}

.settings-section {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
}

.settings-section h3 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.setting-item {
    margin-bottom: 1.5rem;
}

.setting-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.checkbox-item label {
    margin-bottom: 0;
    cursor: pointer;
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.color-picker input[type="radio"] {
    display: none;
}

.color-picker label {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.color-picker input[type="radio"]:checked+label {
    transform: scale(1.2);
    border-color: white;
    box-shadow: 0 0 15px currentColor;
}

/* Days Selector */
.days-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.day-checkbox {
    position: relative;
    cursor: pointer;
}

.day-checkbox input {
    position: absolute;
    opacity: 0;
}

.day-checkbox span {
    display: flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-weight: 600;
    transition: all 0.2s;
}

.day-checkbox input:checked+span {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    opacity: 1;
    transform: scale(1.05);
    transition: all 0.2s;
}

.lesson-item:hover .lesson-actions {
    opacity: 1;
}

.lesson-action-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.lesson-action-btn:hover {
    background: var(--bg-panel);
    color: var(--text-main);
    border-color: var(--text-muted);
}

/* ============================================
   SETTINGS & MISC
   ============================================ */
.settings-container {
    max-width: 800px;
    margin: 0 auto;
}

.settings-section {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
}

.settings-section h3 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.setting-item {
    margin-bottom: 1.5rem;
}

.setting-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.checkbox-item label {
    margin-bottom: 0;
    cursor: pointer;
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.color-picker input[type="radio"] {
    display: none;
}

.color-picker label {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.color-picker input[type="radio"]:checked+label {
    transform: scale(1.2);
    border-color: white;
    box-shadow: 0 0 15px currentColor;
}

/* Days Selector */
.days-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.day-checkbox {
    position: relative;
    cursor: pointer;
}

.day-checkbox input {
    position: absolute;
    opacity: 0;
}

.day-checkbox span {
    display: flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-weight: 600;
    transition: all 0.2s;
}

.day-checkbox input:checked+span {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
}

/* Detail Meta Cards for Course Detail Modal */
.detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.detail-meta-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.detail-meta-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.detail-meta-icon {
    font-size: 2rem;
    opacity: 0.9;
}

.detail-meta-content {
    flex: 1;
}

.detail-meta-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.detail-meta-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.status-card-value {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    display: inline-block;
}

.status-card-value.on-track {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-card-value.behind {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.status-card-value.critical {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* General Tasks List */
.general-tasks-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.general-task-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    position: relative;
    transition: all 0.2s ease;
}

.general-task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.general-task-card.priority-high {
    border-right: 4px solid var(--danger);
    border-left: none;
}

.general-task-card.priority-medium {
    border-right: 4px solid var(--warning);
    border-left: none;
}

.general-task-card.priority-low {
    border-right: 4px solid var(--success);
    border-left: none;
}

.general-task-card.completed {
    opacity: 0.6;
    background: rgba(255, 255, 255, 0.02);
}

.general-task-card.completed .task-card-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-checkbox-large {
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-muted);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.task-checkbox-large::after {
    content: '✓';
    color: white;
    font-size: 14px;
    display: none;
}

.task-checkbox-large.completed {
    background: var(--primary);
    border-color: var(--primary);
}

.task-checkbox-large.completed::after {
    display: block;
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.task-card-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.task-card-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.general-task-card:hover .task-card-actions {
    opacity: 1;
}

.task-action-btn-small {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.task-action-btn-small:hover {
    opacity: 1;
}

.task-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.task-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.task-meta-item.overdue {
    color: var(--danger);
    font-weight: 500;
}

/* Schedule Navigation Controls */
.schedule-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.schedule-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.schedule-mode-toggle {
    display: flex;
    background: var(--bg-main);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.btn-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-toggle.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-hover);
    transform: scale(1.1);
}

.btn-text {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Calendar Grid (Monthly View) */
.calendar-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.calendar-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.calendar-week-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    min-height: 120px;
}

.calendar-day {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100px;
    transition: background 0.2s;
}

.calendar-day.today {
    background: rgba(99, 102, 241, 0.05);
    /* Primary color tint */
    border-color: var(--primary);
}

.calendar-day.other-month {
    opacity: 0.5;
    background: var(--bg-main);
}

.calendar-date-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-align: right;
}

.calendar-items {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
    max-height: 100px;
}

.calendar-item {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: grab;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.calendar-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calendar-item.lesson-item {
    border-right: 3px solid var(--course-color, var(--primary));
}

.calendar-item.task-item {
    border-right: 3px solid var(--text-white);
    background: rgba(255, 255, 255, 0.05);
}

.calendar-item.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.calendar-item-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--course-color, var(--primary));
    flex-shrink: 0;
}

/* Drag and Drop Visuals */
.calendar-item.dragging,
.schedule-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    cursor: grabbing;
}

.day-column.drag-over,
.calendar-day.drag-over {
    background: rgba(99, 102, 241, 0.1) !important;
    border: 2px dashed var(--primary) !important;
}

/* ============================================
   FLATPICKR OVERRIDES
   ============================================ */
.flatpickr-calendar {
    font-family: 'Rubik', sans-serif !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
    border-radius: var(--radius-lg) !important;
}

.flatpickr-months .flatpickr-month {
    background: var(--bg-panel) !important;
    color: var(--text-main) !important;
    fill: var(--text-main) !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    color: var(--text-main) !important;
    font-weight: 600 !important;
}

.flatpickr-weekdays {
    background: var(--bg-panel) !important;
    color: var(--text-muted) !important;
}

.flatpickr-weekday {
    color: var(--text-muted) !important;
    font-weight: 500 !important;
}

.flatpickr-day {
    color: var(--text-main) !important;
}

.flatpickr-day.today {
    border-color: var(--primary) !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

.flatpickr-day:hover,
.flatpickr-day.prevMonthDay:hover,
.flatpickr-day.nextMonthDay:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: transparent !important;
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    color: var(--text-muted) !important;
    background: transparent !important;
    opacity: 0.3 !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {
    color: inherit;
}

/* ============================================
   SEMESTER TOGGLE COMPONENT
   ============================================ */
.semester-toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Heebo', sans-serif;
    background: rgba(255, 255, 255, 0.1) !important;
    /* Force visible bg in dark mode */
    padding: 0.4rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.3s ease;

    /* Fix for being inside .logo */
    -webkit-background-clip: border-box;
    -webkit-text-fill-color: initial;
    background-clip: border-box;
    color: var(--text-main);
}

.semester-toggle-container:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: var(--primary-bright);
}

.toggle-group {
    position: relative;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.toggle-group:hover {
    background: rgba(255, 255, 255, 0.1);
}

.toggle-label {
    font-weight: 700;
    font-size: 1.1rem;
    color: #ffffff !important;
    /* Force white in dark mode */
    display: flex;
    align-items: center;
    gap: 0.3rem;
    /* text-shadow: 0 1px 2px rgba(0,0,0,0.3); Removed to fix blurriness */
}

/* Ensure text is visible in light mode */
body.light-mode .toggle-label {
    color: #0f172a !important;
    /* Force dark slate in light mode */
    text-shadow: none;
}

.toggle-label::after {
    content: '▼';
    font-size: 0.7rem;
    opacity: 0.7 !important;
    transition: transform 0.2s;
    color: inherit !important;
    /* Ensure arrow matches text */
}

.toggle-group:hover .toggle-label::after {
    transform: rotate(180deg);
    opacity: 1 !important;
}

.toggle-divider {
    color: rgba(255, 255, 255, 0.4) !important;
    font-size: 1.2rem;
    font-weight: 300;
}

/* Ensure divider is visible in light mode */
body.light-mode .toggle-divider {
    color: rgba(0, 0, 0, 0.3) !important;
}

.toggle-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    /* RTL support */
    margin-top: 0.5rem;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    min-width: 150px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.toggle-group:hover .toggle-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.toggle-option {
    padding: 0.8rem 1rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-option:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.toggle-option.active {
    color: var(--primary-bright);
    background: rgba(99, 102, 241, 0.1);
    font-weight: 700;
}

.toggle-option.active::after {
    content: '✓';
    font-weight: bold;
}

/* Light mode adjustments for container */
body.light-mode .semester-toggle-container {
    background: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .semester-toggle-container:hover {
    background: rgba(0, 0, 0, 0.08) !important;
}

body.light-mode .toggle-group:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* ── Syllabus Upload UI ────────────────────────────────────────────── */
.syllabus-upload-area {
    margin-top: 0.6rem;
}

.syllabus-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: border-color 0.2s, background 0.2s;
}

.syllabus-upload-label:hover {
    border-color: var(--primary-bright);
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary-bright);
}

.syllabus-upload-icon {
    font-size: 1.6rem;
}

.syllabus-current {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.9rem;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: var(--radius-sm);
}

.syllabus-icon {
    font-size: 1.4rem;
}

.syllabus-fname {
    flex: 1;
    font-size: 0.88rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.syllabus-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.syllabus-progress-bar {
    flex: 1;
    height: 6px;
    border-radius: 10px;
    background: var(--primary-gradient);
    animation: syllabus-pulse 1s ease-in-out infinite alternate;
}

@keyframes syllabus-pulse {
    from {
        opacity: 0.4;
    }

    to {
        opacity: 1;
    }
}

/* Detail modal syllabus section */
.detail-syllabus-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.75rem 0;
    padding: 0.75rem 1rem;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: var(--radius-sm);
}

.syllabus-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.9rem;
    border-radius: var(--radius-sm);
    background: var(--primary-gradient);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

.syllabus-open-btn:hover {
    opacity: 0.85;
}

/* Inline PDF viewer */
.syllabus-iframe {
    width: 100%;
    height: 520px;
    border: none;
    border-radius: var(--radius-sm);
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================
   QUICK LINKS SIDEBAR (FLOATING)
   ============================================ */
.quick-links-sidebar {
    position: fixed;
    top: calc(var(--header-height) + 2rem);
    right: 1.5rem;
    width: 70px;
    /* Slim by default, expands on hover */
    background: var(--bg-card-glass);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1rem 0.5rem;
    display: flex;
    /* Always visible */
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

/* Sidebar is now always flex */

.quick-links-sidebar:hover {
    width: 160px;
    padding: 1rem;
    align-items: flex-start;
    border-color: var(--primary-bright);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), var(--shadow-glow);
}

.quick-links-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    margin-bottom: 0.5rem;
    padding-right: 0.5rem;
}

.quick-links-sidebar:hover .quick-links-title {
    opacity: 1;
}

.quick-links-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.quick-link-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    color: var(--text-main);
    padding: 0.6rem;
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
    width: 100%;
    white-space: nowrap;
}

.ql-icon {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ql-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.quick-link-item:hover .ql-icon img {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.4)) brightness(1.1);
}

.ql-text {
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
}

.quick-links-sidebar:hover .ql-text {
    opacity: 1;
    transform: translateX(0);
}

.quick-link-item:hover {
    background: var(--primary-gradient);
    color: white;
    transform: scale(1.05);
}

.quick-link-item:hover .ql-icon {
    background: transparent;
    transform: rotate(15deg);
}

/* Responsive: Hide only on very small mobile screens */
@media (max-width: 800px) {
    .quick-links-sidebar {
        display: none;
    }
}
/* ========================================= */
/* MAAZAN (BALANCE) VIEW STYLES              */
/* ========================================= */

.maazan-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 0 3rem 0;
}

.maazan-view .view-header h2 {
    background: linear-gradient(135deg, var(--primary-bright) 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2.2rem;
    letter-spacing: -0.03em;
    filter: drop-shadow(0 2px 10px rgba(99, 102, 241, 0.2));
}

.maazan-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.maazan-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.maazan-category-card {
    background: var(--bg-card-glass);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

body.light-mode .maazan-category-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.maazan-category-card:hover {
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.mc-header {
    padding: 1.5rem 1.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    border-bottom: 1px solid transparent;
    transition: background 0.3s ease;
}

body.light-mode .mc-header {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0) 100%);
}

.maazan-category-card.expanded .mc-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.light-mode .maazan-category-card.expanded .mc-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mc-title {
    font-size: 1.4rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    letter-spacing: -0.02em;
}

.mc-title i {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.mc-summary-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.mc-summary-stats strong {
    color: var(--text-main);
    margin-right: 0.25rem;
}

.mc-expand-icon {
    transition: transform 0.3s ease;
}

.maazan-category-card.expanded .mc-expand-icon {
    transform: rotate(180deg);
}

.mc-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    width: 100%;
}

body.light-mode .mc-progress-bar {
    background: rgba(0, 0, 0, 0.05);
}

.mc-progress-fill {
    height: 100%;
    transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.2);
}

.mc-details-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1.25rem 1.8rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.95rem;
    color: var(--text-muted);
}

body.light-mode .mc-details-stats {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.01) 0%, transparent 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.mc-details-stats > div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.4rem 1rem;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.light-mode .mc-details-stats > div {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.mc-details-stats span {
    font-weight: 700;
    color: var(--text-main);
}

.mc-courses-dropdown {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background: rgba(0, 0, 0, 0.05);
}

.maazan-category-card.expanded .mc-courses-dropdown {
    max-height: 2000px; /* arbitrary large value for animation */
}

.maazan-course-row {
    display: grid;
    grid-template-columns: 2.5fr 1fr 1.5fr 1fr 1fr auto;
    gap: 1.5rem;
    padding: 1.25rem 1.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    align-items: center;
    transition: all 0.25s ease;
    margin: 0.5rem 1rem;
    border-radius: var(--radius-md);
}

.editable-maazan {
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    border: 1px dashed transparent;
    transition: all 0.2s;
    outline: none;
}

.editable-maazan:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.editable-maazan:focus {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.2);
}

body.light-mode .editable-maazan:hover {
    border-color: rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.05);
}

body.light-mode .editable-maazan:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.5);
}

body.light-mode .maazan-course-row {
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.maazan-course-row:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

body.light-mode .maazan-course-row:hover {
    background: rgba(0, 0, 0, 0.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.maazan-course-row.unlinked {
    opacity: 0.85;
}

.maazan-course-row.unlinked:hover {
    opacity: 1;
}

.maazan-course-row:last-child {
    border-bottom: none;
}

.mc-name {
    font-weight: 600;
    color: var(--text-main);
}

.mc-credits, .mc-semester {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.mc-status {
    font-size: 0.85rem;
}

.mc-grade {
    text-align: left;
}

@media (max-width: 768px) {
    .mc-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .mc-summary-stats {
        width: 100%;
        justify-content: space-between;
    }
    .mc-details-stats {
        flex-wrap: wrap;
        gap: 1rem;
    }
    .maazan-course-row {
        grid-template-columns: 1fr 1fr;
        grid-template-areas: 
            "name actn"
            "sem cred"
            "stat grad";
    }
    .mc-name { grid-area: name; }
    .mc-actions { grid-area: actn; text-align: left; }
    .mc-semester { grid-area: sem; }
    .mc-credits { grid-area: cred; }
    .mc-status { grid-area: stat; }
    .mc-grade { grid-area: grad; text-align: right; }
}

/* ========================================= */
/* MODERN MAAZAN CARDS UI                    */
/* ========================================= */

.mc-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
}

.maazan-modern-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.maazan-modern-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    transition: all 0.3s;
}

.maazan-modern-card.linked::before {
    background: var(--primary);
}

.maazan-modern-card.unlinked::before {
    background: var(--warning);
}

.maazan-modern-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-color: rgba(255,255,255,0.1);
}

.maazan-modern-card.unlinked:hover {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.1);
}

.mc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.mc-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
}

.mc-grade-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.mc-grade-circle.high { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.mc-grade-circle.med { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.mc-grade-circle.low { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }

.mc-card-body {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.mc-credits-tag, .mc-semester-tag {
    background: rgba(255,255,255,0.05);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.mc-card-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.03);
    display: flex;
    justify-content: flex-end;
}

.maazan-badge {
    padding: 0.35rem 0.85rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.maazan-badge.completed {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.maazan-badge.registered {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05));
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
}

.maazan-badge.unlinked {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

body.light-mode .maazan-modern-card {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

body.light-mode .mc-credits-tag, body.light-mode .mc-semester-tag {
    background: #f1f5f9;
    color: #475569;
}

.maazan-year-group {
    padding: 1.8rem 1.8rem 0.5rem 1.8rem;
}

.maazan-year-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-bright);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.1);
    display: block;
    letter-spacing: 0.5px;
}

body.light-mode .maazan-year-title {
    color: var(--primary);
    border-bottom: 2px dashed rgba(0, 0, 0, 0.1);
}

/* Make overview cards pop */
.maazan-overview-grid .stat-card {
    background: var(--bg-card-glass);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

body.light-mode .maazan-overview-grid .stat-card {
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(0,0,0,0.05);
}

.maazan-overview-grid .stat-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 30px rgba(0,0,0,0.2);
    border-color: var(--primary);
}

/* ============================================
   MOBILE RESPONSIVENESS (MAX-WIDTH: 768px)
   ============================================ */
@media (max-width: 768px) {
    /* Header & Navigation */
    .app-header {
        height: auto;
        padding: 0.75rem 0.5rem;
    }
    .header-content {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        position: relative;
    }
    .logo {
        width: auto;
        flex: 1;
        justify-content: flex-start;
    }
    .semester-toggle-container {
        font-size: 0.85rem;
    }
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: var(--text-main);
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.5rem;
        margin-right: auto;
    }
    .header-nav {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: 280px;
        max-width: 85vw;
        background: var(--bg-panel) !important;
        z-index: 9999;
        padding: 1.5rem;
        box-shadow: none;
        border-radius: 0;
        border: none;
        border-left: 1px solid var(--border);
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        gap: 0.5rem;
    }
    .header-nav.active {
        transform: translateX(0);
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1), 0 0 0 100vw rgba(0, 0, 0, 0.5);
    }
    
    .mobile-nav-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 2rem;
        padding-bottom: 1rem;
        border-bottom: 1px solid var(--border);
    }
    .mobile-nav-header .logo {
        font-size: 1.25rem;
        font-weight: 700;
        gap: 0.5rem;
    }
    .mobile-menu-close {
        background: none;
        border: none;
        font-size: 2rem;
        color: var(--text-main);
        cursor: pointer;
        padding: 0;
        line-height: 1;
    }
    
    .nav-btn {
        width: 100%;
        justify-content: flex-start;
        padding: 1rem 1.25rem;
        font-size: 1.1rem;
        border-radius: 12px;
        background: transparent;
        border: none;
        color: var(--text-muted);
        transition: all 0.2s ease;
    }
    .nav-btn .icon {
        font-size: 1.5rem;
    }
    
    .nav-btn.active {
        background: var(--primary-glow) !important;
        color: var(--primary) !important;
    }

    /* Main Area & Views */
    .main-content {
        padding: 1rem 0.5rem;
    }
    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    .view-header h2 {
        font-size: 1.6rem;
    }
    .view-header .btn-primary {
        width: 100%;
        justify-content: center;
    }
    
    /* Grids */
    .stats-grid,
    .maazan-overview-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .courses-grid,
    .exams-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .maazan-categories {
        grid-template-columns: 1fr;
    }
    
    /* Quick Links Sidebar */
    .quick-links-sidebar {
        display: none !important;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        margin: 2% auto;
        max-height: 95vh;
        border-radius: var(--radius-lg);
    }
    .modal-body {
        padding: 1rem;
    }
    .modal-header, .modal-footer {
        padding: 1rem;
    }
    .modal-footer {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }
    .modal-footer button {
        width: 100%;
    }

    /* Forms */
    .form-group input, 
    .form-group select, 
    .form-group textarea,
    .setting-item input,
    .setting-item select {
        width: 100%;
        max-width: 100%;
    }
    .days-selector {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .color-picker {
        display: flex !important;
        flex-wrap: wrap;
    }
    .grade-composition-section .grade-components-actions {
        flex-direction: column;
    }
    .grade-composition-section .grade-components-actions button {
        width: 100%;
    }

    /* Timeline & Calendar */
    .timeline-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        width: 100%;
    }
    .timeline-controls .semester-info {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    .timeline-view-toggle {
        width: 100%;
        display: flex;
    }
    .timeline-toggle-btn {
        flex: 1;
        text-align: center;
        justify-content: center;
    }

    /* Course Detail specific adjustments */
    .course-info-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .info-item {
        width: 100%;
        justify-content: space-between;
    }
    .grade-component-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.8rem;
    }
    .grade-comp-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    /* Tasks List */
    .task-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }
    .task-actions {
        width: 100%;
        justify-content: flex-end;
        padding-top: 0.5rem;
        border-top: 1px dashed rgba(255,255,255,0.1);
    }
    body.light-mode .task-actions {
        border-top: 1px dashed rgba(0,0,0,0.1);
    }

    /* Maazan specific */
    .mc-header {
        padding: 1rem;
    }
    .mc-title {
        font-size: 1.2rem;
    }
    .mc-details-stats {
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
    }
    .mc-details-stats > div {
        justify-content: space-between;
    }
}
