/* =========================================
   1. VARIABLES & RESET (The "Nebula Pro" Palette)
   ========================================= */
:root {
    /* Colors */
    --bg-void: #000000;
    /* Instagram Black */
    --bg-glass: rgba(15, 15, 20, 0.65);
    /* Frosted Sidebar/Header */
    --bg-card: rgba(30, 30, 35, 0.4);
    /* Card Background */
    --bg-card-hover: rgba(40, 40, 50, 0.6);

    --primary-blue: #3b82f6;
    /* Laser Blue (Action Buttons) */
    --primary-glow: rgba(59, 130, 246, 0.5);
    /* Glowing effects */
    --accent-purple: #8b5cf6;
    /* Secondary Accent */

    --text-main: #e4e4e7;
    /* Starlight White */
    --text-muted: #a1a1aa;
    /* Dust Gray */

    --border-glass: 1px solid rgba(255, 255, 255, 0.06);
    --border-highlight: 1px solid rgba(255, 255, 255, 0.15);

    /* Dimensions */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 70px;
}

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

html {
    background-color: var(--bg-void);
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    /* Prevent horizontal scroll at root level */
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-void);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    height: 100vh;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    /* Prevents full page scroll, we scroll inside containers */
    /* Ensure content doesn't get hidden behind notches in standalone mode */
    padding-top: env(safe-area-inset-top);
    margin: 0;
    padding: 0;
}

/* Custom Scrollbar (Dark Mode) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* =========================================
   2. UTILITY CLASSES (Glassmorphism)
   ========================================= */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: var(--border-glass);
}

/* The Cards used in Dashboard */
.glass-card {
    background: var(--bg-card);
    border: var(--border-glass);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    overflow: hidden;
    /* Keeps images inside rounded corners */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.glass-card:hover {
    transform: translateY(-5px) scale(1.01);
    background: var(--bg-card-hover);
    border: var(--border-highlight);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(59, 130, 246, 0.3);
}

/* =========================================
   3. APP SHELL LAYOUT (Sidebar + Main)
   ========================================= */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* --- Sidebar Styles --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100%;
    border-right: var(--border-glass);
    display: flex;
    flex-direction: column;
    padding: 20px;
    flex-shrink: 0;
    /* Prevents shrinking */
    z-index: 50;
    box-shadow: 5px 0 30px rgba(0, 0, 0, 0.2);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-purple));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    /* Pushes profile to bottom */
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.25s ease;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: white;
    transform: translateX(4px);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-blue);
}

.nav-item i {
    font-size: 1.5rem;
    width: 24px;
    /* Ensure consistent alignment */
}

.nav-item svg {
    width: 24px;
    height: 24px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 15px;
    border-top: var(--border-glass);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(to right, #8b5cf6, #3b82f6);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* --- Main Content Area --- */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Important for inner scrolling */
    position: relative;
    background-color: var(--bg-void);
    /* Ensure consistent background */
}

/* Header */
.top-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    flex-shrink: 0;
}

#courseViewTitleHeader {
    font-size: 1.25rem;
    font-weight: 700 !important;
    color: #ffffff;
    text-align: center;
    flex-grow: 1;
    margin: 0 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

/* Search Bar */
.search-bar {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 20px;
    border-radius: 12px;
    color: white;
    width: 320px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.search-bar:focus {
    border-color: var(--primary-blue);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* =========================================
   4. DASHBOARD COMPONENTS
   ========================================= */
.dashboard-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
}

/* Center the lineage container within the scrollable area */
.lineage-container {
    max-width: 540px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px 60px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.app-card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.app-card-content h3,
.app-card-content h4 {
    color: white;
    margin-bottom: 8px;
}

.app-card-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
    flex-grow: 1;
}

/* =========================================
   5. BUTTONS
   ========================================= */
.btn-primary {
    background: var(--primary-blue);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.5);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    border: var(--border-glass);
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-glass:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-1px);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.2rem;
    transition: all 0.2s;
    background: none;
    border: none;
    cursor: pointer;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* =========================================
   6. EDITOR LAYOUT (Specific to XtraAnim)
   ========================================= */
.editor-layout {
    display: flex;
    flex: 1;
    /* Take remaining height */
    overflow: hidden;
}

/* Studio Specific Layout (Moved from HTML) */
.workspace {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    height: 100vh;
    overflow: hidden;
    background: #050505;
}

.studio-header {
    height: 60px;
    background: #0f0f12;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    z-index: 20;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 15px;
    height: 100%;
}

.divider-vertical {
    height: 24px;
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.studio-footer {
    height: 30px;
    background: #18181b;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    font-size: 0.75rem;
    color: #a1a1aa;
    font-family: system-ui, sans-serif;
    flex-shrink: 0;
    z-index: 20;
}

.editor-panels {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

.code-area {
    flex: 1;
    background: #08080a;
    /* Deep code background */
    border-right: var(--border-glass);
    display: flex;
    flex-direction: row;
    /* Align line numbers and editor side-by-side */
}

.line-numbers {
    width: 45px;
    background: #0c0c0e;
    color: #555;
    text-align: right;
    padding: 20px 8px 20px 0;
    font-family: 'Fira Code', 'JetBrains Mono', 'Source Code Pro', monospace !important;
    font-size: 14px !important;
    line-height: 21px !important;
    overflow: hidden;
    /* Scroll is synced via JS */
    border-right: 1px solid #222;
    user-select: none;
}

.editor-container {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Shared styles for both layers to ensure perfect alignment */
.code-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 20px !important;
    /* Force match textarea padding */
    border: none;
    font-family: 'Fira Code', 'JetBrains Mono', 'Source Code Pro', monospace !important;
    font-size: 14px !important;
    line-height: 21px !important;
    letter-spacing: normal;
    tab-size: 4;
    -moz-tab-size: 4;
    font-variant-ligatures: none;
    resize: none;
    outline: none;
    white-space: pre;
    /* Horizontal scrolling for code */
    overflow: auto;
}

/* Top Layer: Transparent Textarea for Input */
.code-input {
    z-index: 1;
    color: transparent;
    background: transparent;
    caret-color: #e4e4e7;
    /* White cursor */
}

/* Fix selection visibility for transparent text */
.code-input::selection {
    background: rgba(59, 130, 246, 0.3);
    color: transparent;
}

.preview-area {
    width: 45%;
    background: black;
    display: flex;
    flex-direction: column;
    border-left: var(--border-glass);
    margin-right: 20px;
}

/* Bottom Layer: Syntax Highlighting */
#highlighting {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 20px !important;
    border: none;
    font-family: 'Fira Code', 'JetBrains Mono', 'Source Code Pro', monospace !important;
    font-size: 14px !important;
    line-height: 21px !important;
    letter-spacing: normal;
    tab-size: 4;
    -moz-tab-size: 4;
    font-variant-ligatures: none;
    z-index: 0;
    color: #a1a1aa;
    pointer-events: none;
    /* Let clicks pass through to textarea */
    background: #08080a;
    white-space: pre;
    overflow: hidden;
    /* Scroll is synced via JS */
}

/* Ensure code element inside pre has no offsets */
#highlighting code {
    margin: 0 !important;
    padding: 0 !important;
}

/* Override Prism defaults to match our container */
code[class*="language-"],
pre[class*="language-"] {
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    text-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
}

/* =========================================
   7. AUTH PAGES (Login/Signup)
   ========================================= */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100%;
}

.auth-box {
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.auth-form input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: var(--border-glass);
    padding: 14px;
    border-radius: 10px;
    color: white;
    margin-bottom: 16px;
    outline: none;
    transition: all 0.2s;
}

.auth-form input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* =========================================
   9. MOBILE BOTTOM NAVIGATION (PWA)
   ========================================= */
.bottom-nav {
    display: none;
    /* Hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background: rgba(20, 20, 25, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: var(--border-glass);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding-bottom: calc(env(safe-area-inset-bottom) + 5px);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    gap: 4px;
    width: 100%;
    height: 100%;
    padding-top: 5px;
    /* Add consistent top padding to all items */
}

.bottom-nav-item.active {
    color: var(--primary-blue);
    /* Active color is already good */
}

.bottom-nav-icon {
    font-size: 28px;
    /* Normalize icon size to match SVG */
    line-height: 1;
    /* Ensure no extra line height for i tags */
}

.bottom-nav-icon svg {
    width: 28px;
    height: 28px;
    vertical-align: middle;
    /* Helps with SVG alignment */
}

/* Special style for the Studio (+) button */
.bottom-nav-item:nth-child(3) .bottom-nav-icon {
    background: transparent;
    /* Remove the background circle */
    border-radius: 0;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    /* Match other icons */
    transition: background-color 0.2s;
}

.bottom-nav-item:nth-child(3) .bottom-nav-icon i {
    font-size: 2rem;
    /* Reduced size */
    font-weight: bold;
    /* Make the '+' bolder */
}

.bottom-nav-item:nth-child(3):hover .bottom-nav-icon {
    background: rgba(255, 255, 255, 0.2);
}

/* =========================================
   10. RESPONSIVE MEDIA QUERIES
   ========================================= */

/* Tablet (Portrait) & Mobile */
@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    /* Profile Grid Tablet Adjustment */
    .profile-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* Mobile Devices */
@media (max-width: 768px) {

    /* 1. FORCE NATIVE SCROLLING */
    body {
        overflow: hidden !important;
        /* Prevents full page scroll, we scroll inside containers */
        height: 100vh !important;
        min-height: 100vh !important;
        padding-bottom: 0 !important;
        /* Remove body padding, handled by main-content */
    }

    .app-container {
        flex-direction: column;
        height: 100% !important;
        /* Fill available height */
        overflow-y: hidden !important;
        /* Let main-content handle scroll */
        width: 100%;
        max-width: 100vw;
        /* Ensure container never exceeds viewport */
        display: flex;
        /* Keep flex for app-container */
    }

    .workspace {
        height: auto !important;
        overflow: visible !important;
        display: block;
    }

    /* Ensure workspace-panel is correctly styled for mobile tabs */
    .workspace-panel {
        padding-bottom: 0 !important;
        /* Let main-content handle padding */
    }

    /* Studio Workspace Exception: Fixed App Layout */
    body:has(.studio-header) .workspace,
    .workspace.studio-mode {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100% !important;
        width: 100% !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column;
        z-index: 50;
        background: #050505;
        padding-bottom: 0 !important;
        /* Override main content padding */
    }

    .sidebar {
        display: none;
        /* Hide sidebar completely on mobile */
    }

    .bottom-nav {
        display: flex;
        /* Show bottom nav */
    }

    .main-content {
        flex-grow: 1;
        /* Fill remaining space */
        overflow-y: auto !important;
        /* Make main-content scrollable */
        -webkit-overflow-scrolling: touch;
        /* Smooth scrolling on iOS */
        padding-bottom: 85px !important;
        /* Apply consistent padding here */
        overflow-x: hidden !important;
        width: 100%;
        display: flex;
        /* Keep flex for main-content */
        flex-direction: column;
        /* Stack children vertically */
        background-color: var(--bg-void);
    }

    .store-container {
        padding: 15px;
        /* Reduce side padding on mobile */
        flex-grow: 1;
        padding-bottom: 0 !important;
        /* Let main-content handle padding */
    }

    .top-header {
        /* This header is inside main-content */
        padding: 0 16px;
        height: 56px;
        min-height: 56px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        flex-wrap: nowrap;
        background: rgba(10, 10, 10, 0.88);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        position: sticky;
        top: 0;
        z-index: 100;
    }

    /* --- NEW: Store Header Mobile Layout --- */
    #storeHeader {
        justify-content: space-between;
        z-index: 100;
        /* Ensure above editor content */
        background: rgba(5, 5, 5, 0.95);
        /* Ensure text is readable over content */
        backdrop-filter: blur(12px);
    }

    .search-bar {
        /* Make search bar visible and flexible on mobile */
        flex-grow: 0;
        /* Prevent the search bar from expanding to fill space */
        width: 200px;
        /* Set a more reasonable, fixed width for mobile */
        min-width: 80px;
        padding: 8px 15px;
        font-size: 0.85rem;
    }

    /* Hide Logo on mobile to save space for controls */
    .logo-area {
        display: none;
    }

    .editor-layout,
    .editor-panels {
        display: flex;
        flex-direction: column;
        flex: 1;
        /* Take remaining height */
        height: 100% !important;
        overflow: hidden !important;
        padding-bottom: 0;
    }

    /* Mobile Studio: Show Tabs, Hide Toolbar initially */
    .mobile-studio-nav {
        display: block !important;
    }

    .mobile-code-toolbar {
        display: flex !important;
    }

    /* Active State for Mobile Tabs */
    /* Handled via inline styles in JS or specific classes */

    /* Fix Dashboard Scroll on Mobile */
    .dashboard-scroll {
        overflow: visible !important;
        padding: 15px;
        padding-bottom: 0 !important;
        /* Let main-content handle padding */
        flex-grow: 1;
    }

    /* Hide desktop-specific elements */
    .line-numbers {
        display: none;
        /* Save space on mobile */
    }

    /* Specific overrides for containers that are direct children of main-content */
    .insta-container {
        flex-grow: 1;
        padding-bottom: 0 !important;
        /* Let main-content handle padding */
    }

    .feed-container {
        padding-bottom: 0 !important;
        /* Let main-content handle padding */
    }

    /* Adjust editor padding and font for mobile */
    .code-input,
    #highlighting {
        padding: 15px !important;
        padding-bottom: 60px !important;
        /* Space for toolbar */
        font-size: 16px !important;
        /* Prevents iOS zoom */
        line-height: 24px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Mobile Editor: Disable Highlighting Overlay for Stability & Visibility */
    .code-input,
    #code {
        color: var(--text-main) !important;
        /* Make text visible */
        background: #0d0d0d !important;
        position: relative !important;
        /* Reset absolute positioning */
        height: 100% !important;
        overflow-y: auto !important;
        /* Enable scroll on textarea */
        opacity: 1 !important;
        visibility: visible !important;
        display: block !important;
        z-index: 10 !important;
        /* Ensure on top */
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    #highlighting {
        display: none !important;
        /* Hide highlighting layer on mobile */
    }

    /* Studio Header Mobile Fixes */
    .studio-header {
        height: auto;
        flex: none;
        /* Don't shrink */
        padding: 0;
        flex-direction: row;
        align-items: center;
        position: relative;
        /* Not sticky, part of flex layout */
        overflow: visible;
        gap: 0;
    }

    .studio-header::-webkit-scrollbar {
        display: none;
    }

    .toolbar-group {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    /* Hide Desktop Elements */
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    /* Make toolbar groups scrollable horizontally */
    .studio-header>div {
        justify-content: flex-start;
    }

    /* Ensure space-between works on mobile header */
    .studio-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .studio-header {
        padding: 0 10px;
        /* Less padding on mobile */
    }

    /* Hide non-essential items on mobile */
    .studio-header input[type="text"],
    .studio-header #engineLabel,
    .studio-header .divider-vertical {
        display: none;
    }

    /* Compact Header Buttons */
    .top-header button,
    .top-header .btn-glass,
    .top-header .btn-primary {
        flex: initial;
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    /* --- NEW: Store Cart Icon Size for Mobile --- */
    .store-cart-btn {
        font-size: 2.8rem !important;
        /* Make it larger and override general button styles */
        width: 56px;
        /* Ensure it's tappable */
        height: 56px;
    }

    /* 5. FLOATING PLAY BUTTON */
    #renderBtn,
    #recordBtn {
        position: fixed;
        bottom: 20px;
        /* Bottom right corner */
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--primary-blue);
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.6);
        z-index: 999;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 0 !important;
        /* Hide text label */
        border: 2px solid rgba(255, 255, 255, 0.2);
        transition: transform 0.2s;
    }

    #renderBtn span,
    #recordBtn span {
        font-size: 1.5rem !important;
        margin: 0 !important;
        display: block;
    }

    #renderBtn:active {
        transform: scale(0.9);
    }

    /* --- PROFILE PAGE MOBILE --- */
    .profile-header {
        flex-direction: column;
        text-align: center;
        padding: 20px 10px;
        gap: 15px;
    }

    .profile-info {
        width: 100%;
        align-items: center;
    }

    .profile-stats {
        justify-content: center;
        width: 100%;
        gap: 20px;
        margin-top: 10px;
    }

    .profile-tabs {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 0 10px 10px 10px;
        -webkit-overflow-scrolling: touch;
        gap: 20px;
    }

    .grid-container,
    .profile-grid {
        grid-template-columns: 1fr;
        /* Force single column stack */
        gap: 20px;
        padding: 15px;
        padding-bottom: 40px;
    }

    /* --- XTRABOOK MOBILE (Horizontal Chapter List) --- */
    #chapterList {
        width: 100%;
        height: auto;
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: var(--border-glass);
        padding: 10px;
        gap: 10px;
        background: rgba(0, 0, 0, 0.2);
        white-space: nowrap;
        /* Ensure items stay in line */
    }

    .chapter-item {
        min-width: 140px;
        justify-content: center;
        background: rgba(255, 255, 255, 0.05);
        margin-bottom: 0;
    }
}

/* Fade In Animation for Pages */
body {
    animation: fadeInPage 0.5s ease-out;
}

@keyframes fadeInPage {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Loading Spinner (for AJAX requests later) */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Toggle Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}

input:checked+.slider:before {
    transform: translateX(18px);
}

/* =========================================
   11. NEW ADVANCED UI CLASSES (Refactoring JS)
   ========================================= */

/* Header Profile Dropdown */
.auth-header-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* =========================================
   17. EMBED MODAL (REFACTORED)
   ========================================= */
.embed-modal-overlay {
    padding: 20px;
}

.embed-modal-content {
    width: 95vw;
    max-width: 1000px;
    height: 90vh;
    background: var(--bg-card);
    border: var(--border-glass);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.embed-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: var(--border-glass);
    flex-shrink: 0;
}

.embed-modal-header h3 {
    color: white;
    font-size: 1.2rem;
    margin: 0;
}

#closeEmbedModal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

#closeEmbedModal:hover {
    color: white;
}

/* This is the container for the new single-pane body */
.embed-modal-content>div:not(.embed-modal-header) {
    flex-grow: 1;
    display: flex;
    overflow: hidden;
}

/* This is the new single-pane body I'm creating with JS */
.embed-selection-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

/* Search Input Wrapper */
.embed-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.embed-search-wrapper i {
    position: absolute;
    left: 15px;
    color: var(--text-muted);
    font-size: 1.2rem;
    pointer-events: none;
}

#embedSearchInput {
    background: rgba(0, 0, 0, 0.3);
    border: var(--border-glass);
    border-radius: 10px;
    padding: 12px 12px 12px 45px;
    width: 100%;
    color: white;
    outline: none;
    font-size: 1rem;
}

#embedSearchInput:focus {
    border-color: var(--primary-blue);
}

.embed-category-tabs {
    flex-wrap: wrap;
    flex-shrink: 0;
}

.embed-tab {
    white-space: nowrap;
}

#embedGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    overflow-y: auto;
    flex-grow: 1;
    margin-top: 15px;
    padding: 5px;
}

.embed-grid-item {
    aspect-ratio: 9 / 16;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    background: #111;
}

.embed-grid-item:hover {
    transform: scale(1.03);
}

.embed-grid-item.selected {
    border-color: var(--primary-blue);
    box-shadow: 0 0 15px var(--primary-glow);
}

.embed-grid-item .title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: white;
    padding: 15px 8px 8px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile Layout Fix */
@media (max-width: 768px) {
    .embed-modal-overlay {
        padding: 0;
    }

    .embed-modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .embed-selection-area {
        padding: 15px;
    }

    #embedGrid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 10px;
    }

    .embed-modal-header {
        padding: 10px 15px;
    }
}

.mode-switch-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 20px;
    border: var(--border-glass);
}

.profile-menu-trigger {
    cursor: pointer;
    width: 42px;
    height: 42px;
    transition: transform 0.2s;
}

.profile-menu-trigger:hover {
    transform: scale(1.05);
}

.profile-dropdown-menu {
    position: absolute;
    top: 60px;
    right: 0;
    width: 280px;
    display: none;
    z-index: 1000;
    padding: 0;
    border: var(--border-highlight);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.2s ease-out;
}

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

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

/* Video Grid Posts */
.post-thumbnail {
    width: 100%;
    height: 100%;
    min-height: 160px;
    background: linear-gradient(135deg, #1e1e2e, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: transform 0.3s;
}

.grid-post:hover .post-thumbnail {
    transform: scale(1.05);
}

.post-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    backdrop-filter: blur(4px);
}

/* PDF Preview Container */
.pdf-preview-container {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

/* =========================================
   12. ICON UTILITIES (Remix Icon Support)
   ========================================= */
i[class^="ri-"] {
    vertical-align: middle;
    line-height: 1;
}

.spin {
    animation: spin 1s linear infinite;
}

/* Heart 'Pop' Animation for Likes */
@keyframes heart-pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4) rotate(5deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

.post-actions .icon-btn.liked i {
    color: #ef4444;
    /* Red-500 for liked */
}

.post-actions .icon-btn.liked.popping i {
    animation: heart-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Sizing for custom SVG icons in action bars */
.post-actions .icon-btn svg {
    width: 24px;
    height: 24px;
}

/* =========================================
   13. INSTAGRAM THEME (Profile & Explore)
   ========================================= */

.insta-container {
    max-width: 935px;
    margin: 0 auto;
    padding: 30px 20px;
    width: 100%;
}

/* Profile Header */
.insta-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 44px;
}

.insta-avatar-container {
    margin-right: 0;
    flex-shrink: 0;
}

.insta-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #333, #555);
    padding: 2px;
    background-clip: content-box;
    border: 2px solid transparent;
    /* Placeholder for story ring */
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.insta-stats-container {
    flex: 1;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.insta-stat {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.insta-stat strong {
    font-weight: 600;
    color: white;
    font-size: 1.1rem;
    display: block;
}

/* Bio Section */
.insta-bio-section {
    margin-bottom: 15px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.insta-handle {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
}

/* Actions Section */
.profile-actions {
    display: flex;
    gap: 8px;
    width: 100%;
}

.btn-profile-action {
    flex: 1;
    font-weight: 600;
    padding: 8px 0;
    text-align: center;
    justify-content: center;
}

.btn-share-profile {
    display: block;
}

/* Tabs */
.insta-tabs {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-bottom: 10px;
}

.insta-tab {
    height: 52px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #a1a1aa;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    border-top: 1px solid transparent;
    margin-top: -1px;
    transition: color 0.2s;
}

.insta-tab.active {
    color: white;
    border-top: 1px solid white;
}

.insta-tab i {
    font-size: 12px;
}

/* The Grid */
.insta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    padding-bottom: 40px;
}

/* --- MOBILE RESPONSIVENESS FOR INSTAGRAM THEME --- */
@media (max-width: 768px) {
    .insta-container {
        padding: 0;
        /* Keep side padding at 0 */
        margin: 0;
        max-width: none;
        /* Remove restriction */
        width: 100%;
    }

    .insta-header {
        padding: 16px;
        margin-bottom: 0;
    }

    /* The rest of the mobile styles (tabs, grid) remain valid */

    .insta-tabs {
        justify-content: space-around;
        gap: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .insta-tab {
        flex: 1;
        justify-content: center;
        height: 44px;
    }

    .insta-tab span {
        display: none;
    }

    .insta-tab i {
        font-size: 1.5rem;
    }

    .insta-tab.active {
        border-top: 1px solid white;
        color: white;
    }

    .insta-grid {
        gap: 2px;
    }
}

/* Container for the top row */
.profile-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 0;
    /* matches IG spacing */
}

/* Shrink the Avatar to IG size */
.profile-pic {
    width: 80px;
    /* This shrinks the huge circle! */
    height: 80px;
    border-radius: 50%;
    background-color: #555;
    /* Just for your placeholder */
    flex-shrink: 0;
    /* Prevents the circle from squishing into an oval */
}

/* Spread the stats out evenly */
.stats-container {
    display: flex;
    flex: 1;
    justify-content: space-evenly;
    /* Spaces the 3 columns perfectly */
    margin-left: 20px;
}

/* Stack the number on top of the word */
.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Style the numbers and text */
.stat-number {
    font-weight: 700;
    font-size: 16px;
    color: white;
    /* Adjust to your theme */
}

.stat-label {
    font-size: 13px;
    font-weight: 400;
    color: white;
    /* Adjust to your theme */
}

.highlights-row::-webkit-scrollbar {
    display: none;
}

/* =========================================
   14. CREATE CHOICE MODAL
   ========================================= */
.create-choice-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeInPage 0.3s ease-out;
}

.create-choice-modal {
    width: 100%;
    max-width: 420px;
    padding: 30px;
}

.create-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.create-choice-btn,
button.create-choice-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.create-choice-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-blue);
    color: white;
    transform: translateY(-5px);
}

.create-choice-btn i {
    font-size: 2.5rem;
    color: var(--primary-blue);
}

/* =========================================
   15. LINEAGE / VERTICAL THREAD VIEW
   ========================================= */
.lineage-header {
    padding: 0 10px 30px 10px;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.lineage-header h1 {
    color: white;
    margin-bottom: 10px;
}

.lineage-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

.lineage-thread-item {
    display: flex;
    position: relative;
}

.lineage-avatar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 20px;
    flex-shrink: 0;
}

.lineage-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    z-index: 2;
}

.lineage-thread-line {
    width: 2px;
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.25);
    /* A more visible light grey */
}

/* Hide the line on the last item */
.lineage-thread-item:last-child .lineage-thread-line {
    display: none;
}

.lineage-content-col {
    padding-bottom: 25px;
    /* Space between cards */
    flex-grow: 1;
}

.lineage-card {
    background: #09090b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    width: 100%;
    max-width: 280px;
    aspect-ratio: 9 / 14;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.lineage-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7), 0 0 30px rgba(59, 130, 246, 0.3);
}

.lineage-card.original-post {
    border-color: var(--primary-blue);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
}

.lineage-card video,
.lineage-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 17px;
}

/* =========================================
   18. ARTICLE MERMAID EMBED
   ========================================= */
.mermaid-container {
    background: #1a1a1a;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    margin: 2em auto;
    max-width: 700px;
    overflow: hidden;
    padding: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.mermaid-code {
    width: 100%;
    min-height: 120px;
    background: #0e0e0e;
    border: 1px solid #333;
    color: #a9b7c6;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    padding: 15px;
    resize: vertical;
    outline: none;
    border-radius: 8px;
    margin-bottom: 15px;
}

.mermaid-output {
    padding: 20px;
    background: #1e1e23;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 150px;
    color: var(--text-muted);
}

.mermaid-output svg {
    max-width: 100%;
    height: auto;
}

.mermaid-error {
    color: #ef4444;
    white-space: pre-wrap;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    text-align: left;
    width: 100%;
}

/* Styles for Mermaid blocks when viewed in a published article */
.mermaid-container.mermaid-view-mode {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.mermaid-container.mermaid-view-mode .mermaid-code {
    display: none;
    /* This is the crucial part: hide the editor box */
}

.mermaid-container.mermaid-view-mode .mermaid-output {
    min-height: auto;
    /* Let the diagram determine the height */
    padding: 20px;
    /* Keep some padding around the diagram */
    background: #1e1e23;
    /* Keep the dark background for the diagram itself */
}

/* FIX: Ensure the rendered SVG is visible in view mode */
.mermaid-container.mermaid-view-mode .mermaid-output svg {
    max-width: 100%;
    height: auto;
    display: block;
}

/* =========================================
   18.1. ARTICLE KATEX EMBED
   ========================================= */
.katex-container {
    background: #1a1a1a;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    margin: 2em auto;
    max-width: 700px;
    overflow: hidden;
    padding: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.katex-code {
    width: 100%;
    min-height: 100px;
    background: #0e0e0e;
    border: 1px solid #333;
    color: #a9b7c6;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    padding: 15px;
    resize: vertical;
    outline: none;
    border-radius: 8px;
    margin-bottom: 15px;
    box-sizing: border-box;
}

.katex-output {
    padding: 20px;
    background: #18181b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
    color: white;
    font-size: 1.3em;
    overflow-x: auto;
}

.katex-error {
    color: #ef4444;
    white-space: pre-wrap;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    text-align: left;
    width: 100%;
}

/* Styles for KaTeX blocks when viewed in a published article */
.katex-container.katex-view-mode {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.article-view-body .katex-code,
.article-view-body .mermaid-code,
.katex-container.katex-view-mode .katex-code {
    display: none !important;
}

.katex-container.katex-view-mode .katex-output {
    min-height: auto;
    padding: 16px 20px;
    background: #18181b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

/* =========================================
   19. XTRACOURSE STUDIO
   ========================================= */
.course-studio-layout {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.pipeline-panel {
    width: 55%;
    max-width: 700px;
    background: #0a0a0a;
    border-right: var(--border-glass);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pipeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: var(--border-glass);
    flex-shrink: 0;
}

.pipeline-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 30px;
}

.course-title-input {
    font-size: 2rem;
    font-weight: 700;
    background: transparent;
    border: none;
    color: white;
    outline: none;
    width: 100%;
    padding: 5px 0;
    margin-bottom: 10px;
}

.course-meta-group {
    margin-bottom: 25px;
}

.course-description-editor {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-muted);
    outline: none;
    min-height: 80px;
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.2s, border-color 0.2s;
    border: 1px solid transparent;
}

.course-description-editor:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.course-description-editor:focus {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-glass);
}

.course-description-editor:empty:before {
    content: attr(placeholder);
    color: #555;
    cursor: text;
}

.pipeline-step-group {
    display: flex;
    gap: 20px;
    margin: 25px 0;
}

.pipeline-step-group.horizontal {
    gap: 15px;
    margin: 15px 0 5px 0;
}

.pipeline-step {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.pipeline-step:hover {
    background: rgba(255, 255, 255, 0.05);
}

.step-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #27272a;
    border: 2px solid #3f3f46;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #a1a1aa;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
    /* Prevent the icon container from being squashed by its flex parent. */
}

.pipeline-step.complete .step-icon {
    background: var(--primary-blue);
    border-color: #60a5fa;
    color: white;
}

.step-icon i {
    /* Prevents the icon font from being distorted/stretched inside its flex container. */
    flex-shrink: 0;
    /* This is a robust way to center the icon glyph itself (which lives in a pseudo-element)
       and prevent it from being stretched or distorted by parent flex properties. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.step-icon .checkmark {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #10b981;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0a0a0a;
}

.step-label {
    font-weight: 500;
    color: var(--text-muted);
}

.pipeline-step.complete .step-label {
    color: var(--text-main);
}

.optional-badge {
    font-size: 0.7rem;
    background: #3f3f46;
    color: #a1a1aa;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.pipeline-divider {
    text-align: center;
    margin: 40px 0 20px 0;
    border-bottom: 1px solid #27272a;
    line-height: 0.1em;
}

.pipeline-divider span {
    background: #0a0a0a;
    padding: 0 10px;
    color: #a1a1aa;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.section-card {
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.section-title-input {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    outline: none;
    width: 100%;
}

.add-lesson-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.add-lesson-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.lesson-card {
    background: #0a0a0a;
    border: 1px solid #27272a;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.lesson-card.selected {
    border-color: var(--primary-blue);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.lesson-title-input {
    background: transparent;
    border: none;
    color: #e4e4e7;
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    width: 100%;
    margin-bottom: 5px;
    padding: 4px;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.lesson-title-input:hover {
    background: rgba(255, 255, 255, 0.05);
}

.lesson-title-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-glass);
}

.preview-panel {
    flex: 1;
    background: #000;
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: none;
    /* This header is redundant as the preview cards have their own headers. */
}

.preview-content {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
}

/* Ensure preview content has a background */
.preview-panel .preview-content {
    background: #0a0d14;
    /* Dark background for the preview area */
}

/* Styles for the live course preview */
.preview-content .feed-post {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.preview-content .feed-post .post-media {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-content .feed-post .post-media img,
.preview-content .feed-post .post-media video,
.preview-content .feed-post .post-media iframe {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    /* Ensure the entire media is visible */
}

/* Add general styles for mobile tabs, similar to xtraAnim.html */
.mobile-tabs {
    display: none;
    /* Hidden by default on desktop */
    background: #1a1a1a;
    margin: 0;
    border-bottom: 1px solid #222;
    flex-shrink: 0;
}

.mobile-tabs button {
    flex: 1;
    padding: 12px;
    background: #0a0a0a;
    /* Default inactive background */
    color: #888;
    /* Default inactive text color */
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-tabs button.active {
    background: #111;
    /* Active background */
    color: white;
    /* Active text color */
    border-bottom: 2px solid var(--primary-blue);
    /* Active border */
}

/* Add to the mobile media query section */
@media (max-width: 768px) {
    /* ... existing mobile styles ... */

    .main-content.studio-mode {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100% !important;
        width: 100% !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column;
        z-index: 50;
        background: #0a0a0a;
        padding: 0 !important;
    }

    /* Course Studio Mobile Layout */
    .course-studio-layout {
        flex-direction: column;
        flex-grow: 1;
        /* Fill space under tabs */
        overflow: hidden !important;
    }

    .pipeline-panel,
    .preview-panel {
        width: 100% !important;
        /* Full width on mobile */
        max-width: none !important;
        /* Remove max-width constraint */
        border-right: none !important;
        /* Remove right border */
        height: 100% !important;
        /* Take full height of its parent (workspace-panel) */
        overflow-y: auto;
        /* Allow scrolling within the panel */
    }

    .mobile-tabs {
        display: flex !important;
        /* Show mobile tabs */
        justify-content: space-around;
        align-items: center;
    }

    .mobile-nav-btn.active {
        background: #27272a;
        /* Active tab background */
        /* This rule is for xtraAnim, not relevant here */
        color: white;
        /* This rule is for xtraAnim, not relevant here */
    }

    /* NEW: Course Studio Mobile UI Improvements */
    .pipeline-header {
        padding: 10px 15px;
        /* More compact header */
    }

    .pipeline-content {
        padding: 20px 15px 100px;
        /* Less padding on mobile, with 100px at the bottom for nav bar */
    }

    .course-title-input {
        font-size: 1.6rem;
        /* Smaller title */
    }

    .course-description-editor {
        font-size: 0.95rem;
        min-height: 60px;
    }

    /* Make main course steps (cover, intro) more compact */
    #course-meta-steps .pipeline-step-group {
        gap: 15px;
    }

    #course-meta-steps .step-icon {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }

    #course-meta-steps .step-icon .checkmark {
        width: 18px;
        height: 18px;
        font-size: 0.9rem;
    }

    /* Stack lesson steps vertically to save horizontal space */
    .lesson-card .pipeline-step-group.horizontal {
        justify-content: space-around;
        /* Evenly space the stacked items */
        align-items: flex-start;
        margin-top: 20px;
    }

    .lesson-card .pipeline-step {
        flex-direction: column;
        /* Stack icon and label */
        gap: 8px;
        padding: 0;
        align-items: center;
        width: 80px;
        /* Give a consistent width */
        text-align: center;
        /* Center label text if it wraps */
    }

    .lesson-card .step-icon {
        width: 40px;
        /* Smaller icon for lessons */
        height: 40px;
        font-size: 1.2rem;
    }

    .lesson-card .step-label {
        font-size: 0.7rem;
        /* Smaller label */
        text-align: center;
        line-height: 1.2;
        font-weight: 400;
        /* Ensure labels have a consistent height to align items, even if text wraps. */
        min-height: 2.5em;
        /* Approx 2 lines of text */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .lesson-card .optional-badge {
        display: none;
        /* Hide "Optional" text to save space */
    }

    .section-card {
        padding: 15px;
    }

    .lesson-card {
        padding: 15px 10px;
    }

    .section-title-input {
        font-size: 1.1rem;
    }

    .add-lesson-btn {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
}

.lesson-preview-card {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1 / 1.15;
    margin: auto;
    background: #18181b;
    border-radius: 20px;
    border: 1px solid var(--border-glass);
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.lesson-preview-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.lesson-preview-type {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-blue);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    display: block;
}

.lesson-preview-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0;
    line-height: 1.3;
}

.lesson-preview-content {
    width: 100%;
    background: #000;
    flex-grow: 1;
    /* Allow main content to take up available space */
    min-height: 0;
    /* Prevent flexbox overflow */
    position: relative;
}

.lesson-preview-content img,
.lesson-preview-content video,
.lesson-preview-content iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lesson-supporting-content-wrapper {
    flex-shrink: 0;
    /* Prevent this from shrinking */
    padding: 15px 20px;
    border-top: 1px solid var(--border-glass);
    background: #111114;
}

.supporting-content-header {
    font-size: 0.8rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.lesson-supporting-content {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 5px;
    /* For scrollbar */
}

.supporting-material-icon {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.supporting-material-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
}

.material-icon-box {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background: #27272a;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.supporting-material-icon:hover .material-icon-box {
    background: var(--primary-blue);
    color: white;
}

.material-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.supporting-material-icon.not-found .material-icon-box {
    background: #452323;
    color: #ef4444;
}

.supporting-material-icon.not-found .material-title {
    color: var(--text-muted);
}

.course-overview-card {
    width: 100%;
    max-width: 450px;
    margin: auto;
    background: #18181b;
    border-radius: 20px;
    border: 1px solid var(--border-glass);
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.course-overview-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    position: relative;
    border-bottom: 1px solid var(--border-glass);
}

.course-overview-cover .feed-post,
.course-overview-cover .post-media {
    width: 100%;
    height: 100%;
}

.course-overview-cover img,
.course-overview-cover video,
.course-overview-cover iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.overview-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    background: #111;
}

.overview-cover-placeholder i {
    font-size: 2rem;
}

.course-overview-details {
    padding: 25px;
}

.course-overview-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.course-overview-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 25px;
    max-height: 100px;
    overflow-y: auto;
}

.course-overview-intro-wrapper {
    margin-top: 20px;
}

.intro-video-preview {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-glass);
    margin-top: 12px;
}

.overview-intro-placeholder {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 12px;
}

.overview-intro-placeholder i {
    font-size: 1.5rem;
}

.preview-placeholder-card {
    width: 100%;
    max-width: 450px;
    aspect-ratio: 9 / 11;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #18181b;
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 30px;
    color: var(--text-muted);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.preview-placeholder-card i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #3f3f46;
}

.preview-placeholder-card p {
    margin: 0;
    font-weight: 500;
    line-height: 1.5;
    font-size: 1rem;
}

.preview-placeholder-card .spinner {
    width: 32px;
    height: 32px;
}

/* =========================================
   21. STORE / MARKETPLACE
   ========================================= */
.store-container {
    padding: 30px;
}

.store-header {
    text-align: center;
    margin-bottom: 40px;
}

.store-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 10px;
}

.store-header p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

.store-filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.filter-btn.active {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* Adjust grid for marketplace cards */
#storeGrid.grid-container {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

/* Individual Store Item Card */
.store-item-card {
    cursor: pointer;
    padding: 0;
    /* Override default glass-card padding */
    display: flex;
    /* Ensure flex properties work */
    flex-direction: column;
    height: 100%;
}

.store-item-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #111;
    position: relative;
    overflow: hidden;
    border-top-left-radius: 16px;
    /* Match parent card radius */
    border-top-right-radius: 16px;
}

.store-item-thumbnail img,
.store-item-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.store-item-card:hover .store-item-thumbnail img,
.store-item-card:hover .store-item-thumbnail video {
    transform: scale(1.05);
}

.store-item-format-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.store-item-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    /* This is key to push the footer down */
}

.store-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin: 0 0 15px 0;
    line-height: 1.4;
    /* Allow for 2 lines of text before ellipsis */
    height: 2.8em;
    /* 1.4 * 1.1 * 2, adjusted slightly */
    overflow: hidden;
}

.store-item-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-grow: 1;
    /* Pushes footer down */
}

.store-item-author .avatar {
    width: 28px;
    height: 28px;
}

.store-item-author span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.store-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-glass);
    padding-top: 15px;
    margin-top: auto;
    /* Pushes to the bottom of the flex container */
}

.store-item-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.btn-buy {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* --- NEW: Course Card Specific Styles --- */
.course-card {
    cursor: pointer;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Add a subtle glow to make courses stand out */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(139, 92, 246, 0.15);
}

.course-card-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    /* Landscape for courses */
    position: relative;
    overflow: hidden;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    background: #111;
}

.course-card-thumbnail img,
.course-card-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.course-card:hover .course-card-thumbnail img,
.course-card:hover .course-card-thumbnail video {
    transform: scale(1.05);
}

.course-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
}

.course-card-stats {
    display: flex;
    gap: 15px;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.course-card-stats span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.course-card-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.course-card-title {
    font-size: 1.2rem;
    /* Larger title for courses */
    font-weight: 700;
    color: white;
    margin: 0 0 15px 0;
    line-height: 1.4;
    height: 2.8em;
    /* Allow for 2 lines of text */
    overflow: hidden;
}

.card-options-btn:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    transform: scale(1.08);
}

.card-menu-item {
    transition: background 0.15s ease;
}

.card-menu-item:hover {
    background: rgba(255, 255, 255, 0.09) !important;
}

/* =========================================
   22. COURSE VIEW PAGE
   ========================================= */
.course-view-main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 40px;
}

.course-view-sidebar {
    width: 380px;
    flex-shrink: 0;
    border-left: var(--border-glass);
    background: rgba(0, 0, 0, 0.2);
    padding: 30px;
    overflow-y: auto;
}

.course-view-header {
    max-width: 800px;
    margin-bottom: 40px;
}

.course-view-header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    color: white;
    line-height: 1.2;
    margin-bottom: 15px;
}

.course-view-description {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 25px;
}

.course-view-content {
    max-width: 800px;
}

.course-view-section {
    margin-bottom: 50px;
}

.course-view-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-glass);
}

.intro-video-preview {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-glass);
    aspect-ratio: 16 / 9;
    background: #000;
}

.intro-video-preview .post-media {
    width: 100%;
    height: 100%;
}

.curriculum-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.curriculum-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    overflow: hidden;
}

.curriculum-section-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    transition: background-color 0.2s ease;
}

.curriculum-section-header:hover {
    background: rgba(255, 255, 255, 0.08);
}

.curriculum-section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin: 0;
}

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

.section-meta i {
    font-size: 1.4rem;
    transition: transform 0.3s ease-in-out;
}

.curriculum-section.active .section-meta i {
    transform: rotate(-180deg);
}

.curriculum-lesson-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* For smooth transition */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    padding: 0 20px;
}

.curriculum-section.active .curriculum-lesson-list {
    max-height: 1000px;
    /* Large enough to not clip content */
    padding: 10px 20px 20px 20px;
}

.curriculum-lesson-item {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-muted);
}

.curriculum-lesson-item i {
    font-size: 1.2rem;
    color: var(--primary-blue);
}

.curriculum-lesson-item span {
    font-weight: 500;
    color: var(--text-main);
}

/* Sidebar Purchase Card */
.course-purchase-card {
    background: var(--bg-card);
    border: var(--border-glass);
    border-radius: 16px;
    overflow: hidden;
}

.course-purchase-cover {
    aspect-ratio: 16 / 9;
    background: #000;
}

.course-purchase-cover .post-media {
    width: 100%;
    height: 100%;
}

.course-purchase-details {
    padding: 25px;
}

.course-purchase-meta {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-glass);
}

.course-purchase-meta h4 {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 15px;
}

.course-purchase-meta ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.course-purchase-meta ul li {
    display: flex;
    align-items: center;
    gap: 10px;
}

.course-purchase-meta ul li i {
    font-size: 1.2rem;
}

@media (max-width: 1024px) {
    #course-view-scroll {
        flex-direction: column;
    }

    .course-view-sidebar {
        width: 100%;
        border-left: none;
        border-top: var(--border-glass);
    }

    .course-view-main {
        padding: 20px;
    }

    .course-view-header h1 {
        font-size: 2rem;
    }
}

/* =========================================
   23. COURSE VIEW PAGE REDESIGN
   ========================================= */
.course-view-layout {
    display: flex;
    flex-direction: row;
    padding: 0;
    /* Remove default dashboard-scroll padding */
    height: 100%;
    overflow: hidden;
    /* Manage scrolling internally */
}

.course-lesson-viewer {
    flex: 1;
    min-width: 0;
    /* Allow shrinking */
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
    /* Dark background for content */
    overflow-y: auto;
    /* Allow scrolling for long content */
    padding: 30px;
}

.lesson-viewer-header {
    width: 100%;
    background: #141822;
    padding: 12px 18px;
    border: 1px solid var(--border-glass);
    border-bottom: none;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    position: relative;
    z-index: 2;
    box-sizing: border-box;
}

.lesson-viewer-header h1 {
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    margin: 0;
    line-height: 1.3;
}

.lesson-content-display {
    width: 100%;
    height: 480px;
    background: #000;
    border: 1px solid var(--border-glass);
    border-bottom: none;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
}

.lesson-content-display .feed-post {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

.lesson-content-display .post-media {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.lesson-content-display img,
.lesson-content-display video,
.lesson-content-display iframe {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Dedicated Scrollable PDF Reader Container - Fits 100% inside preview canvas */
.pdf-viewer-container {
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: #141722 !important;
    padding: 16px 10px !important;
    display: block !important;
    box-sizing: border-box !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
    border-radius: 0 !important;
}

.pdf-viewer-container::-webkit-scrollbar {
    width: 8px;
}

.pdf-viewer-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}

.pdf-viewer-container canvas {
    display: block !important;
    margin: 0 auto 16px auto !important;
    max-width: 96% !important;
    height: auto !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6) !important;
}

.lesson-supporting-materials {
    display: flex;
    gap: 8px;
    margin-top: 0;
    margin-bottom: 0;
    padding: 12px 18px;
    background: #141824;
    border: 1px solid var(--border-glass);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    flex-wrap: wrap;
    align-items: center;
    box-sizing: border-box;
}

.lesson-tab {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.lesson-tab.active {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.lesson-tab:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.course-curriculum-panel {
    width: 380px;
    flex-shrink: 0;
    border-left: var(--border-glass);
    background: rgba(0, 0, 0, 0.2);
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.course-curriculum-list-wrapper h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-glass);
}

.curriculum-lesson-item.active {
    background: rgba(59, 130, 246, 0.15);
    border-left: 3px solid var(--primary-blue);
    color: white;
}

.curriculum-lesson-item {
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.curriculum-lesson-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Mobile Responsiveness for Course / Asset View & Studio Page */
@media (max-width: 1024px) {
    .course-view-layout {
        flex-direction: column !important;
        height: auto !important;
    }

    .course-lesson-viewer {
        padding: 16px 14px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .course-curriculum-panel {
        width: 100% !important;
        border-left: none !important;
        border-top: 1px solid var(--border-glass) !important;
        padding: 18px 14px !important;
        box-sizing: border-box !important;
    }

    .lesson-viewer-header {
        padding: 10px 14px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .lesson-viewer-header h1 {
        font-size: 1.05rem !important;
    }

    .lesson-supporting-materials {
        gap: 6px !important;
        padding: 6px 0 !important;
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .asset-tab-btn,
    .lesson-tab {
        padding: 6px 12px !important;
        font-size: 0.78rem !important;
        gap: 5px !important;
        flex-shrink: 0 !important;
    }

    .lesson-content-display {
        min-height: 260px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .pdf-viewer-container {
        height: 460px !important;
        max-height: 65vh !important;
        min-height: 320px !important;
        padding: 12px 6px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .pdf-viewer-container canvas {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 auto 12px auto !important;
    }
}

@media (max-width: 768px) {
    .course-lesson-viewer {
        padding: 10px 8px !important;
    }

    .preview-content {
        padding: 8px !important;
    }

    .lesson-preview-card {
        padding: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .lesson-preview-header {
        padding: 8px 10px !important;
    }

    .asset-tabs-top {
        padding: 6px 8px !important;
        gap: 5px !important;
    }

    .asset-download-card {
        padding: 10px 12px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    .asset-download-card > div:last-child {
        width: 100% !important;
        justify-content: flex-end !important;
    }

    .btn-download-file {
        padding: 6px 10px !important;
        font-size: 1.05rem !important;
        border-radius: 7px !important;
        gap: 0 !important;
    }
}

/* ============================================================
   15. INSTAGRAM-STYLE FOLLOW / FOLLOWING BUTTONS
   ============================================================ */
.btn-follow-overlay,
.btn-follow-inline,
.btn-follow-modal {
    background: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    user-select: none;
}

.btn-follow-overlay:hover,
.btn-follow-inline:hover,
.btn-follow-modal:hover {
    background: #2563eb;
    transform: scale(1.03);
}

.btn-follow-overlay.following,
.btn-follow-inline.following,
.btn-follow-modal.following {
    background: rgba(255, 255, 255, 0.15);
    color: #f4f4f5;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-follow-overlay.following:hover,
.btn-follow-inline.following:hover,
.btn-follow-modal.following:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

/* Profile Action Follow Button */
.btn-profile-follow {
    flex: 1;
    padding: 8px 0;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-profile-follow.following {
    background: #27272a;
    color: #e4e4e7;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-profile-follow.following:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

/* ============================================================
   16. XTRATOOLS STUDIO QUICK ACCESS CUSTOMIZER
   ============================================================ */
.tool-customizer-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.tool-customizer-card:hover:not(.upcoming) {
    transform: translateY(-4px);
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.tool-customizer-card.is-selected {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.tool-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #93c5fd;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.tool-pill .pill-remove {
    cursor: pointer;
    font-size: 1rem;
    color: #93c5fd;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    transition: all 0.2s ease;
}

.tool-pill .pill-remove:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* ==========================================================================
   UNIVERSAL RICH SHARE MODAL & PREVIEW CARDS
   ========================================================================== */

.xtra-share-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
}

.xtra-share-overlay.active {
    opacity: 1;
    visibility: visible;
}

.xtra-share-modal {
    background: linear-gradient(145deg, rgba(24, 24, 32, 0.95), rgba(15, 15, 20, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 35px rgba(59, 130, 246, 0.15);
    overflow: hidden;
    transform: scale(0.92) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.xtra-share-overlay.active .xtra-share-modal {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.xtra-share-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.xtra-share-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #f4f4f5;
    display: flex;
    align-items: center;
    gap: 8px;
}

.xtra-share-header h3 i {
    color: #3b82f6;
}

.xtra-share-close {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #a1a1aa;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.xtra-share-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.4);
    transform: rotate(90deg);
}

/* Modal Body */
.xtra-share-body {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-height: 80vh;
    overflow-y: auto;
}

/* --- RICH PREVIEW CARD --- */
.xtra-share-preview-card {
    background: #0f0f15;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    position: relative;
}

.xtra-share-media-box {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #1e1b4b, #0f172a);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.xtra-share-media-box img,
.xtra-share-media-box video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.xtra-share-type-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #60a5fa;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 2;
}

.xtra-share-play-indicator {
    position: absolute;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    pointer-events: none;
}

.xtra-share-card-meta {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(255, 255, 255, 0.02);
}

.xtra-share-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.xtra-share-card-desc {
    font-size: 0.82rem;
    color: #a1a1aa;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.xtra-share-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.xtra-share-author-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #e4e4e7;
    font-weight: 500;
}

.xtra-share-author-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    background: #3b82f6;
}

.xtra-share-domain-pill {
    font-size: 0.72rem;
    font-weight: 600;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

/* --- SOCIAL MEDIA SHARE BUTTONS GRID --- */
.xtra-social-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.xtra-social-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: #e4e4e7;
    font-size: 0.74rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
}

.xtra-social-btn i {
    font-size: 1.35rem;
    transition: transform 0.2s ease;
}

.xtra-social-btn:hover {
    transform: translateY(-2px);
    color: white;
}

.xtra-social-btn:hover i {
    transform: scale(1.15);
}

.xtra-social-btn.x-twitter:hover {
    background: #000000;
    border-color: #555;
}

.xtra-social-btn.whatsapp:hover {
    background: #25D366;
    border-color: #25D366;
    color: #ffffff;
}

.xtra-social-btn.linkedin:hover {
    background: #0A66C2;
    border-color: #0A66C2;
    color: #ffffff;
}

.xtra-social-btn.telegram:hover {
    background: #229ED9;
    border-color: #229ED9;
    color: #ffffff;
}

.xtra-social-btn.reddit:hover {
    background: #FF4500;
    border-color: #FF4500;
    color: #ffffff;
}

.xtra-social-btn.facebook:hover {
    background: #1877F2;
    border-color: #1877F2;
    color: #ffffff;
}

.xtra-social-btn.native-share:hover {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-color: #818cf8;
    color: #ffffff;
}

.xtra-social-btn.story-share:hover {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border-color: #f59e0b;
    color: #ffffff;
}

/* --- COPY LINK BAR --- */
.xtra-share-copy-box {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 4px 6px 4px 12px;
    gap: 8px;
}

.xtra-share-copy-box input {
    background: transparent;
    border: none;
    outline: none;
    color: #d4d4d8;
    font-size: 0.85rem;
    font-family: inherit;
    flex-grow: 1;
    min-width: 0;
}

.xtra-share-copy-btn {
    background: #3b82f6;
    border: none;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.xtra-share-copy-btn:hover {
    background: #2563eb;
    transform: scale(1.02);
}

.xtra-share-copy-btn.copied {
    background: #10b981;
}

/* --- EMBED SNIPPET ROW --- */
.xtra-share-actions-row {
    display: flex;
    gap: 10px;
}

.xtra-share-secondary-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #d4d4d8;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.xtra-share-secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

/* --- TOAST NOTIFICATION --- */
.xtra-share-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(50px);
    background: rgba(16, 185, 129, 0.95);
    backdrop-filter: blur(8px);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.xtra-share-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

@media (max-width: 480px) {
    .xtra-social-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    .xtra-share-modal {
        max-width: 100%;
        border-radius: 16px;
    }
    .xtra-share-media-box {
        height: 150px;
    }
}

/* =========================================
   22. DIGITAL ASSET STUDIO & SHOWCASE
   ========================================= */
.course-studio-layout.asset-mode .pipeline-panel {
    background: #090c10;
    border-right-color: rgba(59, 130, 246, 0.15);
}

.course-studio-layout.asset-mode .pipeline-step.complete .step-icon {
    background: #2563eb;
    border-color: #60a5fa;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
}

.asset-badge {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    color: #34d399 !important;
}

.course-badge {
    background: rgba(99, 102, 241, 0.15) !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
    color: #818cf8 !important;
}

.asset-item-card {
    background: #10141c;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.asset-item-card:hover {
    border-color: rgba(59, 130, 246, 0.35);
    background: #131824;
}

.asset-item-card.selected {
    border-color: #3b82f6 !important;
    background: #141c2c !important;
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.25);
}

.asset-card-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.asset-index-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 5px;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.delete-asset-btn {
    background: transparent;
    border: none;
    color: #71717a;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.delete-asset-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.asset-attached-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.asset-file-pill {
    font-size: 0.72rem;
    padding: 3px 9px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.asset-file-pill.video {
    background: rgba(59, 130, 246, 0.14);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.asset-file-pill.pdf {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.asset-file-pill.model {
    background: rgba(168, 85, 247, 0.14);
    color: #d8b4fe;
    border: 1px solid rgba(168, 85, 247, 0.25);
}

.asset-preview-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: #60a5fa;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-download-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 15px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 8px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white !important;
    text-decoration: none !important;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-download-file:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}

.btn-preview-asset {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 13px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e4e4e7;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-preview-asset:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Redesigned Sleek Asset Download Card */
.asset-download-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: all 0.2s ease;
    gap: 12px;
}

.asset-download-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(59, 130, 246, 0.3);
}

.asset-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.asset-tabs-bottom {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: #0d1117;
    border-top: 1px solid var(--border-glass);
    overflow-x: auto;
}

.asset-tab-btn {
    padding: 7px 14px;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #a1a1aa;
    white-space: nowrap;
}

.asset-tab-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.asset-tab-btn.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
}

/* =========================================
   GLOBAL KATEX DISPLAY
   ========================================= */
.katex {
    text-rendering: auto;
    font-size: 1.05em;
    white-space: normal;
    text-indent: 0;
}

.katex-display {
    margin: 8px 0 !important;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    display: block;
    text-align: center;
}

.katex-inline {
    display: inline-block;
    padding: 0 2px;
}

.katex .mtable {
    vertical-align: middle;
}

/* Prevent global responsive SVG rules from constraining KaTeX radical */
.katex .hide-tail > svg,
.katex .sqrt .hide-tail > svg {
    max-width: none !important;
}

/* Radical hook SVG fill & stroke */
.katex svg,
.katex svg path,
.katex .hide-tail svg,
.katex .hide-tail svg path,
.katex .sqrt .hide-tail svg,
.katex .sqrt .hide-tail svg path {
    fill: currentColor !important;
    stroke: currentColor !important;
}

.katex .katex-mathml {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px) !important;
    padding: 0 !important;
    border: 0 !important;
    height: 1px !important;
    width: 1px !important;
    overflow: hidden !important;
}