/* ============================================
   MODERN UI
   ============================================ */

   :root {
    /* Light theme colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --accent: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #ffffff;
    
    /* Text colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;
    
    /* Borders */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* Imporved colours */
    --input-bg: #ffffff;
    --input-border: #d1d5db;
    --input-focus: #6366f1;
    --card-gradient-start: #ffffff;
    --card-gradient-end: #f9fafb;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    
    /* Animations */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Layout */
    --sidebar-width: 280px;
    --mobile-header-height: 60px;
}

/* Dark theme colors */
[data-theme="dark"] {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --primary-light: #4f46e5;
    --accent: #a78bfa;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-elevated: #1e293b;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-inverse: #0f172a;
    
    --border-color: #334155;
    --border-light: #475569;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5);

    --input-bg: #1e293b;
    --input-border: #475569;
    --input-focus: #818cf8;
    --card-gradient-start: #1e293b;
    --card-gradient-end: #334155;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    position: relative;
    overflow: hidden;
}

/* Animated background shapes */
.login-container::before,
.login-container::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 20s infinite ease-in-out;
}

.login-container::before {
    width: 300px;
    height: 300px;
    top: -150px;
    left: -150px;
}

.login-container::after {
    width: 500px;
    height: 500px;
    bottom: -250px;
    right: -250px;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
    z-index: 1;
    position: relative;
}

.login-header_title {
    /* font-size: clamp(2rem, 7vw, 3rem); */
    font-size: 2.7em;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.login-header p {
    font-size: clamp(1.2rem, 4vw, 1.26rem);
    opacity: 0.9;
}

.login-form {
    background: linear-gradient(135deg, var(--card-gradient-start), var(--card-gradient-end));
    padding: 1.6rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 400px;
    z-index: 1;
    position: relative;
    border: 1px solid var(--border-color);
}

.login-form input,
input[type="text"],
input[type="password"],
input[type="email"] {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--input-border);
    border-radius: 0.75rem;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: var(--transition);
    margin-bottom: 1rem;
}

.login-form input:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
    outline: none;
    border-color: var(--input-focus);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Dark mode specific input adjustments */
[data-theme="dark"] .login-form input:focus,
[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] input[type="password"]:focus {
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.login-form button {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.login-form button:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.login-form button:active:not(:disabled) {
    transform: translateY(0);
}

/* Login page icon styles */
.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    margin-bottom: 1rem;
}

.login-logo .icon {
    width: 40px;
    height: 40px;
    color: white;
}

.index-footer{
    background: var(--accent);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
    font-size: 1em;
    font-weight: 600;
    color: rgb(27, 25, 25);
}
.error-message {
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-top: 1rem;
    animation: slideIn 0.3s ease;
}

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

.loading-spinner {
    text-align: center;
    padding: 1.5rem;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


[data-theme="dark"] .demo-info {
    background: rgba(30, 41, 59, 0.95);
}


/* ============================================
   MAIN APP
   ============================================ */

.app-container {
    display: flex;
    height: 100vh;
    background: var(--bg-secondary);
    position: relative;
}

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    background: var(--bg-elevated);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.theme-toggle .icon {
    font-size: 1.25rem;
}

/* MOBILE MENU TOGGLE - IMPROVED VERSION */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 999;
    background: var(--bg-elevated);
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.625rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:hover {
    transform: scale(1.05);
    background: var(--primary);
    color: white;
}

.mobile-menu-toggle .icon {
    width: 24px;
    height: 24px;
}

/* Show mobile menu button only on mobile devices */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex !important; /* Always show on mobile by default */
    }
    
    /* Hide when sidebar is active (open) */
    .sidebar.active ~ .mobile-menu-toggle,
    body:has(.sidebar.active) .mobile-menu-toggle {
        display: none !important;
    }
}

/* Desktop behavior for menu button */
@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none; /* Hidden by default on desktop */
    }
    
    /* Show only when sidebar is collapsed on desktop */
    body:has(.sidebar.collapsed) .mobile-menu-toggle,
    .sidebar.collapsed ~ .mobile-menu-toggle {
        display: flex !important;
    }
}
/* Sidebar styles */
/* IMPROVED SIDEBAR WITH STICKY FOOTER - Replace existing sidebar styles */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 100;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar header - fixed at top */
.sidebar-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    min-height: 72px;
}

/* Sidebar content - scrollable middle section */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 1rem;
    padding-bottom: 2rem; /* Add padding to prevent content hiding behind footer */
    -webkit-overflow-scrolling: touch;
}

/* Sidebar footer - ALWAYS at bottom */
.sidebar-footer {
    overflow-y: auto;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.6rem;
    border-top: 2px solid var(--border-color);
    background: var(--bg-primary); /* Changed from secondary to match sidebar */
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 10; /* Ensure it's above content */
}

/* Adjust content to account for fixed footer */
.sidebar-content {
    margin-bottom: 300px;
}

/* Chapter list text wrapping */
.chapter-item {
    display: flex;
    align-items: center;
    padding: 0.875rem;
    margin-bottom: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.chapter-name {
    flex: 1;
    font-weight: 500;
    /* TEXT WRAPPING - max 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    max-width: 180px; /* Adjust based on your sidebar width */
}

.chapter-size {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-left: auto;
    flex-shrink: 0; /* Don't shrink */
    padding-left: 0.5rem;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 1.125rem;
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(180deg);
}

.chapter-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    list-style: none;
}

.chapter-item {
    display: flex;
    align-items: center;
    padding: 0.875rem;
    margin-bottom: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

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

.chapter-item.active {
    box-shadow: var(--shadow-md);
    font-weight: 600;
    position: relative;
    transition: all 0.3s ease;
}

[data-theme="light"] .chapter-item.active {
    background: var(--bg-primary);
    color: var(--primary-dark);  /* Dark text */
    border: 3px solid var(--primary);
    border-left-width: 6px;  /* Thicker left border */
}

/* Add a subtle gradient overlay */
[data-theme="light"] .chapter-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(99, 102, 241, 0.1) 0%, 
        rgba(99, 102, 241, 0.05) 100%
    );
    border-radius: inherit;
    pointer-events: none;
}

/* Dark mode - keep the gradient background */
[data-theme="dark"] .chapter-item.active {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--accent) 100%);
    color: white;
    border: none;
}

/* Number styling for active items */
[data-theme="light"] .chapter-item.active .chapter-number {
    background: var(--primary);
    color: white;
}

[data-theme="dark"] .chapter-item.active .chapter-number {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}


.chapter-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 0.5rem;
    margin-right: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.chapter-item.active .chapter-number {
    background: rgba(255, 255, 255, 0.2);
}

.chapter-name {
    flex: 1;
    font-weight: 500;
}

.chapter-size {
    font-size: 0.75rem;
    opacity: 0.6;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.user-info {
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}

.user-info small {
    display: block;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.user-info code {
    display: block;
    color: var(--primary);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
}

.logout-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.logout-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Main content area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    overflow: auto;
    position: relative;
}

.content-header {
    margin-bottom: 2rem;
}

.content-header h1 {
    font-size: clamp(1.36rem, 3vw, 1.5rem);
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stats span {
    padding: 0.5rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

.theme-switcher {
    margin: 1rem 0;
}

.theme-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.theme-switch:hover {
    background: var(--bg-tertiary);
}

.theme-switch span:first-child {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.theme-switch input {
    display: none;
}

.theme-switch .slider {
    position: relative;
    width: 48px;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    transition: var(--transition);
}

.theme-switch .slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.theme-switch input:checked + .slider {
    background: var(--primary);
}

.theme-switch input:checked + .slider::before {
    transform: translateX(24px);
}


/* Initial prompt when no deck is selected */
.initial-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1rem;
    padding: 2rem;
    width: 100%;
    height: 100%;
    cursor: pointer;
    position: relative;
}

.initial-prompt .icon {
    width: 60px;
    height: 60px;
    color: var(--primary);
    opacity: 0.8;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.initial-prompt h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
}

.initial-prompt p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
}

.arrow-indicator {
    font-size: 2rem;
    color: var(--primary);
    animation: slideRight 1.5s ease-in-out infinite;
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
}

@keyframes slideRight {
    0%, 100% { transform: translateX(0) translateY(-50%); }
    50% { transform: translateX(10px) translateY(-50%); }
}

/* When no cards are loaded, show pointer cursor */
.flashcard:has(.initial-prompt) {
    cursor: pointer;
    transition: all 0.3s ease;
}

.flashcard:has(.initial-prompt):hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-xl);
}

/* Add pulsing border when no deck is selected */
.flashcard:has(.initial-prompt) {
    position: relative;
}

.flashcard:has(.initial-prompt)::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.5; }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .initial-prompt h3 {
        font-size: 1.25rem;
    }
    
    .initial-prompt p {
        font-size: 0.875rem;
    }
    
    .arrow-indicator {
        display: none; /* Hide arrow on mobile */
    }
    
    .initial-prompt .icon {
        width: 50px;
        height: 50px;
    }
}

/* Hide initial prompt when cards are loaded */
.flashcard:not(:has(.initial-prompt)) {
    cursor: pointer; /* Still clickable for flipping */
}

/* Pulse animation for chapter list when opened */
@keyframes pulse {
    0%, 100% { 
        background: var(--bg-secondary);
    }
    50% { 
        background: var(--primary-light);
        color: white;
    }
}

/* Dark mode adjustments */
[data-theme="dark"] .initial-prompt {
    background: var(--bg-tertiary);
    border-radius: 1rem;
}

[data-theme="dark"] .initial-prompt .icon {
    color: var(--primary-light);
}

[data-theme="dark"] .flashcard:has(.initial-prompt)::before {
    opacity: 0.3;
}


/* Flashcard styles */
.flashcard-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
    padding: 1rem;
}

.flashcard {
    width: 100%;
    max-width: 600px;
    aspect-ratio: 3/2;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: var(--bg-elevated);
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
    color: white;
}

[data-theme="dark"] .card-back {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-elevated) 100%);
    color: var(--text-primary);
}

.card-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
    margin-bottom: 1rem;
}

.card-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.2rem, 2.5vw, 1.3rem);
    text-align: center;
    line-height: 1.6;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.flip-hint {
    margin-top: 1rem;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    text-align: center;
}

/* Controls */
.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.control-btn {
    padding: 0.75rem 1.5rem;
    background: var(--bg-elevated);
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-btn:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.progress-indicator {
    flex: 1;
    max-width: 200px;
    min-width: 100px;
}

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    transition: width 0.3s ease;
    width: 0%;
}

.keyboard-hints {
    margin-top: 1rem;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.keyboard-hints kbd {
    display: inline-block;
    margin: 0 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    font-family: 'Consolas', 'Monaco', monospace;
    box-shadow: var(--shadow-sm);
}

/* ============================================
   MOBILE RESPONSIVE DESIGN
   ============================================ */

.compact-info{
    display: none;
}


@media (max-width: 768px) {
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: block;
    }
    
    /* Adjust theme toggle position */
    .theme-toggle {
        top: 1rem;
        right: 1rem;
    }

    .compact-info{
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background: var(--bg-secondary);
        border-radius: 0.5rem;
        margin-top: 10px;
        padding: 0.9rem;
        color: var(--text-tertiary);
    }
    
    /* Sidebar becomes full-screen overlay on mobile - UPDATED */

    /* Make chapter list scrollable - ADD THIS */
    .chapter-list {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 1rem;
        list-style: none;
        min-height: 0; /* Important for flex scrolling */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

    /* Ensure footer stays at bottom - ADD THIS */
    .sidebar-footer {
        height: 39vh;
        padding: 1rem;
        border-top: 1px solid var(--border-color);
        background: var(--bg-secondary);
        margin-top: auto; /* Push to bottom */
        flex-shrink: 0; /* Don't shrink */
    }

    /* Ensure header doesn't shrink - ADD THIS */
    .sidebar-header {
    flex-shrink: 0;
}
    
    /* Add overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 997;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Adjust main content for mobile */
    .main-content {
        padding: 1rem;
        padding-top: 4rem; /* Space for fixed buttons */
    }
    
    /* Make flashcard smaller on mobile */
    .flashcard {
        max-width: 100%;
        aspect-ratio: 4/3;
    }
    
    .card-face {
        padding: 1.5rem;
    }
    
    .card-content {
        font-size: 1.2rem;
    }
    
    /* Stack controls vertically on mobile */
    .controls {
        flex-direction: column;
        width: 100%;
        padding: 0 1rem;
    }
    
    .control-btn {
        width: 100%;
        justify-content: center;
    }
    
    .progress-indicator {
        width: 100%;
        max-width: 100%;
        order: -1;
        margin-bottom: 1rem;
    }
    
    /* Adjust stats for mobile */
    .stats {
        flex-direction: row;
    }
    
    .stats span {
        width: fit-content;
    }
    
    /* Mobile-specific text sizes */
    .content-header h1 {
        font-size: 1.47rem;
    }
    
    .keyboard-hints {
        display: none; /* Hide keyboard hints on mobile */
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 320px;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 998;
        box-shadow: var(--shadow-xl);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Hide desktop toggle button on mobile */
    .sidebar-toggle-btn {
        display: none;
    }
}

/* Desktop collapsed sidebar adjustments */
@media (min-width: 769px) {
    .main-content {
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .sidebar.collapsed + .main-content {
        margin-left: 0;
    }
    
    /* Show floating menu button when sidebar is collapsed */
    .mobile-menu-toggle {
        display: none;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 999;
        background: var(--bg-elevated);
        border: 2px solid var(--border-color);
        border-radius: 0.75rem;
        padding: 0.625rem;
        cursor: pointer;
        transition: var(--transition);
        box-shadow: var(--shadow-md);
        color: var(--text-primary);
    }
    
    .sidebar.collapsed ~ .mobile-menu-toggle {
        display: flex;
    }
}

@media (max-width: 480px) {
    /* Even smaller screens */
    .login-form {
        padding: 1.5rem;
    }
    
    .card-content {
        font-size: 1.139rem;
    }
    
    .sidebar {
        max-width: 100%;
    }
    #answerText{
        padding-top: 1rem;
    }
    #answer-lable{
        margin-bottom: 0 !important;
    }
}

/* ============================================
   ANIMATIONS & INTERACTIONS
   ============================================ */

/* Smooth transitions for theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Card hover effect */
.flashcard:hover {
    transform: scale(1.02);
}

.flashcard.flipped:hover {
    transform: rotateY(180deg) scale(1.02);
}

/* Button press effect */
button:active {
    transform: scale(0.98);
}

/* Loading animation for chapters */
.chapter-item.loading {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Admin panel specific styles */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.admin-auth,#adminPanel {
    background: var(--bg-elevated);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.admin-auth {
    max-width: 400px;
    margin: 0 auto;
}

.key-creation {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.key-list table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.key-list th,
.key-list td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.key-list th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
}

.delete-btn {
    padding: 0.5rem 1rem;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition);
}

.delete-btn:hover {
    background: #dc2626;
}

/* Responsive tables */
@media (max-width: 768px) {
    .key-list {
        overflow-x: auto;
    }
    
    .key-list table {
        min-width: 600px;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .controls,
    .keyboard-hints,
    .theme-toggle,
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .flashcard {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* ADMIN PANEL IMPROVEMENTS - Add at the end of the file */

/* Button spacing in tables */
.key-list td button {
    margin: 0.25rem;
    display: inline-block;
}

/* Responsive button layout for small screens */
@media (max-width: 640px) {
    .key-list td button {
        display: block;
        width: 100%;
        margin: 0.25rem 0;
    }
    
    .key-list td:last-child {
        min-width: 120px;
    }
}

/* Better spacing for admin auth */
.admin-auth {
    background: var(--bg-elevated);
    padding: 2.5rem;
    border-radius: 1rem;
    max-width: 400px;
    margin: 2rem auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.admin-auth h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.admin-auth input {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid var(--input-border);
    border-radius: 0.75rem;
    background: var(--input-bg);
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

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

.admin-auth button {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.admin-auth button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

#adminError {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    text-align: center;
}

/* Admin panel header styling */
.admin-container-head-title {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 2rem;
    font-size: 1.7rem;
    font-weight: 700;
}

/* Create key section improvements */
.key-creation {
    background: var(--bg-elevated);
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.key-creation h2 {
    margin-bottom: 0.6rem;
    color: var(--text-primary);
}

.key-creation > div {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.key-creation input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--input-border);
    border-radius: 0.5rem;
    background: var(--input-bg);
    color: var(--text-primary);
}

.key-creation button {
    padding: 0.75rem 1.5rem;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.key-creation button:hover {
    background: #059669;
    transform: translateY(-2px);
}

#createKeyMessage {
    margin-top: 1rem;
    font-size: 0.875rem;
}

/* Table improvements */
.key-list {
    background: var(--bg-elevated);
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.key-list h2 {
    color: var(--text-primary);
}

.key-list table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
}

.key-list th {
    background: var(--bg-secondary);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.key-list td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.key-list tr:hover td {
    background: var(--bg-secondary);
}

/* Code styling in tables */
.key-list code {
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 0.25rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    color: var(--primary);
}

.subheadings-admin-panel{
    font-size: 1.2rem;
    margin-bottom: 1rem;
}



/*------------------- Added Things ------------------- */
/* ADD THESE NEW STYLES at the end of the file */


/* Desktop menu button styling */
@media (min-width: 769px) {
    .mobile-menu-toggle {
        width: 48px;
        height: 48px;
        display: none;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-menu-toggle .icon {
        width: 24px;
        height: 24px;
    }
    
    .mobile-menu-toggle:hover {
        transform: scale(1.05);
        background: var(--primary);
        color: white;
    }
}

/* Ensure main content adjusts when sidebar collapses */
.sidebar.collapsed + .main-content,
.sidebar.collapsed ~ .main-content {
    margin-left: 0;
    width: 100%;
}

/* Smooth transitions for sidebar collapse */
.sidebar,
.sidebar * {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    width: 0 !important;
    min-width: 0;
    overflow: hidden;
}

/* Icon button improvements */
.control-btn .icon {
    margin: 0 0.25rem;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.logout-btn .icon {
    width: 20px;
    height: 20px;
}

/* Theme switch icon adjustment */
.theme-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-switch span:first-child {
    min-width: 20px;
}

/* ADD THESE NEW STYLES */

/* Deck header with reshuffle button */
.deck-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.deck-header h1 {
    margin-bottom: 0;
}

/* Reshuffle button */
.reshuffle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-elevated);
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--primary);
}

.reshuffle-btn:hover {
    background: var(--primary);
    color: white;
    transform: rotate(180deg);
}

.reshuffle-btn .icon {
    width: 20px;
    height: 20px;
}

/* Ensure icons display properly */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.icon svg {
    width: 100%;
    height: 100%;
}

/* Icon placeholder for missing icons */
.icon-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

/* Mobile adjustments for footer */
@media (max-width: 768px) {
    .sidebar-footer {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 240px; /* Limit height on mobile */
    }
    
    .sidebar-content {
        margin-bottom: 240px; /* Match footer max-height */
    }
    
    .chapter-name {
        max-width: 150px; /* Smaller on mobile */
    }
}

/* Improve chapter item hover state */
.chapter-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
    border-color: var(--primary-light);
}

.chapter-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.chapter-item.active .chapter-name {
    font-weight: 600;
}

/* Ensure theme toggle and other footer elements are visible */
.sidebar-footer .user-info,
.sidebar-footer .theme-switcher,
.sidebar-footer .logout-btn {
    position: relative;
    z-index: 1;
}

/* Better logout button styling */
.logout-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.logout-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Control buttons icon alignment */
.control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.control-btn .icon {
    flex-shrink: 0;
}


/* ADD THESE NEW STYLES */

.input-group {
    position: relative;
    margin-bottom: 1rem;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
    z-index: 1;
}

.input-group input {
    padding-left: 3rem;
}

/* Shuffle button in stats area */
.shuffle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-elevated);
    border: 2px solid var(--primary);
    border-radius: 0.75rem;
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease; /* Faster transition */
}

.shuffle-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Add a subtle click effect */
.shuffle-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Admin page button improvements */
.admin-logout-btn {
    margin-top: 2rem;
    padding: 0.75rem 1.5rem;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.admin-logout-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.create-btn {
    padding: 0.75rem 1.5rem;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.create-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

/* Icon enhancements */
h1 .icon, h2 .icon {
    margin-right: 0.5rem;
    vertical-align: middle;
}

button .icon {
    flex-shrink: 0;
}

/* Demo info with icon */
.demo-info p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Remove session timer specific styles */
#sessionTimer {
    display: none !important;
}

/* Better stats area layout */
.stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Ensure sidebar toggle icon updates properly */
.sidebar-toggle-btn {
    transition: transform 0.3s ease;
}

.sidebar-toggle-btn:hover {
    transform: scale(1.1);
}

/* Dark mode adjustments for new elements */
[data-theme="dark"] .input-icon {
    color: var(--text-tertiary);
}

[data-theme="dark"] .login-logo {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .shuffle-btn {
    background: var(--bg-tertiary);
    border-color: var(--primary-light);
}

[data-theme="dark"] .shuffle-btn:hover {
    background: var(--primary);
}


/* ============================================
   LOGOUT OVERLAY STYLES
   ============================================ */

   .logout-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.logout-message {
    background: var(--bg-elevated);
    padding: 3rem;
    border-radius: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.4s ease;
    max-width: 400px;
    margin: 1rem;
}

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

.logout-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1.5rem;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.logout-message h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.logout-message p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Dark mode adjustments */
[data-theme="dark"] .logout-overlay {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .logout-message {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

/* Blur effect for main content */
.app-container.logging-out {
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .logout-message {
        padding: 2rem;
        margin: 1rem;
    }
    
    .logout-message h2 {
        font-size: 1.5rem;
    }
    
    .logout-spinner {
        width: 40px;
        height: 40px;
    }
}

/* Smooth transition for blur effect */
.app-container {
    transition: filter 0.3s ease;
}

/* Prevent interaction during logout */
.logout-overlay * {
    pointer-events: none;
}


/* ============================================
   FOLDER SUPPORT STYLES
   ============================================ */

/* Folder section container */
.folder-section {
    margin-bottom: 0.5rem;
    list-style: none;
}

/* Folder header (clickable) */
.folder-header {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    margin-bottom: 0.25rem;
    border: 2px solid transparent;
}

.folder-header:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

/* Folder icon */
.folder-header .folder-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
    color: var(--primary);
}

.folder-header:hover .folder-icon {
    color: white;
}

/* Folder name */
.folder-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
}

/* File count badge */
.folder-count {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-left: 0.5rem;
}

/* Chevron icon for expand/collapse */
.folder-header .chevron-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
    margin-left: auto;
}

.chevron-icon.expanded {
    transform: rotate(90deg);
}

.chevron-icon.collapsed {
    transform: rotate(0deg);
}

/* Folder contents (list of files) */
.folder-contents {
    list-style: none;
    padding-left: 1.5rem;
    margin: 0;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

/* Nested folders */
.folder-contents .folder-section {
    margin-left: 0;
}

.folder-contents .folder-header {
    background: rgba(var(--primary-rgb), 0.05);
    font-size: 0.9rem;
}

/* Files inside folders */
.folder-contents .chapter-item {
    margin-bottom: 0.25rem;
    /* background: var(--bg-primary); */
    border-left: 3px solid var(--primary-light);
}

.folder-contents .chapter-item:hover {
    border-left-color: var(--primary);
}

/* Collapsed folder */
.folder-contents[style*="display: none"] {
    display: none;
}

/* Loading state inside folder */
.folder-contents .loading {
    padding: 0.5rem;
    text-align: center;
    color: var(--text-tertiary);
    font-style: italic;
}

/* Error state inside folder */
.folder-contents .error {
    padding: 0.5rem;
    color: var(--danger);
    font-size: 0.85rem;
}


/* Add specific dark mode text color for hover */
[data-theme="dark"] .folder-header:hover {
    color: white;
}

[data-theme="dark"] .chapter-item:hover {
    color: var(--text-primary);  /* Keep readable in dark mode */
}

/* Light mode specific - ensure text stays dark on hover */
[data-theme="light"] .folder-header:hover {
    background: var(--primary-light);
    color: var(--text-primary);  /* Keep dark text */
}

[data-theme="light"] .folder-header:hover .folder-icon {
    color: var(--primary-dark);  /* Darker icon color */
}

[data-theme="light"] .chapter-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);  /* Keep dark text */
}



/* Dark mode adjustments */
[data-theme="dark"] .folder-header {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .folder-header:hover {
    background: var(--primary-dark);
    border-color: var(--primary);
}

[data-theme="dark"] .folder-contents .chapter-item {
    background: var(--bg-tertiary);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .folder-contents {
        padding-left: 1rem;
    }
    
    .folder-header {
        padding: 0.625rem;
    }
    
    .folder-name {
        font-size: 0.875rem;
    }
}

/* Animation for folder toggle */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.folder-contents {
    animation: slideDown 0.3s ease;
}

/* Indentation for nested structure */
.folder-contents .folder-contents {
    padding-left: 1rem;
}

/* Visual hierarchy with colors */
.folder-section > .folder-header {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
}

.folder-contents .folder-section > .folder-header {
    background: var(--bg-secondary);
}

/* ============================================
   RESOURCES MENU STYLES
   ============================================ */

/* Resources button in sidebar */
.resources-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.resources-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Resources overlay */
.resources-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

/* Resources menu container */
.resources-menu {
    background: var(--bg-elevated);
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: var(--shadow-xl);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.4s ease;
}

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

/* Close button */
.close-menu-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.close-menu-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Menu header */
.resources-menu h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.resources-menu > p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Resources grid */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Resource card */
.resource-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 1rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

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

/* Resource icon */
.resource-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-light);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--primary);
}

.resource-icon .icon {
    width: 30px;
    height: 30px;
}

/* Resource content */
.resource-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.resource-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Resource badge */
.resource-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--success);
    color: white;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Coming soon state */
.resource-card.coming-soon {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.resource-card.coming-soon .resource-badge {
    background: var(--text-tertiary);
}

/* Resources footer */
.resources-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.resources-footer p {
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

/* Dark mode adjustments */
[data-theme="dark"] .resources-menu {
    background: var(--bg-elevated);
}

[data-theme="dark"] .resource-card {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .resource-icon {
    background: rgba(99, 102, 241, 0.2);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .resources-menu {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .resources-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .resources-menu h2 {
        font-size: 1.5rem;
    }
}

/* Smooth transitions */
.resources-overlay * {
    transition: all 0.3s ease;
}