/* ==========================================================================
   CodeLab Core Stylesheet - Dark Glassmorphism Design System
   ========================================================================== */

:root {
    --bg-color: #0b0d19;
    --card-bg: rgba(18, 22, 41, 0.65);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-border-glow: rgba(0, 242, 254, 0.15);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #00f2fe;
    --primary-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    --accent: #d946ef;
    --accent-gradient: linear-gradient(135deg, #d946ef 0%, #8b5cf6 100%);
    --neon-green: #10b981;
    
    --sidebar-width: 320px;
    --header-height: 70px;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-mode {
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.75);
    --card-border: rgba(15, 23, 42, 0.08);
    --card-border-glow: rgba(0, 242, 254, 0.08);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --primary: #0284c7;
    --primary-gradient: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    --accent: #c026d3;
    --accent-gradient: linear-gradient(135deg, #c026d3 0%, #7c3aed 100%);
    --neon-green: #059669;
}

body.light-mode .glow-bg {
    background: radial-gradient(circle, rgba(2, 132, 199, 0.08) 0%, rgba(255, 255, 255, 0) 70%);
}

body.light-mode .sidebar {
    background: rgba(241, 245, 249, 0.9);
}

body.light-mode .search-box input {
    background: rgba(15, 23, 42, 0.03);
}

body.light-mode .search-box input:focus {
    background: rgba(255, 255, 255, 1);
}

body.light-mode .code-panel {
    background: #0f172a;
}

body.light-mode .btn-github {
    background: rgba(15, 23, 42, 0.04);
}

body.light-mode .btn-github:hover {
    background: rgba(15, 23, 42, 0.08);
}

body.light-mode .content-header {
    background: rgba(248, 250, 252, 0.5);
}

.btn-theme {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition-smooth);
}

.btn-theme:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(15deg);
}

body.light-mode .btn-theme {
    background: rgba(15, 23, 42, 0.04);
}

body.light-mode .btn-theme:hover {
    background: rgba(15, 23, 42, 0.08);
}


/* Reset & Scrollbar */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    transition: var(--transition-smooth);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Glow Background Effects */
.glow-bg {
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79, 172, 254, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
    top: -100px;
    right: -100px;
    pointer-events: none;
    z-index: 0;
    animation: pulse 12s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.15) translate(-50px, 50px); }
}

/* Main Layout Grid */
.app-container {
    display: flex;
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(10, 12, 24, 0.85);
    border-right: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--transition-smooth);
}

.sidebar-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.logo-icon {
    font-size: 24px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.logo-text .highlight {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-sidebar {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
}

/* Search Box */
.search-box {
    margin: 0 20px 20px 20px;
    position: relative;
}

.search-box input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px 16px 12px 42px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    outline: none;
    transition: var(--transition-smooth);
}

.search-box input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px var(--card-border-glow);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Sidebar Nav links */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px 20px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin: 24px 0 10px 0;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item.active .nav-link {
    color: var(--text-primary);
    background: rgba(0, 242, 254, 0.08);
    border-left: 3px solid var(--primary);
    box-shadow: inset 5px 0 15px rgba(0, 242, 254, 0.02);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.01);
}

.profile-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--card-border);
    object-fit: cover;
}

.profile-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.profile-title {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Header */
.content-header {
    height: var(--header-height);
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    background: rgba(11, 13, 25, 0.4);
    position: sticky;
    top: 0;
    z-index: 99;
    transition: var(--transition-smooth);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.crumb-parent {
    color: var(--text-muted);
    font-weight: 500;
}

.crumb-separator {
    font-size: 10px;
    color: var(--text-muted);
}

.crumb-active {
    color: var(--text-primary);
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

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

.btn-github:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
}

/* Content Body */
.content-body {
    padding: 40px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    flex: 1;
    animation: fadeIn 0.4s ease-out;
}

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

/* Dashboard / Landing view card list */
.hero-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 48px;
    backdrop-filter: blur(20px);
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-gradient);
}

.hero-title {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 16px;
    line-height: 1.1;
}

.hero-title span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 800px;
    margin-bottom: 32px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition-smooth);
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(0, 242, 254, 0.25);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 28px;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 242, 254, 0.1);
    color: var(--primary);
}

.stat-card:nth-child(2) .stat-icon {
    background: rgba(217, 70, 239, 0.1);
    color: var(--accent);
}

.stat-card:nth-child(3) .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--neon-green);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Topic details rendering */
.topic-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 40px;
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 24px;
    margin-bottom: 30px;
}

.topic-info-main {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topic-logo {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--primary);
}

.topic-name {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.topic-category {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
}

/* Syllabus Timeline styling */
.syllabus-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--primary);
}

.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: rgba(255, 255, 255, 0.06);
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 2px solid var(--primary);
    z-index: 2;
}

.timeline-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.timeline-desc {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Code block view styling */
.code-panel {
    background: #06070d;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    margin-top: 30px;
    overflow: hidden;
}

.code-header {
    background: rgba(255, 255, 255, 0.02);
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-title {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
}

.code-body {
    padding: 20px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    color: #e2e8f0;
    white-space: pre;
    line-height: 1.7;
}

/* Responsive Rules */
@media (max-width: 1024px) {
    .content-header {
        padding: 0 24px;
    }
    .content-body {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    .close-sidebar {
        display: block;
    }
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 1000;
    }
    .sidebar.open {
        left: 0;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
    }
    .hero-card {
        padding: 30px;
    }
    .hero-title {
        font-size: 30px;
    }
    .content-header {
        padding: 0 16px;
    }
}

/* ==========================================================================
   Interactive Markdown Accordion & Rendered Guide Styles
   ========================================================================== */
.timeline-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.load-notes-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    width: fit-content;
    transition: var(--transition-smooth);
    user-select: none;
}

.load-notes-btn:hover {
    background: rgba(0, 242, 254, 0.08);
    border-color: var(--primary);
}

.chapter-accordion {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease-out, padding 0.3s ease-out;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 0 solid var(--card-border);
}

.chapter-accordion.open {
    max-height: 1200px;
    opacity: 1;
    padding: 18px;
    margin-top: 10px;
    border-width: 1px;
    overflow-y: auto;
}

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

/* Rendered Markdown Typography */
.markdown-body {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.markdown-body h1, 
.markdown-body h2, 
.markdown-body h3, 
.markdown-body h4 {
    color: var(--text-primary);
    margin: 20px 0 10px 0;
    font-weight: 600;
}

.markdown-body h1 {
    font-size: 20px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 6px;
}

.markdown-body h2 { font-size: 18px; }
.markdown-body h3 { font-size: 15px; }

.markdown-body p {
    margin-bottom: 12px;
}

.markdown-body ul, 
.markdown-body ol {
    padding-left: 20px;
    margin-bottom: 12px;
}

.markdown-body li {
    margin-bottom: 4px;
}

.markdown-body code {
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--primary);
}

body.light-mode .markdown-body code {
    background: rgba(15, 23, 42, 0.05);
}

.markdown-body pre {
    background: #06070d;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 14px;
    border: 1px solid var(--card-border);
}

.markdown-body pre code {
    background: none;
    padding: 0;
    color: #e2e8f0;
    font-size: 13px;
}

.markdown-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 16px;
    color: var(--text-muted);
    margin: 12px 0;
    font-style: italic;
}
