/* =========================================
   header.css - Finalized with Compact Mobile & Desktop Fixes
   ========================================= */

:root {
    --mobile-nav-height: 65px;
    --mobile-nav-safe-padding: 80px;
    --student-search-bar-height: 45px;
    --text-dark: #1f2937;
    --text-muted: #6c757d;
    --card-bg-default: #ffffff;
    --card-border: #e0e0e0;
    --page-bg: #f8f9fa;
    --primary-color: #007bff;
    --theme-bg: #f8f9fa;
}

/* --- 1. GENERAL HEADER LAYOUT --- */
.main-header {
    background-color: var(--card-bg-default, #ffffff);
    border-bottom: 1px solid var(--card-border, #e0e0e0);
    max-width: 1200px;
    justify-self: center;
    height: 70px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    display: block;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 15px;
}

/* --- 2. LOGO & NAV --- */
.logo-icon {
    display: inline-flex;
    align-items: center;
    height: 100%;
    padding: 5px 10px 5px 0;
    text-decoration: none;
}
.logo-icon img {
    height: 65px;
    width: auto;
    object-fit: contain;
    padding: 3px;
    transition: height 0.2s ease;
}

.main-nav { display: flex; align-items: center; gap: 15px; transition: gap 0.2s ease; }
.main-nav a, .main-nav .dropdown-toggle {
    color: var(--text-dark, #1f2937);
    text-decoration: none;
    font-weight: 500;
}
.main-nav a:hover, .main-nav .dropdown-toggle:hover {
    color: var(--primary-color, #007bff);
}

/* --- DESKTOP ICON LINKS (Outline & Pastel Variants) --- */
.main-nav .nav-icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px !important;     
    height: 52px !important;    
    font-size: 35px !important; /* Lighter, cleaner outline size */
    padding: 0 !important;      
    border-radius: 12px;        /* Modern squircle shape */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
}

.main-nav .nav-icon-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

/* Pastel Variants - using rgba() ensures they adapt to any theme background safely */
.icon-pastel-chat { background-color: rgba(16, 185, 129, 0.12); color: #10b981 !important; }
.icon-pastel-chat:hover { background-color: rgba(16, 185, 129, 0.22); }

.icon-pastel-library { background-color: rgba(59, 130, 246, 0.12); color: #3b82f6 !important; }
.icon-pastel-library:hover { background-color: rgba(59, 130, 246, 0.22); }

.icon-pastel-users { background-color: rgba(245, 158, 11, 0.12); color: #f59e0b !important; }
.icon-pastel-users:hover { background-color: rgba(245, 158, 11, 0.22); }

.icon-pastel-bell { background-color: rgba(139, 92, 246, 0.12); color: #8b5cf6 !important; }
.icon-pastel-bell:hover { background-color: rgba(139, 92, 246, 0.22); }

.icon-pastel-search { background-color: rgba(14, 165, 233, 0.12); color: #0ea5e9 !important; }
.icon-pastel-search:hover { background-color: rgba(14, 165, 233, 0.22); }

.icon-pastel-student { background-color: rgba(236, 72, 153, 0.12); color: #ec4899 !important; }
.icon-pastel-student:hover { background-color: rgba(236, 72, 153, 0.22); }

/* --- NEW AI MAGIC BUTTON --- */
.ai-magic-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    color: white !important;
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 700 !important;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.ai-magic-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
    color: white !important;
}
.ai-magic-btn i { font-size: 1.1rem; }

/* --- DESKTOP CREATE FAB --- */
.desktop-create-btn {
    width: 58px; /* Slightly bigger than the 52px regular icons */
    height: 58px; 
    border-radius: 18px; /* Modern rounded squircle */
    background: linear-gradient(135deg, #10b981 0%, #059669 100%); /* Prominent green gradient */
    color: white !important; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border: none;
    box-shadow: 0 6px 14px rgba(16, 185, 129, 0.35); 
    font-size: 28px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: 0 6px; /* A little breathing room on the sides */
}
.desktop-create-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 8px 18px rgba(16, 185, 129, 0.45); 
}
.desktop-create-dropdown.show .desktop-create-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); 
    transform: rotate(135deg) scale(1.05); 
    box-shadow: 0 6px 14px rgba(239, 68, 68, 0.35);
}

/* Make Desktop Avatar Menu Wider for rich content */
.dropdown-menu-right { min-width: max-content; padding: 10px; }

/* --- 3. AVATAR FIX --- */
.nav-avatar, .initials-placeholder { 
    width: 66px !important; 
    height: 66px !important; 
    min-width: 46px;
    border-radius: 50%; 
    object-fit: cover; 
    vertical-align: middle; 
    border: 3px solid gold; 
    transition: border-color 0.2s; 
    box-sizing: border-box;
}

.initials-placeholder {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    color: #ffffff !important;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
}

.nav-avatar:hover, .initials-placeholder:hover { border-color: #ddd; }

/* --- 4. DROPDOWNS --- */
.nav-item-dropdown { position: relative; display: inline-block; }
.dropdown-toggle {
    background: none; border: none;
    color: var(--text-dark, #1f2937);
    font: inherit; cursor: pointer;
    padding: 10px; font-weight: 500;
}
.dropdown-menu { 
    display: none; 
    position: absolute; 
    top: 100%; right: 0;
    background-color: var(--card-bg-default, white); 
    box-shadow: 0 8px 16px rgba(0,0,0,0.15); 
    z-index: 1001; 
    border-radius: 8px; 
    min-width: 160px; 
    border: 1px solid var(--card-border, #eee); 
}
.nav-item-dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a { 
    color: var(--text-dark, #333); 
    padding: 12px 16px; 
    text-decoration: none; 
    display: block; 
    text-align: left; 
}
.dropdown-menu a:hover { background-color: var(--page-bg, #f1f1f1); }

/* --- 4b. AVATAR MENU ICONS & LINKS --- */
.mobile-menu-link {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text-dark, #333);
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 12px;
    transition: background-color 0.1s;
    margin-bottom: 2px;
    width: 100%;
    box-sizing: border-box;
}
.mobile-menu-link:active { background-color: var(--page-bg, #f5f5f7); transform: scale(0.98); }

.icon-box {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.05);
}

.mobile-menu-link span {
    text-align: left;
    flex-grow: 1;
    line-height: 1.2;
}

/* Colorful Icons (Forced to contrast against theme dropdowns) */
.theme-icon     { background: var(--card-bg-default, #eef2ff) !important; color: #6366f1 !important; border-color: #c7d2fe !important;} 
.finance-icon   { background: var(--card-bg-default, #ecfdf5) !important; color: #10b981 !important; border-color: #a7f3d0 !important;} 
.settings-icon  { background: var(--card-bg-default, #f3f4f6) !important; color: #6b7280 !important; border-color: #d1d5db !important;} 
.profile-icon   { background: var(--card-bg-default, #eff6ff) !important; color: #3b82f6 !important; border-color: #bfdbfe !important;} 
.sub-icon       { background: var(--card-bg-default, #fff7ed) !important; color: #f97316 !important; border-color: #fed7aa !important;} 
.lib-icon       { background: var(--card-bg-default, #fdf2f8) !important; color: #ec4899 !important; border-color: #fbcfe8 !important;} 
.logout-icon    { background: var(--card-bg-default, #fef2f2) !important; color: #ef4444 !important; border-color: #fecaca !important;} 
.community-icon { background: var(--card-bg-default, #ecfeff) !important; color: #06b6d4 !important; border-color: #a5f3fc !important;}
.history-icon   { background: var(--card-bg-default, #f3e8ff) !important; color: #a855f7 !important; border-color: #e9d5ff !important;}

.menu-spacer { height: 5px; }
.menu-divider { height: 1px; background: var(--card-border, #f0f0f0); margin: 8px 0; }
.logout-link span { color: #dc2626; }

/* --- 5. THEME MODAL STYLING --- */
#theme-options-modal {
    display: none; 
    position: fixed; 
    z-index: 2000; 
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center; 
    justify-content: center; 
    padding: 1rem;
}
#theme-options-modal.is-open { display: flex; }

#theme-options-modal .modal-content {
    background-color: var(--card-bg-default); 
    color: var(--text-dark);
    max-width: 350px;
    width: 90%; 
    border-radius: 12px;
    display: flex; 
    flex-direction: column; 
    max-height: 80vh;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
}

#theme-options-modal .modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 15px;
    border-bottom: 1px solid var(--card-border);
    background-color: var(--card-bg-default);
}
#theme-options-modal .modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
}

#theme-options-modal .close-modal { display: none !important; }

#theme-options-modal .modal-body {
    padding: 0; 
    overflow-y: auto;
}

#theme-options-modal .theme-option-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

#theme-options-modal .theme-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding: 14px 15px; 
    cursor: pointer;
    border-bottom: 1px solid var(--card-border);
    font-weight: 500; 
    color: var(--text-dark); 
    border-left: 4px solid transparent;
    transition: background-color 0.2s;
}
#theme-options-modal .theme-item:hover { background-color: var(--theme-bg, #f1f1f1); }
#theme-options-modal .theme-item.active {
    font-weight: 700;
    background-color: var(--theme-bg, #eef);
    border-left-color: var(--theme-color, blue);
}

.theme-label-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
}

.theme-color-indicator {
    display: block !important;
    width: 16px; 
    height: 16px; 
    min-width: 16px;
    border-radius: 50%;
    border: 2px solid var(--card-border); 
    margin-right: 12px; 
    flex-shrink: 0;
    background-color: var(--theme-color, #ccc);
}

#theme-options-modal .modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: flex-end;
    background-color: var(--card-bg-default);
}

#theme-options-modal .modal-footer .btn {
    font-size: 0.85rem;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    background-color: #6c757d; 
    color: white;
    border: none;
    transition: background-color 0.2s;
    margin: 0;
}

/* --- 6. AI CHAT MODAL --- */
#ai-chat-modal {
    display: none; position: fixed; z-index: 2001; inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
#ai-chat-modal.active, #ai-chat-modal.show { display: flex !important; }

/* --- 7. COST BADGES --- */
.menu-cost-badge {
    display: flex; align-items: center; gap: 8px;
    background-color: var(--page-bg, #fafafa); color: var(--text-dark);
    padding: 12px 16px; border-bottom: 1px solid var(--card-border);
    font-size: 0.8rem; font-weight: 600;
    white-space: nowrap; width: auto; min-width: 100%;
    cursor: pointer; user-select: none; transition: background-color 0.2s;
}
.menu-cost-badge i { color: #f59e0b; }

.teacher-stats-row {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--card-border);
    background-color: var(--card-bg-default, #ffffff);
}
.teacher-stat-compact {
    padding: 10px 16px; flex: 1; text-align: center; position: relative; cursor: pointer;
}
.teacher-stat-compact:first-child { border-right: 1px solid var(--card-border); }
.stat-value-compact { font-weight: 700; color: var(--primary-color); display: block; font-size: 1.1rem; }
.stat-label-compact { font-size: 0.75rem; color: var(--text-muted); display: block; }

.desktop-cost-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 12px; margin-right: 15px;
    background-color: var(--page-bg, #f8f9fa);
    border: 1px solid var(--card-border, #e0e0e0);
    border-radius: 20px; font-size: 0.9rem; font-weight: 600; color: var(--text-dark);
    cursor: pointer; transition: all 0.2s ease; user-select: none;
    white-space: nowrap !important; flex-shrink: 1 !important;
    overflow: hidden !important; text-overflow: ellipsis !important;
}
.desktop-cost-badge:hover {
    background-color: #e9ecef; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.desktop-cost-badge i { color: #f59e0b; flex-shrink: 0; }

/* --- 8. NOTIFICATION DOT & ANIMATION (Refined) --- */
.notification-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: top; 
    margin-left: 4px;    
    margin-top: -2px;    
    min-width: 16px;     
    height: 26px;        
    width: 26px;
    padding: 0 4px;      
    background-color: #28a745; 
    color: white;
    font-size: 9px;      
    font-weight: 700;
    border-radius: 5rem; 
    border: 1px solid #fff; 
    opacity: 0;          
    transform: scale(0); 
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    z-index: 100;
}

.notification-dot.active {
    opacity: 1;
    transform: scale(1); 
    display: inline-flex; 
}

.notification-dot.pulsating {
    background-color: #22c55e; 
    animation: gentle-pulse 2s infinite;
}

@keyframes gentle-pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { box-shadow: 0 0 0 5px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.mobile-nav-item .notification-dot {
    position: absolute;
    top: 5px;
    right: 25%;
    margin: 0; 
    min-width: 14px;
    height: 14px;
    font-size: 8px;
    border: 1px solid white;
}

#global-chat-btn-desktop {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0px; 
}

/* --- 9. MOBILE BOTTOM NAV & QUERIES --- */
.mobile-bottom-nav { display: none; }

@media (min-width: 769px) and (max-width: 1000px) {
    .header-container.container { padding-left: 10px; padding-right: 10px; max-width: 100%; }
    .main-nav a, .main-nav .dropdown-toggle { font-size: 0.85rem; padding: 10px 8px; }
    .desktop-cost-badge i { display: none !important; }
    .desktop-cost-badge span { display: inline-block !important; font-size: 0.8rem; }
    .desktop-cost-badge { margin-right: 5px; padding: 6px 10px; gap: 0; }
    .logo-icon img { height: 50px; width: auto; }
    .logo-icon img:last-child {
        height: 50px;
        width: 50px;
    }
}
@media (max-width: 768px) {
    .desktop-cost-badge { display: none; }
    .main-header { display: none; }
    
    .main-header.guest-nav-active {
        display: block !important;
        position: fixed;
        top: 0;
        z-index: 1002;
    }
    
    .main-header.guest-nav-active .header-container { padding: 0 10px; }
    .guest-link { font-size: 0.8rem !important; margin-right: 8px !important; padding: 6px 12px !important; }
    
    body.teacher-mobile-view, body.student-mobile-view { padding-bottom: var(--mobile-nav-safe-padding) !important; }
    body.student-dashboard-page.student-mobile-view, body.teacher-dashboard-page.teacher-mobile-view {
        padding-bottom: calc(var(--mobile-nav-safe-padding) + var(--student-search-bar-height)) !important;
    }
    
    .sticky-search-bar {
        position: sticky; bottom: var(--mobile-nav-height); 
        z-index: 999; background-color: var(--card-bg-default, #ffffff); 
        box-shadow: 0 -2px 8px rgba(0,0,0,0.07);
    }
    
    .mobile-bottom-nav { 
        display: block;
        position: fixed !important; 
        bottom: 0 !important; 
        left: 0 !important; 
        right: 0 !important; 
        width: 100% !important; 
        height: var(--mobile-nav-height); 
        background-color: var(--card-bg-default, #ffffff); 
        border-top: 1px solid var(--card-border, #e0e0e0); 
        z-index: 1000; 
    }
    
    .mobile-nav-content { display: flex; justify-content: space-around; align-items: center; height: 100%; }
    
    .mobile-nav-item { 
        display: flex; flex-direction: column; align-items: center; justify-content: center; 
        color: var(--text-muted); text-decoration: none; font-size: 10px; flex: 1;
    }
    .mobile-nav-item svg { width: 44px; height: 44px; margin-bottom: 2px; }

    .mobile-nav-item .nav-avatar, 
    .mobile-nav-item .initials-placeholder { 
        width: 48px !important; 
        height: 48px !important; 
        min-width: 38px !important;
        max-width: 48px !important;
        font-size: 0.85em !important; 
        border: 2px solid gold;
    }

    .mobile-nav-item-placeholder { width: 70px; flex-shrink: 0; display: block; }
    
    body.teacher-mobile-view .mobile-bottom-nav.teacher-nav { display: block; }
    body.student-mobile-view .mobile-bottom-nav.student-mobile-nav { display: block; }
    body.teacher-mobile-view .teacher-header-apk-icon { display: none; }

    /* --- MOBILE CREATE MENU (GRID FAB) --- */
    .mobile-create-menu { 
        position: absolute; left: 50%; bottom: 15px; transform: translateX(-50%); 
        width: 60px; height: 60px; z-index: 1001; 
    }
    
    .mobile-create-menu.active::before {
        content: ''; position: fixed; top: -100vh; left: -100vw; right: -100vw; bottom: -100vh; 
        background-color: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 99; 
    }

    .mobile-nav-item-create { 
        width: 60px; height: 60px; border-radius: 50%; background-color: #10b981; color: white; 
        display: flex; align-items: center; justify-content: center; 
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4); border: 3px solid white; 
        position: relative; z-index: 100; transition: transform 0.3s ease, background-color 0.3s; cursor: pointer;
    }
    .mobile-nav-item-create svg { width: 32px; height: 32px; }
    .mobile-create-menu.active .mobile-nav-item-create { background-color: #ef4444; transform: rotate(135deg); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4); }

    .fab-items-wrapper {
        position: absolute; bottom: 80px; left: 50%; 
        transform: translateX(-50%) scale(0.9);
        transform-origin: bottom center;
        display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
        width: 320px; max-width: 90vw; padding: 20px;
        background: var(--card-bg-default, #ffffff); border: 1px solid var(--card-border, #e0e0e0);
        border-radius: 24px; box-shadow: 0 10px 40px rgba(0,0,0,0.25);
        opacity: 0; visibility: hidden; pointer-events: none; z-index: 101;
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    
    .mobile-create-menu.active .fab-items-wrapper { 
        opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(-50%) scale(1);
    }
    
    .fab-item {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
        text-decoration: none !important; padding: 12px 8px; border-radius: 16px;
        background: var(--page-bg, #f8f9fa); transition: all 0.2s;
    }
    .fab-item:active { transform: scale(0.95); background: #e2e8f0; }

    .fab-item i {
        width: 46px; height: 46px; border-radius: 50%; color: white;
        display: flex; align-items: center; justify-content: center; font-size: 1.4rem; 
        box-shadow: 0 4px 10px rgba(0,0,0,0.15); flex-shrink: 0;
    }
    
    .fab-item:nth-child(1) i { background-color: #10b981; } 
    .fab-item:nth-child(2) i { background-color: #f59e0b; } 
    .fab-item:nth-child(3) i { background-color: #3b82f6; } 
    .fab-item:nth-child(4) i { background-color: #ec4899; } 
    .fab-item:nth-child(5) i { background-color: #a855f7; } 
    .fab-item:nth-child(6) i { background-color: #14b8a6; } 

    .fab-label { 
        color: var(--text-dark, #1f2937); font-size: 0.85rem; font-weight: 700; 
        text-align: center; line-height: 1.2; background: transparent; 
        padding: 0; box-shadow: none; white-space: nowrap; 
    }

    .mobile-dropdown { position: relative; }
    .mobile-dropdown .dropdown-menu { 
        display: none; position: absolute; bottom: calc(100% + 10px); right: 0;
        top: auto; transform: none; left: auto; min-width: 280px;
        background-color: var(--card-bg-default, white); 
        box-shadow: 0 -4px 16px rgba(0,0,0,0.15); 
        z-index: 1001; border-radius: 8px; border: 1px solid var(--card-border, #eee);
        padding-bottom: 5px;
    }
    .dropdown-menu a { font-size: 1.15rem; padding: 12px 16px; }
    .mobile-dropdown.active .dropdown-menu { display: block; }
}

/* --- 10. MISC --- */
#mobile-tooltip {
    position: fixed; background: rgba(0,0,0,0.9); color: white;
    padding: 8px 12px; border-radius: 6px; font-size: 0.85rem;
    z-index: 10000; pointer-events: none; max-width: 200px;
    text-align: center; display: none; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.close-modal { color: var(--text-muted, #aaa); position: absolute; top: 10px; right: 15px; font-size: 28px; font-weight: bold; cursor: pointer; display: none; }

#apk-modal .modal-content h2 { margin-top: 0; }
.modal-download-btn { 
    display: block; width: 100%; background-color: #28a745; color: white; 
    padding: 12px 20px; border: none; border-radius: 8px; cursor: pointer; 
    font-size: 16px; font-weight: 500; text-align: center; text-decoration: none; margin-top: 20px; 
}

/* --- 11. SUPER COMPACT MOBILE HEADER --- */
@media (max-width: 480px) {
    .main-header.guest-nav-active .header-container { padding: 0 5px !important; }
    .logo-icon img { height: 32px !important; width: auto; }
    .main-nav { gap: 4px !important; }
    .guest-link { font-size: 11px !important; padding: 5px 8px !important; margin-right: 2px !important; }
    a[href*="register"].guest-link { margin-right: 0 !important; }
}

/* --- NOTIFICATION BELL & DRAWER --- */
.notification-bell-wrapper {
    position: relative; cursor: pointer; display: inline-flex;
    align-items: center; justify-content: center; 
}
.notification-bell-wrapper i { 
    transition: transform 0.2s; 
}
.notification-bell-wrapper:hover i { 
    transform: rotate(15deg); 
}

.bell-unread-badge {
    position: absolute; top: 0px; right: 0px; background: #dc3545; color: white;
    font-size: 10px; font-weight: bold; min-width: 16px; height: 16px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    border: 2px solid white; transform: scale(0);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.bell-unread-badge.active { transform: scale(1); }

.notification-drawer {
    position: fixed; top: 0; right: -350px; width: 320px; height: 100vh;
    background: white; box-shadow: -5px 0 25px rgba(0,0,0,0.15); z-index: 2000;
    transition: right 0.3s cubic-bezier(0.4, 0.0, 0.2, 1); display: flex; flex-direction: column;
}
.notification-drawer.open { right: 0; }

.drawer-header { padding: 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; background: #f8f9fa; }
.drawer-header h3 { margin: 0; font-size: 1.1rem; }
.drawer-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #666; }
.drawer-content { flex: 1; overflow-y: auto; padding: 0; }

.notif-item { display: flex; gap: 12px; padding: 15px; border-bottom: 1px solid #f0f0f0; text-decoration: none; color: inherit; transition: background 0.2s; position: relative; }
.notif-item:hover { background: #f9faff; }
.notif-item.unread { background: #eef2ff; }
.notif-item.unread::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary-color, #007bff); }

.notif-icon img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 3px; display: block; }
.notif-msg { font-size: 0.85rem; color: #666; display: block; line-height: 1.3; }
.notif-time { font-size: 0.75rem; color: #999; margin-top: 5px; display: block; }
.notif-image-preview { width: 50px; height: 50px; border-radius: 6px; object-fit: cover; margin-left: 10px; }

@media (max-width: 768px) {
    .notification-drawer { width: 100%; right: -100%; }
    .mobile-bell-wrapper { position: relative; display: flex; flex-direction: column; align-items: center; }
}

/* --- MOBILE MENU & BADGE FIXES --- */
.dropdown-toggle-mobile { overflow: visible !important; position: relative; }

#mobile-avatar-badge {
    position: absolute; top: -5px !important; right: -5px !important;
    border: 2px solid #ffffff; width: 18px; height: 18px; display: flex;
    align-items: center; justify-content: center; font-size: 10px; z-index: 20;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.menu-bell-wrapper i { font-size: 28px !important; color: var(--text-dark, #333); }
.menu-bell-wrapper { position: relative; cursor: pointer; padding: 5px; display: flex; align-items: center; justify-content: center; transition: transform 0.2s; }
.menu-bell-wrapper:active { transform: scale(0.9); }

.menu-bell-wrapper .bell-unread-badge {
    top: 2px;
    right: 2px;
}
.menu-title { display: none !important; }

.menu-cost-badge-inline {
    display: flex; align-items: center; gap: 8px; background-color: var(--modal-tile-bg, #f0fdf4);
    color: var(--primary-color, #15803d); padding: 6px 12px; border-radius: 20px;
    font-weight: 600; font-size: 0.9rem; border: 1px solid rgba(0,0,0,0.05);
}

.floating-bell-wrapper {
    position: fixed; top: 0px; right: 0px; width: 32px; height: 32px;
    background: white; border-radius: 50%; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
    cursor: pointer; transition: transform 0.2s; display: none;
}
.floating-bell-wrapper i { font-size: 16px; color: #333; }
.floating-bell-wrapper:active { transform: scale(0.95); }
.floating-bell-wrapper .notification-dot {
    position: absolute; top: -2px; right: -2px; width: 14px; height: 14px;
    background-color: #dc3545; color: white; border-radius: 50%; font-size: 8px;
    display: flex; align-items: center; justify-content: center; border: 1px solid white; font-weight: bold;
}

@media (min-width: 992px) { #mobile-floating-bell { display: none !important; } }
@media (max-width: 991px) { #mobile-floating-bell { display: flex; } }
@media (min-width: 768px) and (max-width: 1024px) { .header-left-group { flex-shrink: 0; } }

/* --- DARK MODE LOGO FIX (Single Image Glow) --- */
.theme-midnight .logo-icon img,
.theme-cyberpunk .logo-icon img {
    filter: drop-shadow(0px 0px 4px rgba(255, 255, 255, 0.8)) 
            drop-shadow(0px 0px 1px rgba(255, 255, 255, 1));
    opacity: 1;
}

/* =========================================
   DESKTOP CREATE MENU (GRID DROPDOWN)
   ========================================= */
@media (min-width: 769px) {
    .desktop-create-dropdown { position: relative; height: 100%; display: flex; align-items: center; }

    .desktop-create-dropdown .dropdown-menu {
        top: 75px; right: auto; left: 50%; transform: translateX(-50%) scale(0.95); 
        width: 320px; background-color: rgba(255, 255, 255, 0.95); 
        backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
        border: 1px solid rgba(0, 0, 0, 0.08); box-shadow: 0 10px 40px rgba(0,0,0,0.15);
        border-radius: 24px; padding: 20px; display: none; visibility: hidden; opacity: 0; 
        grid-template-columns: 1fr 1fr; gap: 12px; transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
        transform-origin: top center;
    }
    
    .theme-midnight .desktop-create-dropdown .dropdown-menu,
    .theme-cyberpunk .desktop-create-dropdown .dropdown-menu {
        background-color: rgba(30, 41, 59, 0.95);
        border-color: rgba(255,255,255,0.1);
    }

    .desktop-create-dropdown .dropdown-menu::before {
        content: ''; position: absolute; top: -60px; left: -30px; right: -30px; height: 60px; background: transparent; z-index: -1;
    }

    .desktop-create-dropdown.show .dropdown-menu {
        display: grid !important; visibility: visible; opacity: 1; transform: translateX(-50%) scale(1);
    }

    .desktop-fab-item {
        display: flex !important; flex-direction: column !important; align-items: center; justify-content: center;
        gap: 8px; text-decoration: none !important; width: 100%; padding: 16px 8px !important;
        background: var(--page-bg, #f8f9fa) !important; border: 1px solid var(--card-border, #e0e0e0) !important;
        border-radius: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.02);
        transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); box-sizing: border-box;
    }
    
    .desktop-create-dropdown .dropdown-menu a.desktop-fab-item:hover {
        transform: translateY(-4px); box-shadow: 0 8px 16px rgba(0,0,0,0.08); border-color: var(--primary-color) !important;
    }

    .desktop-fab-item i {
        width: 46px; height: 46px; border-radius: 50%; color: white; display: flex; align-items: center; justify-content: center;
        font-size: 1.4rem; box-shadow: 0 4px 10px rgba(0,0,0,0.15); flex-shrink: 0; transition: transform 0.2s ease;
    }

    .desktop-create-dropdown .dropdown-menu a.desktop-fab-item:hover i { transform: scale(1.1) rotate(5deg); }

    .desktop-fab-item:nth-child(1) i { background-color: #10b981; }
    .desktop-fab-item:nth-child(2) i { background-color: #f59e0b; }
    .desktop-fab-item:nth-child(3) i { background-color: #3b82f6; }
    .desktop-fab-item:nth-child(4) i { background-color: #ec4899; }
    .desktop-fab-item:nth-child(5) i { background-color: #a855f7; }
    .desktop-fab-item:nth-child(6) i { background-color: #14b8a6; }

    .desktop-fab-label {
        background: transparent; color: var(--text-dark, #1f2937); padding: 0; border-radius: 0; 
        font-size: 0.85rem; font-weight: 700; box-shadow: none; white-space: nowrap; text-align: center; transition: color 0.2s;
    }
    
    .desktop-fab-item:hover .desktop-fab-label { color: var(--primary-color); }
    .mobile-menu-link span { text-align: left; flex-grow: 1; line-height: 1.2; white-space: nowrap; }
}

/* --- NUKE THE TUTORIAL CLOSE BUTTON --- */
.driver-popover-close-btn {
    display: none !important;
}

/* --- ANIMATION DELAYS FOR GRID MENU --- */
.mobile-create-menu.active .fab-item:nth-child(1), .desktop-create-dropdown.show .desktop-fab-item:nth-child(1) { transition-delay: 0s; animation-delay: 0s; }
.mobile-create-menu.active .fab-item:nth-child(2), .desktop-create-dropdown.show .desktop-fab-item:nth-child(2) { transition-delay: 0.05s; animation-delay: 0.05s; }
.mobile-create-menu.active .fab-item:nth-child(3), .desktop-create-dropdown.show .desktop-fab-item:nth-child(3) { transition-delay: 0.1s; animation-delay: 0.1s; }
.mobile-create-menu.active .fab-item:nth-child(4), .desktop-create-dropdown.show .desktop-fab-item:nth-child(4) { transition-delay: 0.15s; animation-delay: 0.15s; }
.mobile-create-menu.active .fab-item:nth-child(5), .desktop-create-dropdown.show .desktop-fab-item:nth-child(5) { transition-delay: 0.2s; animation-delay: 0.2s; }
.mobile-create-menu.active .fab-item:nth-child(6), .desktop-create-dropdown.show .desktop-fab-item:nth-child(6) { transition-delay: 0.25s; animation-delay: 0.25s; }