/* ==========================================================================
   CSS Variables & Tokens
   ========================================================================== */
   :root {
    /* Color Palette - Premium Dark Theme */
    --bg-dark: #09090b;
    --bg-panel: rgba(24, 24, 27, 0.7);
    --bg-panel-hover: rgba(39, 39, 42, 0.8);
    
    --primary: #8b5cf6;
    --primary-light: #a78bfa;
    --primary-glow: rgba(139, 92, 246, 0.5);
    
    --secondary: #3b82f6;
    --secondary-glow: rgba(59, 130, 246, 0.5);
    
    --accent: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #334155;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(255, 255, 255, 0.15);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Effects */
    --glass-blur: blur(16px);
    --shadow-soft: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px var(--primary-glow);
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow: hidden; /* App-like feel */
    min-height: 100vh;
}

/* Background Decorators for Glassmorphism */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.6;
    animation: float 20s infinite alternate;
}

.bg-shape-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--primary-glow), transparent 70%);
}

.bg-shape-2 {
    bottom: -10%;
    right: -5%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--secondary-glow), transparent 70%);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, 30px) scale(1.1); }
    100% { transform: translate(-30px, -50px) scale(0.9); }
}

/* ==========================================================================
   Layout 
   ========================================================================== */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar {
    width: 280px;
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition-normal);
    z-index: 10;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 28px;
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.logo h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff, var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 24px;
    cursor: pointer;
}

.nav-menu {
    flex: 1;
    overflow-y: auto;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Custom Scrollbar for nav */
.nav-menu::-webkit-scrollbar {
    width: 4px;
}
.nav-menu::-webkit-scrollbar-thumb {
    background: var(--border-highlight);
    border-radius: 4px;
}

.nav-section {
    margin-bottom: 16px;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-left: 12px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-fast);
    cursor: pointer;
    font-size: 0.95rem;
}

.nav-item i {
    font-size: 1.2rem;
}

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

.nav-item.active {
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary-light);
    border-left: 3px solid var(--primary);
}

.nav-item i.completed-icon {
    color: var(--accent);
    margin-left: auto;
    font-size: 1.1rem;
    opacity: 0;
    transition: var(--transition-fast);
}

.nav-item.completed i.completed-icon {
    opacity: 1;
}

.nav-item.completed i:not(.completed-icon) {
    color: var(--accent);
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: var(--shadow-glow);
}

/* Progress Tracking */
.progress-container {
    margin-top: 16px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.progress-bar-bg {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px;
    transition: width 0.5s ease-out;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-header {
    height: 72px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: rgba(9, 9, 11, 0.5);
    backdrop-filter: blur(10px);
    z-index: 5;
}

.header-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.header-breadcrumbs .muted {
    color: var(--text-muted);
}

.header-breadcrumbs i {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.header-actions {
    display: flex;
    gap: 16px;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-panel-hover);
    color: var(--text-main);
    border-color: var(--border-highlight);
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar for content */
.content-area::-webkit-scrollbar {
    width: 8px;
}
.content-area::-webkit-scrollbar-track {
    background: transparent;
}
.content-area::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 8px;
}
.content-area::-webkit-scrollbar-thumb:hover {
    background: var(--border-highlight);
}

/* Glass Panel for Course Content */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-soft);
    max-width: 900px;
    margin: 0 auto;
    min-height: calc(100vh - 150px);
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Course Typography & Markdown Styles
   ========================================================================== */
.course-content {
    animation: fadeIn 0.3s ease-out;
}

.course-content h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 24px;
    line-height: 1.2;
    background: linear-gradient(to right, #fff, var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.course-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 40px;
    margin-bottom: 16px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.course-content h2::before {
    content: '';
    display: block;
    width: 4px;
    height: 1.2em;
    background: var(--primary);
    border-radius: 2px;
}

.course-content h3 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--primary-light);
}

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

.course-content ul {
    margin-bottom: 20px;
    padding-left: 20px;
    list-style-type: none;
}

.course-content li {
    margin-bottom: 8px;
    color: var(--text-muted);
    position: relative;
    padding-left: 12px;
}

.course-content li::before {
    content: '→';
    position: absolute;
    left: -12px;
    color: var(--primary);
    font-weight: bold;
}

.course-content strong {
    color: var(--text-main);
    font-weight: 600;
}

/* Code Blocks */
.code-block-wrapper {
    position: relative;
    margin: 24px 0;
}

.code-header {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.mac-dots {
    display: flex;
    gap: 6px;
}

.mac-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.mac-dot.red { background: #ff5f56; }
.mac-dot.yellow { background: #ffbd2e; }
.mac-dot.green { background: #27c93f; }

.course-content pre {
    background: #0d1117;
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    padding: 20px;
    overflow-x: auto;
}

.course-content code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: #e2e8f0;
}

/* Inline Code */
.course-content p code, 
.course-content li code {
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Callouts / Notices */
.callout {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--secondary);
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
    margin: 24px 0;
    display: flex;
    gap: 16px;
}

.callout i {
    font-size: 1.5rem;
    color: var(--secondary);
    margin-top: 2px;
}

.callout-content p {
    margin-bottom: 0;
    color: var(--text-main);
}

.callout.warning {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: var(--warning);
}
.callout.warning i { color: var(--warning); }

/* Welcome Screen */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    min-height: 50vh;
}

.welcome-icon-wrapper {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: var(--shadow-glow);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.welcome-icon-wrapper i {
    font-size: 3rem;
    color: var(--primary-light);
}

/* ==========================================================================
   Quiz & Completion Actions
   ========================================================================== */
.module-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.quiz-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-highlight);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.quiz-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.quiz-header i {
    font-size: 1.5rem;
    color: var(--warning);
}

.quiz-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-main);
}

.quiz-question {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--text-main);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz-option {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 12px;
}

.quiz-option:hover:not(.disabled) {
    background: var(--bg-panel-hover);
    border-color: var(--primary-light);
}

.quiz-option.selected {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--primary);
}

.quiz-option.correct {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--accent);
}

.quiz-option.incorrect {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
}

.quiz-option.disabled {
    cursor: default;
    opacity: 0.8;
}

.quiz-feedback {
    margin-top: 24px;
    padding: 16px;
    border-radius: 8px;
    display: none;
    animation: fadeIn 0.3s ease;
}

.quiz-feedback.show {
    display: block;
}

.quiz-feedback.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.quiz-feedback.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 8px;
}

.success .feedback-header { color: var(--accent); }
.error .feedback-header { color: var(--danger); }

.feedback-explanation {
    color: var(--text-main);
    font-size: 0.95rem;
}

.action-bar {
    display: flex;
    justify-content: flex-end;
}

.btn-complete {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary-light);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.btn-complete:hover {
    background: rgba(139, 92, 246, 0.1);
}

.btn-complete.completed {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
}

.btn-complete.completed:hover {
    background: #0ea5e9; /* Slightly different shade or just keep same */
    opacity: 0.9;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        height: 100vh;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .top-header {
        padding: 0 16px;
    }
    
    .content-area {
        padding: 16px;
    }
    
    .glass-panel {
        padding: 24px;
    }
}
