@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800;900&display=swap');

:root { 
    --primary: #6366F1; /* Indigo */
    --primary-dark: #4338CA; 
    --primary-light: #818CF8;
    --primary-glow: rgba(99, 102, 241, 0.15);
    
    --secondary: #D946EF; /* Fuchsia */
    --secondary-dark: #C084FC;
    
    --accent: #F59E0B; /* Amber */
    --success: #10B981; /* Emerald */
    --warning: #F59E0B; 
    --danger: #EF4444;
    --instructor: #8B5CF6; 
    --admin: #0F172A;
    --bg: #0B0F19; /* Dark premium background default */
    
    --card-bg: rgba(17, 24, 39, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.05);
    
    --text: #F3F4F6; 
    --text-muted: #9CA3AF;
    --sidebar: 320px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --radius-xl: 36px;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --anim-fast: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --anim-bounce: 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* New Dynamic Backgrounds for Visibility */
    --input-bg: rgba(17, 24, 39, 0.6);
    --input-focus-bg: rgba(17, 24, 39, 0.9);
    --select-option-bg: #111827;
    --sidebar-bg: rgba(17, 24, 39, 0.75);
    --header-bg: rgba(17, 24, 39, 0.4);
    --modal-bg: #0f172a;
    --modal-header-bg: rgba(15, 23, 42, 0.4);
    --toast-bg: #111827;
    --pill-bg: rgba(255, 255, 255, 0.05);
    --hover-bg: rgba(255, 255, 255, 0.04);
    --module-bg: var(--pill-bg);
    --quiz-icon-bg: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(99, 102, 241, 0.2));
    --task-icon-bg: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.2));
}

/* Light Mode Override (if user preferences or class exists, but dark theme is premium standard) */
body.light-theme {
    --bg: #F8FAFC;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(99, 102, 241, 0.08);
    --glass: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --text: #0F172A;
    --text-muted: #64748B;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.08);
    --shadow-xl: 0 20px 48px rgba(0,0,0,0.12);
    
    /* Light Mode Dynamic Backgrounds */
    --input-bg: rgba(255, 255, 255, 0.7);
    --input-focus-bg: rgba(255, 255, 255, 1);
    --select-option-bg: #FFFFFF;
    --sidebar-bg: rgba(255, 255, 255, 0.85);
    --header-bg: rgba(255, 255, 255, 0.7);
    --modal-bg: #FFFFFF;
    --modal-header-bg: rgba(241, 245, 249, 0.7);
    --toast-bg: #FFFFFF;
    --pill-bg: rgba(0, 0, 0, 0.05);
    --hover-bg: rgba(0, 0, 0, 0.04);
    --module-bg: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    --quiz-icon-bg: linear-gradient(135deg, #dbeafe, #bfdbfe);
    --task-icon-bg: linear-gradient(135deg, #d1fae5, #a7f3d0);
}

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

body { 
    font-family: var(--font-body); 
    background: var(--bg); 
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 60%),
        radial-gradient(at 100% 0%, rgba(217, 70, 239, 0.1) 0px, transparent 60%),
        radial-gradient(at 50% 100%, rgba(139, 92, 246, 0.08) 0px, transparent 60%);
    background-attachment: fixed;
    color: var(--text); 
    display: flex; 
    height: 100vh; 
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--anim-fast);
}

h1, h2, h3, h4, h5, h6, .page-title, .brand-title {
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
    color: var(--text);
}

.hidden { display: none !important; }

/* Track Navigation Header Tabs */
.track-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 6px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    gap: 8px;
}
.track-tab {
    flex: 1;
    padding: 12px 16px;
    text-align: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--anim-bounce);
    color: var(--text-muted);
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.track-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}
.track-tab:hover:not(.active) {
    background: var(--hover-bg);
    color: var(--text);
}

/* Premium Buttons */
.btn { 
    padding: 14px 28px; 
    border-radius: var(--radius-md); 
    border: none; 
    font-weight: 700; 
    font-size: 15px;
    font-family: var(--font-heading);
    cursor: pointer; 
    width: 100%; 
    margin-top: 8px;
    position: relative;
    overflow: hidden;
    transition: all var(--anim-bounce);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 1;
    text-decoration: none;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255,255,255,0.15), transparent);
    z-index: -1;
    opacity: 0;
    transition: opacity var(--anim-fast);
}

.btn:hover { 
    transform: translateY(-3px) scale(1.02); 
    box-shadow: var(--shadow-glow);
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: translateY(1px) scale(0.97); }

.btn-primary { 
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)); 
    color: white;
    box-shadow: 0 8px 24px -6px rgba(99, 102, 241, 0.6);
}
.btn-success { 
    background: linear-gradient(135deg, var(--success), #059669); 
    color: white;
    box-shadow: 0 8px 24px -6px rgba(16, 185, 129, 0.6);
}
.btn-warning {
    background: linear-gradient(135deg, var(--warning), #D97706);
    color: white;
    box-shadow: 0 8px 24px -6px rgba(245, 158, 11, 0.6);
}
.btn-danger {
    background: linear-gradient(135deg, var(--danger), #DC2626);
    color: white;
    box-shadow: 0 8px 24px -6px rgba(239, 68, 68, 0.6);
}
.btn-outline { 
    background: var(--glass); 
    border: 1px solid var(--glass-border); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}
.btn-outline:hover { 
    border-color: var(--primary-light); 
    color: white;
    background: rgba(99, 102, 241, 0.1);
}
.btn-ghost {
    background: transparent;
    color: var(--primary-light);
    box-shadow: none;
}
.btn-ghost:hover { background: rgba(99, 102, 241, 0.08); color: white; }
.btn-sm { padding: 10px 20px; font-size: 14px; border-radius: var(--radius-sm); }

/* Inputs and Forms */
input, select, textarea { 
    width: 100%; 
    padding: 16px 20px; 
    margin: 6px 0; 
    border: 1px solid var(--card-border); 
    border-radius: var(--radius-md); 
    box-sizing: border-box; 
    font-family: var(--font-body);
    font-size: 15px;
    background: var(--input-bg);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    transition: all var(--anim-fast);
    color: var(--text);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    background: var(--input-focus-bg);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
    transform: translateY(-1px);
}
input::placeholder { color: var(--text-muted); }
select option { background-color: var(--select-option-bg); color: var(--text); }

.form-group { margin-bottom: 22px; text-align: left; }
.form-label { 
    display: block; 
    font-size: 12px; 
    font-weight: 700; 
    color: var(--text-muted); 
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Sidebar Navigation */
.sidebar { 
    width: var(--sidebar); 
    background: var(--sidebar-bg); 
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-right: 1px solid var(--card-border); 
    display: flex; 
    flex-direction: column; 
    z-index: 20;
    box-shadow: 10px 0 30px rgba(0,0,0,0.25);
}
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

.header { 
    padding: 24px 48px; 
    background: var(--header-bg); 
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--card-border); 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    z-index: 10;
}
.content { padding: 48px; overflow-y: auto; flex: 1; scroll-behavior: smooth; }

/* Cards & Grid Styling */
.card { 
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg); 
    padding: 36px; 
    box-shadow: var(--shadow-lg); 
    margin-bottom: 28px; 
    border: 1px solid var(--card-border);
    transition: all var(--anim-bounce);
    position: relative;
    overflow: hidden;
}
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    opacity: 0.4;
    transition: opacity var(--anim-fast), height var(--anim-fast);
}
.card:hover { 
    transform: translateY(-6px) scale(1.005); 
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    border-color: rgba(99, 102, 241, 0.3);
}
.card:hover::before { opacity: 1; height: 6px; }
.card-flat { box-shadow: none; border: 1px solid var(--card-border); }
.card-flat:hover { transform: none; box-shadow: var(--shadow-md); }
.card-accent { border-left: 5px solid var(--primary); }
.card-success { border-left: 5px solid var(--success); }
.card-warning { border-left: 5px solid var(--warning); }
.card-danger { border-left: 5px solid var(--danger); }

/* Navigation Items */
.nav-item { 
    display: flex; 
    align-items: center; 
    gap: 16px; 
    padding: 16px 20px; 
    border-radius: var(--radius-md); 
    cursor: pointer; 
    margin-bottom: 10px; 
    color: var(--text-muted);
    font-weight: 600;
    font-family: var(--font-heading);
    transition: all var(--anim-fast);
    position: relative;
    border: 1px solid transparent;
}
.nav-item:hover { 
    background: var(--hover-bg); 
    color: var(--text);
    transform: translateX(6px);
    border-color: var(--hover-bg);
}
.nav-item.active { 
    background: rgba(99, 102, 241, 0.1);
    color: white;
    border-color: rgba(99, 102, 241, 0.25);
    font-weight: 700;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    bottom: 25%;
    width: 4px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}
.nav-item.locked { opacity: 0.35; pointer-events: none; filter: grayscale(1); }
.nav-ico { 
    width: 42px; 
    height: 42px; 
    display: grid; 
    place-items: center; 
    border-radius: 12px; 
    background: var(--pill-bg); 
    color: var(--text);
    font-size: 18px;
    transition: all var(--anim-fast);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}
.nav-item.active .nav-ico {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* File Drop Zone */
.file-drop { 
    border: 2px dashed rgba(99, 102, 241, 0.4); 
    padding: 48px; 
    text-align: center; 
    border-radius: var(--radius-lg); 
    cursor: pointer; 
    transition: all var(--anim-fast); 
    background: rgba(17, 24, 39, 0.4);
}
.file-drop:hover { 
    border-color: var(--primary); 
    background: rgba(99, 102, 241, 0.08);
    transform: scale(1.015);
}

/* Quiz Option styling */
.quiz-opt { 
    text-align: left; 
    background: var(--pill-bg); 
    border: 1px solid var(--card-border); 
    color: var(--text); 
    margin-bottom: 14px;
    border-radius: var(--radius-md);
    padding: 22px 26px;
    box-shadow: var(--shadow-sm);
    font-size: 16px;
    font-weight: 500;
    transition: all var(--anim-fast);
    cursor: pointer;
}
.quiz-opt:hover { 
    border-color: var(--primary-light); 
    background: rgba(99, 102, 241, 0.05);
    transform: translateX(8px);
    box-shadow: var(--shadow-md);
    color: var(--text);
}

/* Theme / Role styles */
body.role-instructor .sidebar { border-right-color: rgba(139, 92, 246, 0.2); }
body.role-instructor .btn-primary { 
    background: linear-gradient(135deg, var(--instructor), #7C3AED);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
}
body.role-admin .btn-primary { 
    background: linear-gradient(135deg, var(--admin), #334155);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.4);
}

/* Default Hidden elements on Desktop */
.mobile-menu-trigger { display: none !important; }
.mobile-bottom-bar { display: none !important; }
.sidebar-backdrop { display: none !important; }
.sidebar-close-btn { display: none !important; }

/* Responsive App Shell (Tablets & Mobile) */
@media (max-width: 992px) {
    :root { --sidebar: 260px; }
    .content { padding: 32px 24px; }
    .header { padding: 18px 24px; }
}

@media (max-width: 860px) { 
    body { 
        flex-direction: column !important; 
        height: 100vh !important;
        height: 100dvh !important;
        overflow: hidden !important; 
        position: relative !important;
    } 

    /* Sidebar transforms into an off-canvas Drawer */
    .sidebar { 
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 85% !important;
        max-width: 320px !important;
        height: 100% !important;
        z-index: 1200 !important;
        transform: translateX(-105%) !important;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease !important;
        background: #0d1322 !important;
        box-shadow: none !important;
        border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
        display: flex !important;
        flex-direction: column !important;
    } 

    .sidebar.mobile-open {
        transform: translateX(0) !important;
        box-shadow: 20px 0 60px rgba(0, 0, 0, 0.9) !important;
    }

    /* Drawer Backdrop */
    .sidebar-backdrop {
        display: block !important;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(4, 7, 14, 0.75) !important;
        backdrop-filter: blur(6px) !important;
        -webkit-backdrop-filter: blur(6px) !important;
        z-index: 1100 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: opacity 0.3s ease !important;
    }
    .sidebar-backdrop.active {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .sidebar-close-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 14px;
        right: 14px;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: white;
        font-size: 18px;
        cursor: pointer;
        z-index: 10;
    }

    /* Main Container & Header */
    .main {
        flex: 1 !important;
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .header { 
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 10px 14px !important;
        min-height: 56px !important;
        gap: 8px !important;
        background: rgba(11, 15, 25, 0.92) !important;
    }

    .header .page-title {
        font-size: 15px !important;
        font-weight: 700 !important;
        max-width: 160px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-menu-trigger {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.12);
        color: white;
        font-size: 19px;
        cursor: pointer;
        flex-shrink: 0;
    }

    .hdr-controls {
        gap: 8px !important;
    }

    .hdr-controls #u-name {
        display: none !important;
    }

    .hdr-controls .pill {
        font-size: 10.5px !important;
        padding: 3px 8px !important;
    }

    .hdr-controls .chip {
        padding: 6px 10px !important;
        font-size: 12px !important;
    }

    /* Scrollable Content */
    .content { 
        padding: 14px 12px 96px 12px !important; 
        flex: 1 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .card { 
        padding: 20px 16px !important; 
        border-radius: var(--radius-md) !important;
        margin-bottom: 16px !important;
    }

    /* Grid Stats on Mobile */
    .grid-stats {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 16px !important;
    }

    .stat-card {
        padding: 12px 6px !important;
        border-radius: 10px !important;
        text-align: center;
    }

    .stat-card .value {
        font-size: 18px !important;
    }

    .stat-card .label {
        font-size: 10.5px !important;
    }

    .stat-card .icon {
        font-size: 18px !important;
        margin-bottom: 4px !important;
    }

    /* Mobile Native Bottom Bar */
    .mobile-bottom-bar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 66px !important;
        background: rgba(13, 19, 34, 0.96) !important;
        backdrop-filter: blur(25px) !important;
        -webkit-backdrop-filter: blur(25px) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-around !important;
        padding: 0 4px calc(env(safe-area-inset-bottom, 0px) + 2px) !important;
        z-index: 1050 !important;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6) !important;
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: #94a3b8;
        font-size: 10.5px;
        font-weight: 600;
        cursor: pointer;
        padding: 6px 0;
        gap: 3px;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        text-decoration: none;
    }

    .bottom-nav-item .bnav-icon {
        font-size: 20px;
        line-height: 1;
        transition: transform 0.2s ease;
    }

    .bottom-nav-item.active {
        color: #34d399 !important;
    }

    .bottom-nav-item.active .bnav-icon {
        transform: scale(1.15);
    }

    .help-fab {
        bottom: 76px !important;
        right: 16px !important;
    }

    input, select, textarea {
        font-size: 16px !important; /* Prevents auto zoom in iOS */
    }

    /* Mobile modal responsiveness */
    .modal-backdrop {
        z-index: 2500 !important;
        padding: 10px 8px calc(14px + env(safe-area-inset-bottom, 0px)) 8px !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .modal, .studio-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: calc(100dvh - 20px) !important;
        margin: 0 auto !important;
        border-radius: 16px !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .modal header, .studio-header {
        padding: 14px 16px !important;
        flex-shrink: 0 !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
        align-items: center !important;
    }

    .studio-header > div:first-child {
        min-width: 0 !important;
        flex: 1 1 200px !important;
    }

    .studio-header > div:last-child {
        flex-shrink: 0 !important;
        margin-left: auto !important;
    }

    .studio-tabs {
        padding: 8px 12px !important;
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
    }
    .studio-tabs::-webkit-scrollbar {
        display: none !important;
    }

    .studio-tab-btn {
        flex-shrink: 0 !important;
        padding: 7px 12px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
    }

    .modal .body, .studio-body {
        padding: 16px 14px !important;
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        max-height: none !important;
    }

    .studio-footer, .modal footer {
        padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
        flex-shrink: 0 !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
        background: rgba(15, 23, 42, 0.95) !important;
    }

    .studio-footer > div:first-child,
    .studio-footer > div:last-child {
        width: 100% !important;
        display: flex !important;
        justify-content: stretch !important;
        gap: 8px !important;
    }

    .studio-footer button,
    .studio-footer .btn {
        flex: 1 !important;
        width: 100% !important;
        min-height: 42px !important;
        font-size: 13px !important;
        justify-content: center !important;
    }

    /* ALL 2-col and 3-col grids inside modals stack cleanly to 1 column on mobile */
    .studio-grid-2col,
    .modal [style*="grid-template-columns"],
    .studio-modal-content [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .modal .form-group,
    .studio-modal-content .form-group {
        width: 100% !important;
        min-width: 0 !important;
    }

    .modal input,
    .modal select,
    .modal textarea,
    .studio-modal-content input,
    .studio-modal-content select,
    .studio-modal-content textarea {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        font-size: 15px !important;
    }

    /* Mobile table horizontal scrolling */
    .admin-table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .admin-table th, .admin-table td {
        padding: 12px 14px !important;
        white-space: nowrap !important;
    }

    /* Mobile responsive media & buttons */
    iframe, video {
        max-width: 100% !important;
        height: auto !important;
    }
    .btn {
        min-height: 44px !important; /* Touch-friendly tap targets */
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

.hdr-controls { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.chip { 
    padding: 10px 18px; 
    border: 1px solid var(--card-border); 
    border-radius: var(--radius-md); 
    background: var(--pill-bg); 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer; 
    font-size: 14px;
    font-weight: 600;
    transition: all var(--anim-fast);
    color: var(--text);
}
.chip:hover { border-color: var(--primary-light); background: var(--hover-bg); transform: translateY(-1px); }
.chip select { 
    padding: 4px 8px; 
    margin: 0; 
    border-radius: var(--radius-sm); 
    border: none; 
    font-size: 14px; 
    background: transparent;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    color: var(--text);
}

/* Modals */
.modal-backdrop { 
    position: fixed; 
    inset: 0; 
    background: rgba(7, 10, 18, 0.85); 
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 2500 !important; 
    padding: 20px;
    opacity: 0;
    animation: fadeIn var(--anim-fast) forwards;
}

.studio-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@keyframes fadeIn { to { opacity: 1; } }

.modal { 
    width: min(900px, 100%); 
    background: var(--modal-bg); 
    border-radius: var(--radius-xl); 
    border: 1px solid var(--card-border);
    box-shadow: 0 32px 80px rgba(0,0,0,0.6); 
    overflow: hidden;
    transform: scale(0.95);
    animation: scaleUp var(--anim-bounce) forwards;
}
@keyframes scaleUp { to { transform: scale(1); } }

.modal header { 
    padding: 26px 36px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid var(--card-border);
    background: var(--modal-header-bg);
}
.modal .body { padding: 36px; max-height: 70vh; overflow: auto; line-height: 1.8; color: var(--text); }

/* Stats Widgets */
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; margin-bottom: 36px; }
.stat-card {
    text-align: left;
    padding: 26px;
    border-radius: var(--radius-md);
    background: var(--pill-bg);
    border: 1px solid var(--card-border);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all var(--anim-fast);
}
.stat-card:hover {
    transform: translateY(-3px);
    background: var(--hover-bg);
}
.stat-card .icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    font-size: 26px;
}
.stat-card .value {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-heading);
    margin-bottom: 2px;
}
.stat-card .label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.stat-card.purple .icon { background: rgba(139, 92, 246, 0.15); color: #A78BFA; }
.stat-card.blue .icon { background: rgba(37, 99, 235, 0.15); color: #93C5FD; }
.stat-card.green .icon { background: rgba(16, 185, 129, 0.15); color: #6EE7B7; }
.stat-card.amber .icon { background: rgba(245, 158, 11, 0.15); color: #FCD34D; }
.stat-card.rose .icon { background: rgba(225, 29, 72, 0.15); color: #FDA4AF; }

/* Gamification Progress Widget */
.xp-widget {
    background: linear-gradient(135deg, #1e1b4b, #111827);
    color: white;
    padding: 24px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(99, 102, 241, 0.2);
}
.xp-widget::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
    animation: rotate 20s linear infinite;
    z-index: 0;
}
.xp-widget > * { position: relative; z-index: 1; }
.xp-widget .xp-value { font-size: 24px; font-weight: 800; font-family: var(--font-heading); color: #E0E7FF; }
.xp-widget .xp-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 5px;
    margin-top: 14px;
    overflow: hidden;
    position: relative;
}
.xp-widget .xp-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), var(--secondary));
    border-radius: 5px;
    transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}
.xp-widget .xp-bar::after {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}
@keyframes rotate { 100% { transform: rotate(360deg); } }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* Audio Button styling */
.audio-btn { 
    width: auto; 
    padding: 12px 22px; 
    border-radius: var(--radius-md); 
    border: 1px solid var(--card-border); 
    background: var(--pill-bg); 
    cursor: pointer; 
    font-weight: 700; 
    font-size: 14px;
    transition: all var(--anim-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}
.audio-btn:hover { 
    border-color: var(--primary-light); 
    background: var(--hover-bg);
    transform: translateY(-2px);
    color: var(--text);
}

/* Brand Section */
.brand { 
    padding: 36px 28px; 
    text-align: center; 
    border-bottom: 1px solid var(--card-border);
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.05), transparent);
}
.brand img { 
    display: block !important; 
    max-width: 140px !important; 
    height: auto !important; 
    object-fit: contain !important;
    margin: 0 auto;
    filter: drop-shadow(0 6px 12px rgba(99, 102, 241, 0.2));
}
.brand-title { 
    font-weight: 900; 
    font-size: 22px; 
    margin-top: 18px; 
    background: linear-gradient(135deg, #FFF, #C084FC);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.brand-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; font-weight: 600; letter-spacing: 0.5px;}

.page-title { 
    font-weight: 900; 
    font-size: 26px; 
    background: linear-gradient(135deg, #FFF, var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Tables */
.admin-table { border-collapse: separate; border-spacing: 0; width: 100%; }
.admin-table th { 
    position: sticky; 
    top: 0; 
    background: var(--sidebar-bg);
    backdrop-filter: blur(10px);
    z-index: 1;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-align: left;
    padding: 18px 24px;
    border-bottom: 2px solid var(--card-border);
}
.admin-table td { padding: 18px 24px; border-bottom: 1px solid var(--card-border); color: var(--text); }
.admin-table tr { transition: all var(--anim-fast); }
.admin-table tr:hover { background: var(--hover-bg); }

.pill { 
    display: inline-flex; 
    padding: 6px 14px; 
    border-radius: 999px; 
    background: var(--pill-bg); 
    font-weight: 700; 
    font-size: 11px; 
    text-transform: uppercase;
    letter-spacing: 0.8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--card-border);
    align-items: center;
    justify-content: center;
    color: var(--text);
}
.pill-success { background: rgba(16, 185, 129, 0.15); color: #34D399; border-color: rgba(16, 185, 129, 0.3); }
.pill-warning { background: rgba(245, 158, 11, 0.15); color: #FBBF24; border-color: rgba(245, 158, 11, 0.3); }
.pill-danger { background: rgba(239, 68, 68, 0.15); color: #F87171; border-color: rgba(239, 68, 68, 0.3); }
.pill-info { background: rgba(99, 102, 241, 0.15); color: #818CF8; border-color: rgba(99, 102, 241, 0.3); }

.progress-bar { transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Auth Overlay container */
#auth-overlay {
    background: radial-gradient(circle at center, #0F172A 0%, #030712 100%) !important;
}
#auth-overlay .card {
    background: rgba(17, 24, 39, 0.8);
    box-shadow: 0 30px 70px rgba(0,0,0,0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Tabs */
.tabs { display: flex; gap: 12px; margin-bottom: 32px; flex-wrap: wrap; }
.tab { 
    padding: 14px 26px; 
    border-radius: var(--radius-md); 
    background: var(--pill-bg); 
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border); 
    cursor: pointer; 
    font-weight: 700;
    font-size: 14px;
    font-family: var(--font-heading);
    transition: all var(--anim-bounce);
    color: var(--text-muted);
}
.tab:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); color: var(--text); }
.tab.active { 
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)); 
    color: white; 
    border-color: transparent; 
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

/* Insight and Recommendations styling */
.insight-card {
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.6), rgba(17, 24, 39, 0.6));
    backdrop-filter: blur(15px);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 28px;
    border-left: 5px solid var(--primary);
    box-shadow: var(--shadow-md);
    transition: all var(--anim-bounce);
    border-top: 1px solid var(--card-border);
    border-right: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
}
.insight-card:hover { transform: translateX(6px); box-shadow: var(--shadow-lg); }
.insight-card h4 { margin: 0 0 12px; color: white; display: flex; align-items: center; gap: 10px; font-size: 18px; }
.insight-card p { margin: 0; color: var(--text-muted); font-size: 15px; line-height: 1.7; }

.recommendation-card {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.05), rgba(17, 24, 39, 0.6));
    backdrop-filter: blur(15px);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 28px;
    border-left: 5px solid var(--secondary);
    box-shadow: var(--shadow-md);
    transition: all var(--anim-bounce);
    border-top: 1px solid var(--card-border);
    border-right: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
}
.recommendation-card:hover { transform: translateX(6px); box-shadow: var(--shadow-lg); }
.recommendation-card h4 { margin: 0 0 12px; color: white; display: flex; align-items: center; gap: 10px; font-size: 18px; }
.recommendation-card p { margin: 0; color: var(--text-muted); font-size: 15px; line-height: 1.7; }

.activity-item {
    display: flex;
    gap: 18px;
    padding: 18px 0;
    border-bottom: 1px solid var(--card-border);
    transition: all var(--anim-fast);
}
.activity-item:hover { background: rgba(255, 255, 255, 0.01); border-radius: 8px; padding: 18px; margin: 0 -18px; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.3); }

.loading-spinner {
    width: 44px; height: 44px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 30px auto;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.toast {
    min-width: 320px;
    background: var(--toast-bg);
    padding: 18px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--card-border);
    border-left: 5px solid var(--primary);
    transform: translateX(120%);
    transition: transform var(--anim-bounce);
    font-weight: 600;
    color: var(--text);
}
.toast.active { transform: translateX(0); }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info { border-left-color: var(--primary-light); }

.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 10, 18, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--anim-fast) forwards;
}
.dialog {
    background: var(--modal-bg);
    border: 1px solid var(--card-border);
    width: 100%;
    max-width: 440px;
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: var(--shadow-xl);
    text-align: center;
    transform: scale(0.95);
    animation: scaleUp var(--anim-bounce) forwards;
}
.dialog-icon {
    font-size: 42px;
    margin-bottom: 24px;
}
.dialog-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text);
}
.dialog-msg {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 28px;
}
.dialog-actions {
    display: flex;
    gap: 14px;
}

/* Digital Shaoor! Tier Badges & Cards */
.badge-free {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-pro {
    background: rgba(99, 102, 241, 0.15);
    color: #818CF8;
    border: 1px solid rgba(99, 102, 241, 0.35);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.level-card-pro {
    position: relative;
    border: 1px solid rgba(99, 102, 241, 0.25) !important;
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.8) 0%, rgba(30, 27, 75, 0.4) 100%) !important;
}

.level-card-pro::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 90px;
    height: 90px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    pointer-events: none;
}


/* --- INDUSTRY STANDARD MODULE STUDIO & MULTIMEDIA SUITE --- */
.studio-modal-content {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
    color: #f8fafc;
    width: 95vw;
    max-width: 960px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: studioFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes studioFadeIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.studio-header {
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.95);
}
.studio-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 20px;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
}
.studio-tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.studio-tab-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.04);
}
.studio-tab-btn.active {
    color: #ffffff;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}
.studio-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}
.studio-tab-pane {
    display: none;
}
.studio-tab-pane.active {
    display: block;
    animation: fadeIn 0.2s ease;
}
.studio-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.95);
}
.video-lang-pill {
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.video-lang-pill.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: 1px solid #34d399;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.4);
}
.video-lang-pill.inactive {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.video-lang-pill.inactive:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ==================== AI ASSISTANT CHAT BUBBLES & HIGH CONTRAST ==================== */
.ai-bubble {
    max-width: 85%;
    padding: 18px 22px;
    border-radius: 20px;
    line-height: 1.7;
    font-size: 15px;
    position: relative;
    box-sizing: border-box;
}

.ai-bubble-user {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff !important;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.ai-bubble-assistant {
    background: #ffffff !important; /* White Background Always */
    color: #0f172a !important;      /* Deep Dark Charcoal Black Always */
    border: 1px solid #e2e8f0 !important;
    border-bottom-left-radius: 4px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08) !important;
}

/* Force All Typography inside AI Bubble Assistant to be Crisp & Dark Always */
.ai-bubble-assistant,
.ai-bubble-assistant *,
.ai-rendered-output,
.ai-rendered-output * {
    color: #0f172a !important;
}

.ai-bubble-assistant h1,
.ai-bubble-assistant h2,
.ai-bubble-assistant h3,
.ai-bubble-assistant h4,
.ai-bubble-assistant h5,
.ai-bubble-assistant h6 {
    color: #000000 !important;
    margin: 14px 0 8px 0;
    font-family: var(--font-heading);
    font-weight: 800 !important;
    line-height: 1.35;
}

.ai-bubble-assistant p {
    color: #0f172a !important;
    margin: 0 0 10px 0;
    line-height: 1.7;
    font-size: 15px;
    font-weight: 500 !important;
}

.ai-bubble-assistant strong,
.ai-bubble-assistant b {
    color: #000000 !important;
    font-weight: 800 !important;
}

.ai-bubble-assistant em,
.ai-bubble-assistant i {
    color: #1e293b !important;
    font-style: italic;
}

.ai-bubble-assistant span {
    color: #0f172a !important;
}

/* High-Contrast Tables inside AI Assistant: White background with Dark Text Always */
.ai-bubble-assistant table {
    width: 100%;
    border-collapse: collapse !important;
    margin: 14px 0;
    border: 2px solid #cbd5e1 !important;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff !important;
    font-size: 14px;
}

.ai-bubble-assistant th {
    background: #f1f5f9 !important;
    color: #000000 !important;
    font-weight: 800 !important;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 2px solid #cbd5e1 !important;
    border-right: 1px solid #e2e8f0 !important;
}

.ai-bubble-assistant td {
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0 !important;
    border-right: 1px solid #f1f5f9 !important;
    color: #0f172a !important;
    vertical-align: top;
    line-height: 1.6;
    background: #ffffff !important;
    font-weight: 500 !important;
}

.ai-bubble-assistant tr:last-child td {
    border-bottom: none !important;
}

.ai-bubble-assistant tr:nth-child(even) td {
    background: #f8fafc !important;
}

/* Lists inside AI Bubble: Dark Color Always */
.ai-bubble-assistant ul,
.ai-bubble-assistant ol {
    padding-left: 24px;
    margin: 10px 0;
    color: #0f172a !important;
}

.ai-bubble-assistant li {
    margin-bottom: 6px;
    line-height: 1.6;
    color: #0f172a !important;
    font-weight: 500 !important;
}

/* Code & Blockquotes */
.ai-bubble-assistant code {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    padding: 2px 7px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 13.5px;
    border: 1px solid #cbd5e1 !important;
    font-weight: 700 !important;
}

.ai-bubble-assistant pre {
    background: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px;
    padding: 14px;
    overflow-x: auto;
    margin: 12px 0;
}

.ai-bubble-assistant pre code {
    background: transparent !important;
    color: #f8fafc !important;
    border: none !important;
}

.ai-bubble-assistant blockquote {
    border-left: 4px solid var(--primary) !important;
    background: #f8fafc !important;
    padding: 10px 16px;
    border-radius: 0 8px 8px 0;
    color: #334155 !important;
    margin: 12px 0;
    font-style: italic;
}

.ai-bubble-assistant a {
    color: #4338ca !important;
    text-decoration: underline !important;
    font-weight: 700 !important;
}

/* ==================== INTERACTIVE AUDIO MASTERCLASS PLAYER ==================== */
.audio-player-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 14px;
    padding: 18px 22px;
    margin: 14px 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    position: relative;
    overflow: hidden;
}

.audio-player-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #10b981, #6366f1);
}

.audio-ctrl-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 18px;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.audio-ctrl-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.6);
}

.audio-scrubber {
    flex: 1;
    height: 6px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.12);
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.audio-scrubber-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #10b981, #6366f1);
    border-radius: 99px;
    transition: width 0.1s linear;
}

/* ==================== PROVIDER INTEGRATIONS (CANVA, GMAIL, DRIVE) ==================== */
.provider-card {
    background: rgba(17, 24, 39, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 16px 0;
    transition: border-color 0.2s, transform 0.2s;
}

.provider-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.provider-btn-canva {
    background: linear-gradient(135deg, #7D2AE8 0%, #00C4CC 100%);
    color: white !important;
    border: none;
    font-weight: 700;
    border-radius: 10px;
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(125, 42, 232, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}

.provider-btn-canva:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(125, 42, 232, 0.5);
}

.provider-btn-gmail {
    background: linear-gradient(135deg, #EA4335 0%, #D93025 100%);
    color: white !important;
    border: none;
    font-weight: 700;
    border-radius: 10px;
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(234, 67, 53, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}

.provider-btn-gmail:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(234, 67, 53, 0.5);
}

.provider-btn-cloud {
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0 !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-weight: 600;
    border-radius: 10px;
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.provider-btn-cloud:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white !important;
    transform: translateY(-2px);
}

/* ==========================================================================
   DIGITAL SHAOOR! — REGIONAL LANGUAGES & BIDI RTL TYPOGRAPHY ENGINE
   ========================================================================== */

/* Universal RTL & Nastaliq Rules */
[dir="rtl"], .rtl-mode, .urdu-content {
    direction: rtl !important;
    text-align: right !important;
    font-family: 'Noto Nastaliq Urdu', 'Urdu Typesetting', 'Jameel Noori Nastaleeq', 'Noto Sans Arabic', serif;
}

[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4,
.urdu-heading {
    font-family: 'Noto Nastaliq Urdu', 'Urdu Typesetting', serif !important;
    line-height: 2.1 !important;
    letter-spacing: normal !important;
}

[dir="rtl"] p, .urdu-desc, .urdu-text {
    font-family: 'Noto Nastaliq Urdu', 'Urdu Typesetting', serif !important;
    line-height: 2.3 !important;
    letter-spacing: normal !important;
    word-spacing: 0.08em;
}

/* BiDi Isolation: Prevent Latin words (e.g. TikTok, Reels, Digital Shaoor!) from flipping Urdu sentence order */
.latin-chip,
[dir="rtl"] bdi,
[dir="rtl"] .latin-text,
.urdu-content bdi {
    display: inline-block !important;
    direction: ltr !important;
    unicode-bidi: isolate !important;
    font-family: var(--font-body), system-ui, -apple-system, sans-serif !important;
    font-size: 0.92em;
    font-weight: 700;
    padding: 1px 7px;
    margin: 0 4px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 6px;
    color: #ffffff !important;
    vertical-align: baseline;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* RTL Bulleted Lists (Fix left/right clipping & indent overlap) */
[dir="rtl"] ul, .urdu-content ul {
    padding-right: 24px !important;
    padding-left: 0 !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    list-style-position: outside !important;
}

[dir="rtl"] li, .urdu-content li {
    margin-bottom: 8px;
    line-height: 2.1 !important;
}

/* Language Selector Dropdown / Floating Switcher */
.lang-selector-wrap {
    position: relative;
    display: inline-block;
}

.lang-selector-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 8px 14px;
    color: #e2e8f0;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.lang-selector-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-light);
    color: white;
}

.lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: none;
    animation: fadeInDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.lang-dropdown-menu.active {
    display: block;
}

.lang-option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 13.5px;
    cursor: pointer;
    transition: background 0.15s;
}

.lang-option-item:hover, .lang-option-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: #ffffff;
    font-weight: 700;
}

.lang-option-item .native-name {
    font-size: 14.5px;
    font-weight: 700;
}

.lang-option-item .badge-pill {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

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

/* ==========================================================================
   DIGITAL SHAOOR! — PWA SECURITY, BIOMETRIC & PIN LOCK SCREEN
   ========================================================================== */
#pwa-security-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(6, 9, 17, 0.94);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: pwaFadeIn 0.3s ease;
}

.pwa-lock-card {
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(16, 185, 129, 0.15);
}

.pwa-app-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #10b981 0%, #6366f1 100%);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}

.pwa-pin-display {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 24px 0 32px;
}

.pwa-pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pwa-pin-dot.filled {
    background: #10b981;
    border-color: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
    transform: scale(1.15);
}

.pwa-pin-dot.error {
    background: #ef4444;
    border-color: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
    animation: shake 0.4s ease;
}

.pwa-keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 290px;
    margin: 0 auto;
}

.pwa-key-btn {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.pwa-key-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.92);
}

.pwa-key-btn .key-sub {
    font-size: 9px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-top: -2px;
}

.pwa-biometric-btn {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-top: 24px;
    transition: all 0.2s;
}

.pwa-biometric-btn:hover {
    background: rgba(16, 185, 129, 0.22);
    transform: translateY(-2px);
}

/* PWA App Install Banner */
#pwa-install-banner {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 18px;
    padding: 16px 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(16, 185, 129, 0.2);
    backdrop-filter: blur(16px);
    display: none;
    align-items: center;
    gap: 16px;
    max-width: 420px;
    animation: pwaSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@keyframes pwaFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* ==========================================================================
   SUPERADMIN CONTENT STUDIO & NOTION AI AGENT STYLES
   ========================================================================== */

.studio-modal-content {
    background: #0b1120;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.85), 0 0 40px rgba(99, 102, 241, 0.15);
    width: 95%;
    max-width: 1080px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    animation: pwaSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.studio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px;
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.studio-tabs {
    display: flex;
    gap: 6px;
    padding: 10px 24px;
    background: rgba(15, 23, 42, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
}

.studio-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.studio-tab-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.studio-tab-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(16, 185, 129, 0.25) 100%);
    border: 1px solid rgba(99, 102, 241, 0.4);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.15);
}

.studio-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

.studio-tab-pane {
    display: none;
}

.studio-tab-pane.active {
    display: block;
    animation: pwaFadeIn 0.2s ease;
}

.studio-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background: rgba(15, 23, 42, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Notion AI Studio Prompt Box */
.notion-agent-studio {
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.9) 0%, rgba(11, 15, 25, 0.95) 100%);
    border: 1.5px solid rgba(16, 185, 129, 0.35);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(16, 185, 129, 0.1);
    margin-bottom: 24px;
}

.notion-prompt-chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    font-size: 11.5px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.notion-prompt-chip:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
    transform: translateY(-1px);
}

.media-badge-pill {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.media-badge-video {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.media-badge-image {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.media-badge-doc {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

.media-badge-quiz {
    background: rgba(217, 70, 239, 0.15);
    border: 1px solid rgba(217, 70, 239, 0.3);
    color: #f472b6;
}

.level-command-card {
    background: rgba(17, 24, 39, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.25s ease;
}

.level-command-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.level-command-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-wrap: wrap;
    gap: 12px;
}




/* ==========================================================================
   ULTRA-COMPREHENSIVE MOBILE RESPONSIVENESS OVERRIDES (MAX-WIDTH: 768px)
   Guarantees all modals, edit cards, forms, tables, and buttons fit cleanly
   on small screens without truncation, overflowing, or being obscured.
   ========================================================================== */
body.modal-open {
    overflow: hidden !important;
}

body.modal-open .mobile-bottom-bar,
body:has(.modal-backdrop) .mobile-bottom-bar {
    display: none !important;
}

@media (max-width: 768px) {
    /* Hide bottom navigation bar when any modal is active */
    body.modal-open .mobile-bottom-bar,
    body:has(.modal-backdrop) .mobile-bottom-bar {
        display: none !important;
    }

    .modal-backdrop {
        z-index: 99999 !important;
        padding: 8px 8px calc(16px + env(safe-area-inset-bottom, 0px)) 8px !important;
        align-items: flex-end !important;
        justify-content: center !important;
    }

    .modal, .studio-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: calc(100dvh - 16px) !important;
        margin: 0 !important;
        border-radius: 20px 20px 12px 12px !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .studio-header, .modal header {
        padding: 14px 16px !important;
        flex-shrink: 0 !important;
    }

    .studio-tabs {
        padding: 6px 10px !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .studio-body, .modal .body {
        padding: 14px 16px !important;
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        max-height: none !important;
        padding-bottom: 24px !important;
    }

    .studio-footer, .modal footer {
        padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
        flex-shrink: 0 !important;
        flex-direction: column !important;
        gap: 10px !important;
        background: #0d1322 !important;
        border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
    }

    .studio-footer > div:first-child,
    .studio-footer > div:last-child {
        width: 100% !important;
        display: flex !important;
        gap: 8px !important;
    }

    .studio-footer button,
    .studio-footer .btn {
        flex: 1 !important;
        width: 100% !important;
        min-height: 44px !important;
        font-size: 13.5px !important;
        justify-content: center !important;
    }

    /* Stack ALL 2-column and multi-column grids cleanly into 1 single column on mobile */
    .studio-grid-2col,
    .form-grid,
    .modal [style*="grid-template-columns"],
    .studio-modal-content [style*="grid-template-columns"],
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: repeat(2"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .form-group,
    .modal .form-group,
    .studio-modal-content .form-group {
        width: 100% !important;
        min-width: 0 !important;
        margin-bottom: 4px !important;
    }

    .form-input,
    .modal input,
    .modal select,
    .modal textarea,
    .studio-modal-content input,
    .studio-modal-content select,
    .studio-modal-content textarea {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        font-size: 14.5px !important;
        padding: 11px 13px !important;
    }

    /* Executive Command Bar on Dashboard */
    .exec-command-bar {
        flex-direction: column !important;
        align-items: stretch !important;
    }
}
