:root {
    /* Premium Color Palette */
    --bg-gradient: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    --surface-glass: rgba(255, 255, 255, 0.08);
    --surface-glass-hover: rgba(255, 255, 255, 0.12);
    --border-glass: rgba(255, 255, 255, 0.1);

    --primary-color: #7c5dfa;
    /* Modern Purple */
    --primary-hover: #5e3dc2;
    --accent-color: #00d2d3;
    /* Cyan Accent */
    --danger-color: #ff6b6b;
    --success-color: #2ecc71;

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);

    --shadow-soft: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    font-family: var(--font-main);
    background: var(--bg-gradient);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    letter-spacing: -0.01em;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* --- Glassmorphism Utilities --- */

.glass-panel {
    background: var(--surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 1.5rem;
    transition: transform 0.3s ease, background 0.3s ease;
}

/* --- Layout --- */

.container {
    display: flex;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-glass);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar h3 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #a5a5a5);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 3rem;
    letter-spacing: -0.02em;
}

.nav-item {
    display: block;
    text-decoration: none;
    color: var(--text-secondary);
    padding: 1rem 1.2rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: var(--surface-glass);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: rgba(124, 93, 250, 0.2);
    color: #fff;
    border-color: rgba(124, 93, 250, 0.3);
}

.main-content {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
    position: relative;
}

/* --- Components --- */

h1,
h2,
h3,
h4 {
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(124, 93, 250, 0.3);
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(124, 93, 250, 0.4);
}

input,
select,
textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: all 0.2s ease;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 3px rgba(124, 93, 250, 0.2);
}

/* --- Specific Sections --- */

.section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.section.active {
    display: block;
}

.section.hidden {
    display: none !important;
}

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

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

/* Chat Styles */
.chat-box {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    overflow-y: auto;
    border: 1px solid var(--border-glass);
}

.message {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    max-width: 85%;
    line-height: 1.5;
}

.message.ai {
    background: rgba(124, 93, 250, 0.15);
    border-radius: 2px 20px 20px 20px;
    border-left: 3px solid var(--primary-color);
}

.message.user {
    background: rgba(255, 255, 255, 0.1);
    margin-left: auto;
    border-radius: 20px 20px 2px 20px;
}

.feedback-correct {
    border-left: 3px solid var(--success-color) !important;
    background: rgba(46, 204, 113, 0.1) !important;
}

.feedback-wrong {
    border-left: 3px solid var(--danger-color) !important;
    background: rgba(255, 107, 107, 0.1) !important;
}

/* Auth Pages Layout */
.auth-layout {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: 100vh;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* --- Media Library Grid --- */

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

.library-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
}

.filter-tab {
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.filter-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.filter-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    padding-bottom: 2rem;
}

.media-card {
    background: rgba(25, 30, 50, 0.6);
    /* Darker, less transparent */
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* Faster transition */
    display: flex;
    flex-direction: column;
    position: relative;
    /* backdrop-filter: blur(20px);  <-- REMOVED for Performance */
    cursor: pointer;
}

.media-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background: rgba(40, 45, 70, 0.8);
    border-color: var(--primary-color);
}

.media-thumbnail {
    height: 200px;
    width: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.media-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.media-card:hover .media-thumbnail img {
    transform: scale(1.15);
}

.media-thumbnail .video-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.media-thumbnail .play-icon {
    position: absolute;
    font-size: 4rem;
    color: white;
    opacity: 0.9;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
    transition: all 0.3s;
    background: rgba(124, 93, 250, 0.3);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.media-card:hover .media-thumbnail .play-icon {
    opacity: 1;
    transform: scale(1.2);
    background: rgba(124, 93, 250, 0.6);
}

.media-duration {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.media-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.75rem;
}

.media-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0;
    line-height: 1.4;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.media-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.media-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: rgba(124, 93, 250, 0.15);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
}

.media-footer {
    padding: 0 1.5rem 1.5rem;
    margin-top: auto;
}

.media-actions {
    display: flex;
    gap: 0.5rem;
}

.media-actions .btn {
    flex: 1;
    padding: 0.75rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

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

.stats-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

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

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

/* ========================================
   RESPONSIVE DESIGN - Media Queries
   ======================================== */

/* --- Mobile Menu Toggle Button --- */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--primary-color);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    cursor: pointer;
    color: white;
    font-size: 1.5rem;
    box-shadow: var(--shadow-soft);
}

/* --- Mobile Overlay --- */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
}

.mobile-overlay.active {
    display: block;
}

/* --- TABLET (max-width: 1024px) --- */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
        padding: 1.5rem;
    }

    .sidebar h3 {
        font-size: 1.2rem;
        margin-bottom: 2rem;
    }

    .nav-item {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .main-content {
        padding: 1.5rem;
    }

    .glass-panel {
        padding: 1rem;
    }

    /* Admin tables */
    table {
        font-size: 0.85rem;
    }

    th,
    td {
        padding: 0.75rem 0.5rem;
    }

    /* Media grid */
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

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

    /* Show mobile menu button */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Hide sidebar by default, show when active */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        width: 280px;
        z-index: 1000;
        transition: left 0.3s ease;
        padding-top: 4rem;
    }

    .sidebar.active {
        left: 0;
    }

    /* Admin container single column */
    .admin-container {
        flex-direction: column;
    }

    /* Main content full width */
    .main-content {
        padding: 4rem 1rem 1rem 1rem;
        width: 100%;
    }

    /* Typography adjustments */
    h1 {
        font-size: 1.5rem;
    }

    h2,
    h3 {
        font-size: 1.1rem;
    }

    /* Glass panels */
    .glass-panel {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    /* Scrollable tables */
    .table-container,
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
        font-size: 0.8rem;
    }

    th,
    td {
        padding: 0.5rem;
        white-space: nowrap;
    }

    /* Media grid single column */
    .media-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Buttons smaller */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    /* Form inputs */
    input,
    select,
    textarea {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Filter tabs scroll */
    .filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .filter-tab {
        flex-shrink: 0;
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Library container stack */
    .library-container {
        flex-direction: column !important;
        height: auto !important;
    }

    .library-tree-sidebar {
        width: 100% !important;
        max-height: 200px;
        margin-bottom: 1rem;
    }

    /* Modal adjustments */
    .modal-content {
        width: 95%;
        max-width: none;
        padding: 1.5rem;
        margin: 1rem;
    }

    /* Auth layout */
    .auth-layout .glass-panel {
        width: 95%;
        max-width: 400px;
    }
}

/* --- SMALL MOBILE (max-width: 480px) --- */
@media (max-width: 480px) {
    .mobile-menu-btn {
        top: 0.5rem;
        left: 0.5rem;
        padding: 0.5rem;
        font-size: 1.2rem;
    }

    .main-content {
        padding: 3.5rem 0.75rem 0.75rem 0.75rem;
    }

    h1 {
        font-size: 1.25rem;
    }

    .glass-panel {
        padding: 0.75rem;
    }

    table {
        font-size: 0.75rem;
    }

    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* --- Notification Badge --- */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ff4757;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 10px;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {

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

    50% {
        transform: scale(1.1);
    }
}

/* --- Responsive Modal Styles --- */
#ask-teacher-modal .glass-panel,
#reply-modal .modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

@media (max-width: 600px) {

    #ask-teacher-modal .glass-panel,
    .modal-content {
        width: 95% !important;
        max-width: 100% !important;
        margin: 10px;
        padding: 1rem;
    }

    #ask-teacher-modal h3,
    .modal-content h3 {
        font-size: 1.1rem;
    }

    #ask-teacher-modal textarea,
    .modal-content textarea {
        font-size: 14px;
        rows: 3;
    }

    #ask-teacher-modal .glass-panel>div,
    .modal-content>div {
        margin-bottom: 0.75rem;
    }
}
/* ========================================
   LIGHT THEME INPUTS (FINAL)
   ======================================== */

[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="number"],
[data-theme="light"] textarea,
[data-theme="light"] select {
    background: white;
    border: 1.5px solid #cbd5e1;
    color: #1e293b;
}

[data-theme="light"] input:focus,
[data-theme="light"] textarea:focus,
[data-theme="light"] select:focus {
    border-color: var(--primary-color);
    outline: 2px solid rgba(102, 126, 234, 0.2);
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

/* XP Bar visibility */
    background: rgba(0, 0, 0, 0.15);
}

/* Glass panels */
[data-theme="light"] .glass-panel {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Tables */
[data-theme="light"] th {
    background: rgba(0, 0, 0, 0.08);
    color: #1a237e;
}

[data-theme="light"] td {
    color: #333;
}

/* ========================================
   LIGHT THEME COMPLETE (From Tool History)
   ======================================== */

/* Input visibility - Step 1543 */
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="number"],
[data-theme="light"] textarea,
[data-theme="light"] select {
    background: rgba(0, 0, 0, 0.03);
    border: 1.5px solid rgba(0, 0, 0, 0.2);
    color: #1a237e;
}

[data-theme="light"] input:focus,
[data-theme="light"] textarea:focus,
[data-theme="light"] select:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

/* XP bar - Step 1423 */
    background: rgba(0, 0, 0, 0.15);
}

    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

    background: rgba(0, 0, 0, 0.08);
}

/* Panels & Tables - Step 1531 */
[data-theme="light"] .glass-panel {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] table {
    background: rgba(255, 255, 255, 0.5);
}

[data-theme="light"] th {
    background: rgba(0, 0, 0, 0.08);
    color: #1a237e;
}

[data-theme="light"] td {
    color: #333;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="light"] tbody tr:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* Unit cards - Previous sessions */
[data-theme="light"] .unit-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a237e;
}

[data-theme="light"] .unit-card:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: var(--primary-color);
}

/* ========================================
   THEME TOGGLE BUTTON (Floating)
   ======================================== */

    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 9999;
}

    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.5);
}

    transform: scale(0.95);
}

    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.3);
}

    box-shadow: 0 6px 30px rgba(251, 191, 36, 0.5);
}

/* ========================================
   LOADING STATES - Spinner & Skeleton
   ======================================== */

/* Modern Spinner */
.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(124, 93, 250, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-small {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

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

.spinner-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-card {
    height: 200px;
    margin-bottom: 1rem;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 12, 41, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: inherit;
}

/* Button Loading State */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ========================================
   LIGHT THEME - LOGO & NAV FIXES
   ======================================== */

[data-theme="light"] .sidebar h3 {
    background: linear-gradient(to right, #1a237e, #5e35b1, #7c5dfa);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .nav-item {
    color: rgba(0, 0, 0, 0.7);
}

[data-theme="light"] .nav-item:hover,
[data-theme="light"] .nav-item.active {
    color: rgba(0, 0, 0, 0.9);
    background: rgba(94, 53, 177, 0.1);
}

/* ========================================
   LIGHT THEME - BUTTONS
   ======================================== */

[data-theme="light"] .btn-secondary,
[data-theme="light"] button.btn-secondary {
    background: rgba(0, 0, 0, 0.08) !important;
    color: #1a237e !important;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.15) !important;
    color: #000 !important;
}

/* ========================================
   LIGHT THEME - UNIT CARDS
   ======================================== */

[data-theme="light"] .unit-card {
    background: rgba(94, 53, 177, 0.08) !important;
    border: 2px solid rgba(94, 53, 177, 0.2) !important;
    color: #1a237e;
}

[data-theme="light"] .unit-card:hover {
    background: rgba(94, 53, 177, 0.15) !important;
    border-color: rgba(94, 53, 177, 0.4) !important;
    box-shadow: 0 8px 24px rgba(94, 53, 177, 0.2) !important;
}

[data-theme="light"] .unit-card h3 {
    color: #1a237e !important;
}

[data-theme="light"] .unit-card p {
    color: rgba(0, 0, 0, 0.7) !important;
}

/* ========================================
   COMPLETE LIGHT THEME SYSTEM
   ======================================== */

/* Light Theme Variables */
[data-theme="light"] {
    /* Backgrounds */
    --bg-gradient: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 50%, #90caf9 100%);
    --surface-glass: rgba(255, 255, 255, 0.8);
    --surface-glass-hover: rgba(255, 255, 255, 0.95);
    --border-glass: rgba(0, 0, 0, 0.1);
    
    /* Colors */
    --primary-color: #5e35b1;
    --primary-hover: #4527a0;
    --accent-color: #00acc1;
    --danger-color: #e53935;
    --success-color: #43a047;
    
    /* Text */
    --text-primary: #212121;
    --text-secondary: rgba(0, 0, 0, 0.7);
    --text-muted: rgba(0, 0, 0, 0.5);
    
    /* Shadows */
    --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Smooth transitions */
body,
.glass-panel,
.sidebar,
.main-content,
.btn,
input,
select,
textarea,
.media-card {
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Sidebar */
[data-theme="light"] .sidebar {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

/* Media Cards */
[data-theme="light"] .media-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .media-card:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Chat Box */
[data-theme="light"] .chat-box {
    background: rgba(255, 255, 255, 0.5);
}

[data-theme="light"] .message.ai {
    background: rgba(94, 53, 177, 0.1);
    border-left-color: var(--primary-color);
}

[data-theme="light"] .message.user {
    background: rgba(0, 0, 0, 0.05);
}

/* Headings */
[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3 {
    color: #1a237e;
}

/* Links */
[data-theme="light"] a {
    color: #5e35b1;
}

[data-theme="light"] a:hover {
    color: #4527a0;
}

/* Badges */
[data-theme="light"] .badge {
    background: rgba(94, 53, 177, 0.15);
    color: #5e35b1;
}

/* Meta tags */
[data-theme="light"] .meta-tag {
    background: rgba(94, 53, 177, 0.1);
    color: #5e35b1;
    border: 1px solid rgba(94, 53, 177, 0.2);
}

/* Primary buttons keep white text */
[data-theme="light"] .btn.btn-primary,
[data-theme="light"] button:not(.btn-secondary) {
    color: white !important;
}

/* THEME TOGGLE - Force bottom right */
.theme-toggle-btn,
#themeToggleBtn {
    position: fixed !important;
    bottom: 2rem !important;
    right: 2rem !important;
    top: auto !important;
    left: auto !important;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover,
#themeToggleBtn:hover {
    transform: scale(1.1) rotate(15deg);
}

/* FIX MINI PROFILE - Compact & Beautiful */
.mini-profile-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.25rem;
    margin: 1rem 0.75rem 1.5rem;
    backdrop-filter: blur(10px);
}

.mini-profile-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 1rem;
}

.mini-profile-avatar {
    font-size: 2.5rem;
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mini-profile-info {
    flex: 1;
    min-width: 0;
}

.mini-username {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.mini-level {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 700;
}

.mini-xp-bar {
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.mini-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
    transition: width 0.5s ease;
    width: 0%;
}

.mini-xp-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1rem;
    font-weight: 600;
}

.mini-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.mini-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.625rem;
    border-radius: 10px;
}

.mini-stat-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.mini-stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ========================================
   FIX: THEME TOGGLE BOTTOM RIGHT
   ======================================== */
.theme-toggle-btn,
#themeToggleBtn {
    position: fixed !important;
    bottom: 2rem !important;
    right: 2rem !important;
    width: 60px !important;
    height: 60px !important;
    z-index: 9999 !important;
}

/* ========================================
   FIX: MINI PROFILE COMPACT LAYOUT
   ======================================== */
.mini-profile-card {
    padding: 1.25rem !important;
    margin: 1rem 0.75rem 1.5rem !important;
}

.mini-profile-header {
    display: flex !important;
    align-items: center !important;
    gap: 0.875rem !important;
}

.mini-profile-avatar {
    width: 56px !important;
    height: 56px !important;
    flex-shrink: 0 !important;
}

.mini-username {
    font-size: 1.1rem !important;
    font-weight: 700 !important;
}

.mini-stats {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.75rem !important;
}

.mini-stat {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

/* ========================================
   LIGHT THEME - PROGRESS BARS VISIBILITY
   ======================================== */

/* XP Bars - Mini Profile & Main Profile */
[data-theme="light"] .mini-xp-bar,
[data-theme="light"] .xp-bar,
[data-theme="light"] .progress-bar-bg {
    background: rgba(0, 0, 0, 0.15) !important;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Progress fills - keep colorful */
[data-theme="light"] .mini-xp-fill,
[data-theme="light"] .xp-fill,
[data-theme="light"] .progress-bar-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%) !important;
}

/* Circular progress (if any) */
[data-theme="light"] .circular-progress-bg {
    stroke: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .circular-progress-fill {
    stroke: #667eea;
}

/* Achievement progress bars */
[data-theme="light"] .achievement-progress {
    background: rgba(0, 0, 0, 0.12);
}

/* Any generic progress container */
[data-theme="light"] .progress-container,
[data-theme="light"] .progress {
    background: rgba(0, 0, 0, 0.12);
}

/* Streak indicators */
[data-theme="light"] .streak-bar {
    background: rgba(0, 0, 0, 0.1);
}

/* Stats cards progress */
[data-theme="light"] .stat-progress {
    background: rgba(0, 0, 0, 0.1);
}

/* ========================================
   LIGHT THEME - BADGES & INDICATORS
   ======================================== */

/* Message badges (Bekleyen, Cevaplandı, etc.) */
[data-theme="light"] .badge,
[data-theme="light"] .status-badge {
    background: rgba(94, 53, 177, 0.2) !important;
    color: #4527a0 !important;
    border: 1px solid rgba(94, 53, 177, 0.3);
    font-weight: 700;
}

/* Status indicators */
[data-theme="light"] .status-waiting,
[data-theme="light"] .badge-warning {
    background: rgba(251, 191, 36, 0.2) !important;
    color: #b45309 !important;
    border-color: rgba(251, 191, 36, 0.4);
}

[data-theme="light"] .status-answered,
[data-theme="light"] .badge-success {
    background: rgba(34, 197, 94, 0.2) !important;
    color: #15803d !important;
    border-color: rgba(34, 197, 94, 0.4);
}

[data-theme="light"] .status-error,
[data-theme="light"] .badge-danger {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #b91c1c !important;
    border-color: rgba(239, 68, 68, 0.4);
}

/* Message count badges */
[data-theme="light"] #message-badge,
[data-theme="light"] .notification-badge {
    background: #ef4444 !important;
    color: white !important;
    font-weight: 800;
}

/* Table status cells */
[data-theme="light"] .status-cell {
    font-weight: 600;
}

/* Meta tags in tables */
[data-theme="light"] .meta-tag,
[data-theme="light"] .tag {
    background: rgba(94, 53, 177, 0.15);
    color: #5e35b1;
    border: 1px solid rgba(94, 53, 177, 0.25);
    font-weight: 600;
}

/* ========================================
   LIGHT THEME - PROFILE SECTION XP BAR FIX
   ======================================== */

/* Profile section XP bars - specific targeting */
[data-theme="light"] #profile-section .xp-bar,
[data-theme="light"] #profile-section [class*="xp"],
[data-theme="light"] .profile-xp-bar,
[data-theme="light"] [style*="background: rgba(255,255,255,0.1)"] {
    background: rgba(0, 0, 0, 0.15) !important;
}

/* Stats cards XP progress */
[data-theme="light"] .stat-card .progress-bar,
[data-theme="light"] .stats-grid .xp-bar {
    background: rgba(0, 0, 0, 0.15) !important;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Any progress bar inside glass panels */
[data-theme="light"] .glass-panel [class*="progress"],
[data-theme="light"] .glass-panel [class*="bar"] {
    background: rgba(0, 0, 0, 0.12) !important;
}

/* XP Bar Container - Theme Aware */
.xp-bar-container,
#xp-bar-container {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] .xp-bar-container,
[data-theme="light"] #xp-bar-container {
    background: rgba(0, 0, 0, 0.25) !important;
}

/* ========================================
   FIX: SOLUTION INPUT VISIBILITY
   ======================================== */
#studentSolution {
    transition: all 0.3s ease;
}

[data-theme="light"] #studentSolution {
    background: white !important;
    border: 1.5px solid #cbd5e1 !important;
    color: #1e293b !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

[data-theme="light"] #studentSolution:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15) !important;
}

[data-theme="light"] #studentSolution::placeholder {
    color: rgba(0,0,0,0.4) !important;
}

/* Fix label visibility too */
[data-theme="light"] label {
    color: #1e293b !important;
    font-weight: 600;
}

/* ========================================
   FIX: MESSAGE FILTER BUTTONS
   ======================================== */
.filter-btn {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Light Theme Overrides */
[data-theme="light"] .filter-btn {
    background: white !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
    color: #1e293b !important; /* Dark text */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

[data-theme="light"] .filter-btn:hover {
    background: #f1f5f9 !important;
    border-color: rgba(0,0,0,0.2) !important;
}

[data-theme="light"] .filter-btn.active {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3) !important;
}

/* ========================================
   FIX: ADMIN PANEL INPUTS VISIBILITY
   ======================================== */
[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea,
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="number"],
[data-theme="light"] select {
    background: white !important;
    border: 1.5px solid #cbd5e1 !important; /* Visible grey border */
    color: #1e293b !important; /* Dark text */
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

[data-theme="light"] .form-group input:focus,
[data-theme="light"] .form-group select:focus,
[data-theme="light"] .form-group textarea:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15) !important;
    outline: none !important;
}

[data-theme="light"] .form-group label {
    color: #1e293b !important;
    font-weight: 600;
}

/* Fix select dropdown arrow color if possible, or background */
[data-theme="light"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23333333'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
}

/* ========================================
   FIX: ADMIN MESSAGE TABLE & BUTTONS
   ======================================== */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(30,30,50,0.95); /* Default Dark */
}

/* Light Theme Header */
[data-theme="light"] .sticky-header {
    background: #f1f5f9 !important; /* Light Grey */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

[data-theme="light"] .sticky-header th {
    color: #1e293b !important;
    font-weight: 700;
    border-bottom: 2px solid #e2e8f0 !important;
}

/* Table Buttons Fix */
[data-theme="light"] table .btn {
    background: white !important;
    color: #4b5563 !important;
    border: 1px solid #d1d5db !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

[data-theme="light"] table .btn:hover {
    background: #f3f4f6 !important;
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

/* ========================================
   FIX: DASHBOARD FILTER BUTTONS (OVERRIDE INLINE)
   ======================================== */
[data-theme="light"] #filter-open {
    color: #d97706 !important; /* Darker Orange */
    border-color: #d97706 !important;
    background: #fffbeb !important;
}

[data-theme="light"] #filter-answered {
    color: #059669 !important; /* Darker Green */
    border-color: #059669 !important;
    background: #ecfdf5 !important;
}

[data-theme="light"] #filter-all {
    color: white !important;
    background: var(--primary-color) !important;
}

/* Ensure icons are visible too */
[data-theme="light"] .filter-btn {
    font-weight: 600;
}

/* ========================================
   FIX: ADMIN MESSAGE ACTIONS (REPLY/VIEW)
   ======================================== */
.btn-reply-action {
    background: rgba(46,204,113,0.2);
    color: #2ecc71;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-view-action {
    background: rgba(255,255,255,0.1);
    color: var(--text-secondary);
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

/* Light Theme Overrides */
[data-theme="light"] .btn-reply-action {
    background: #dcfce7 !important; /* Light Green Bg */
    color: #15803d !important;      /* Dark Green Text */
    border: 1px solid #86efac !important;
}

[data-theme="light"] .btn-reply-action:hover {
    background: #bbf7d0 !important;
}

[data-theme="light"] .btn-view-action {
    background: #f1f5f9 !important; /* Light Grey Bg */
    color: #334155 !important;      /* Slate Text */
    border: 1px solid #cbd5e1 !important;
}

[data-theme="light"] .btn-view-action:hover {
    background: #e2e8f0 !important;
}

/* ========================================
   FIX: ADMIN BUTTON TEXT BLACK (USER REQUEST)
   ======================================== */
[data-theme="light"] .btn-reply-action,
[data-theme="light"] .btn-view-action {
    color: #000000 !important; /* Strictly Black */
    font-weight: 600;
}

/* ========================================
   FIX: PAGINATION BUTTONS IN LIGHT THEME
   ======================================== */
[data-theme="light"] #paginationQNumbers .btn:not([style*="var(--primary-color)"]),
[data-theme="light"] #paginationNumbers .btn:not([style*="var(--primary-color)"]) {
    color: #1e293b !important;
    background: white !important;
    border: 1px solid #cbd5e1 !important;
}

[data-theme="light"] #paginationQNumbers .btn:hover,
[data-theme="light"] #paginationNumbers .btn:hover {
    background: #f1f5f9 !important;
    border-color: var(--primary-color) !important;
}
