/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    --bg-dark: #121212;       /* Main Background */
    --bg-panel: #1e1e1e;      /* Card/Sidebar Background */
    --bg-hover: #2a2a2a;      /* Hover State */
    --primary: #c0392b;       /* Asrar Red Accent */
    --gold: #d4af37;          /* Optional Gold Accent */
    --text-white: #ffffff;
    --text-grey: #aaaaaa;
    --border-color: #333333;
    
    /* Plyr Overrides */
    --plyr-color-main: #c0392b;
    --plyr-video-background: #000;
    --plyr-menu-background: #1e1e1e;
    --plyr-menu-color: #ffffff;

    --mobile: 480px;
    --tablet: 768px;
    --laptop: 1024px;
    --desktop: 1200px;
}

/* FLEXBOX SAFEGUARDS */
.flex-container {
    flex-wrap: wrap;
    min-width: 0; /* Critical for flex shrinking */
}

/* IMAGE RESPONSIVENESS */
img, video {
    max-width: 100%;
    height: auto;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', sans-serif; }

body { 
    background-color: var(--bg-dark); 
    color: var(--text-white); 
    display: flex; 
    height: 100vh; 
    overflow: hidden; /* Prevents double scrollbars */
}

a { text-decoration: none; color: inherit; }

/* Custom Scrollbar Styling (Premium Dark Look) */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* =========================================
   2. SIDEBAR NAVIGATION
   ========================================= */
.sidebar { 
    width: 260px; 
    background-color: #0f0f0f; 
    display: flex; 
    flex-direction: column; 
    padding: 25px; 
    border-right: 1px solid var(--border-color);
    flex-shrink: 0; /* Prevents sidebar from shrinking */
}

.logo { 
    font-size: 26px; 
    font-weight: 800; 
    margin-bottom: 50px; 
    color: var(--text-white); 
    letter-spacing: 1px;
}
.logo span { color: var(--primary); }

.nav-item { 
    padding: 14px 16px; 
    color: var(--text-grey); 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    font-size: 15px;
    margin-bottom: 5px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-item i { width: 25px; text-align: center; margin-right: 10px; }

.nav-item:hover { background-color: var(--bg-hover); color: var(--text-white); }
.nav-item.active { 
    background-color: var(--bg-hover); 
    color: var(--text-white); 
    border-left: 4px solid var(--primary); /* Red accent on left */
}

/* =========================================
   3. MAIN CONTENT AREA
   ========================================= */
.main-content { 
    flex: 1; 
    overflow-y: auto; /* Scrolls only the content, not sidebar */
    padding: 30px 40px; 
    background-color: var(--bg-dark); 
}

h1 { margin-bottom: 25px; font-weight: 600; letter-spacing: 0.5px; }

/* =========================================
   4. SURAH GRID (LIBRARY PAGE)
   ========================================= */
.surah-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); 
    gap: 25px; 
    margin-top: 20px; 
}

/* --- CARD STYLES (Fixed Alignment) --- */
        .card {
            display: flex; 
            flex-direction: column; 
            height: 100%; 
            background: #1e1e1e;
            border-radius: 12px;
            overflow: hidden;
            text-decoration: none;
            transition: transform 0.3s ease;
            border: 1px solid #333;
        }

        .card:hover { transform: translateY(-5px); border-color: #555; }
        
        .card-img { position: relative; aspect-ratio: 16/9; overflow: hidden; }
        .card-img img { width: 100%; height: 100%; object-fit: cover; }

        /* 1. Body fills space */
        .card-body {
            padding: 12px;
            display: flex;
            flex-direction: column;
            flex-grow: 1; 
        }

        /* 2. Title: Max 2 lines & pushes views down */
        .card-title {
            color: #eee;
            font-size: 14px;
            font-weight: 600;
            margin-bottom: auto; /* Pushes bottom content down */
            line-height: 1.4;
            
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* 3. Views at bottom */
        .card-sub {
            margin-top: 10px;
            font-size: 12px;
            color: #888;
        }

.card-img { 
    height: 150px; 
    background: linear-gradient(45deg, #1a1a1a, #252525);
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.card-body { padding: 18px; }
.card-title { font-size: 18px; font-weight: 700; margin-bottom: 5px; }
.card-sub { font-size: 13px; color: var(--text-grey); font-weight: 500; }

/* =========================================
   5. VIDEO PLAYER PAGE (The Fix)
   ========================================= */

/* Main Container: Holds Video (Left) and Playlist (Right) */
.player-container { 
    display: flex; 
    gap: 30px; 
    max-width: 1800px; 
    margin: 0 auto;
    height: calc(100vh - 60px); /* Fits exactly in viewport */
}

/* --- Left Side: Video --- */
.video-area { 
    flex: 7;        /* Takes 70% width */
    min-width: 0;   /* FIX: Allows flex item to shrink properly */
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Content below video scrolls */
    padding-right: 10px;
}

.video-wrapper { 
    width: 100%; 
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    margin-bottom: 25px;
    position: relative;
    /* Aspect ratio fallback */
    aspect-ratio: 16/9;
}

/* Plyr Customization */
.plyr { 
    height: 100%; 
    width: 100%; 
    border-radius: 12px;
}

.action-buttons { 
    margin-bottom: 20px; 
    border-bottom: 1px solid var(--border-color); 
    padding-bottom: 10px;
}

.tab-btn { 
    background: none; 
    border: none; 
    color: var(--text-grey); 
    padding: 10px 20px; 
    cursor: pointer; 
    font-size: 15px; 
    font-weight: 600; 
    margin-right: 10px;
    transition: 0.2s;
}

.tab-btn:hover { color: var(--text-white); }
.tab-btn.active { 
    color: var(--text-white); 
    border-bottom: 3px solid var(--primary); 
}

/* --- Right Side: Playlist --- */
.playlist-area { 
    flex: 3;        /* Takes 30% width */
    background-color: var(--bg-panel); 
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    /* Keeps playlist fixed height matching the screen */
    height: calc(100vh - 80px); 
    overflow: hidden; /* Header stays fixed, list scrolls */
    border: 1px solid var(--border-color);
}

.playlist-header {
    padding: 20px;
    background-color: #252525;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-white);
}

.playlist-scroll {
    overflow-y: auto; /* Only the list items scroll */
    flex: 1;
    padding: 10px;
}

.playlist-item { 
    display: flex; 
    align-items: center;
    padding: 12px; 
    border-radius: 8px;
    cursor: pointer; 
    transition: background 0.2s;
    margin-bottom: 8px;
    border: 1px solid transparent;
}

.playlist-item:hover { background-color: #333; }

.playlist-item.active { 
    background-color: #2c0b09; /* Dark red tint */
    border: 1px solid var(--primary); 
}

.playlist-icon { 
    margin-right: 15px; 
    color: var(--text-grey); 
    width: 20px; 
    text-align: center;
}

.item-info h4 { 
    font-size: 14px; 
    margin-bottom: 4px; 
    color: var(--text-white); 
    font-weight: 500;
    line-height: 1.4;
}

.item-info span { font-size: 12px; color: var(--text-grey); }



/* =========================================
   7. ADMIN DASHBOARD STYLES
   ========================================= */

/* Header Area */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

/* Language Dropdown */
.lang-switcher {
    background: var(--bg-panel);
    padding: 10px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
}
.lang-switcher i { color: var(--gold); margin-right: 10px; }
.lang-switcher select {
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 16px;
    outline: none;
    cursor: pointer;
}
.lang-switcher select option { background: #000; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-panel);
    padding: 25px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid transparent;
    transition: 0.3s;
}

.stat-card:hover { border-color: var(--primary); transform: translateY(-3px); }

.icon-box {
    width: 60px; height: 60px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}
.icon-box.red { background: rgba(192, 57, 43, 0.1); color: var(--primary); }
.icon-box.gold { background: rgba(212, 175, 55, 0.1); color: var(--gold); }
.icon-box.blue { background: rgba(52, 152, 219, 0.1); color: #3498db; }
.icon-box.green { background: rgba(46, 204, 113, 0.1); color: #2ecc71; }

.stat-info h3 { font-size: 28px; margin-bottom: 5px; }
.stat-info span { color: var(--text-grey); font-size: 14px; }

/* Split Layout (Chart + Table) */
.dashboard-split {
    display: flex;
    gap: 25px;
    height: 400px;
}
.chart-container, .table-container {
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 20px;
    flex: 1;
    border: 1px solid var(--border-color);
}
.chart-container h3, .table-container h3 {
    margin-bottom: 20px;
    font-size: 16px;
    color: var(--text-grey);
}

/* Data Table */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; padding: 15px; color: var(--text-grey); border-bottom: 1px solid #333; }
.admin-table td { padding: 15px; border-bottom: 1px solid #222; font-size: 14px; }
.badge { 
    padding: 5px 10px; 
    border-radius: 20px; 
    font-size: 11px; 
    font-weight: bold; 
}
.badge.active { background: rgba(46, 204, 113, 0.2); color: #2ecc71; }

@media (max-width: 1024px) {
    .dashboard-split { flex-direction: column; height: auto; }
}

/* CATEGORY CARD GRID */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.cat-card {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Hover Effect */
.cat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    background: linear-gradient(145deg, #1e1e1e, #252525);
}

.cat-icon-box {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary); /* Gold or Red */
    transition: 0.3s;
}

.cat-card:hover .cat-icon-box {
    background: var(--primary);
    color: white;
}

.cat-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #fff;
}

.cat-info span {
    font-size: 12px;
    color: #888;
}

.cat-arrow {
    margin-left: auto;
    color: #444;
    font-size: 12px;
}

.cat-card:hover .cat-arrow {
    color: white;
}

/* Back Button */
.btn-back {
    background: #333;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}
.btn-back:hover { background: #444; }



/* --- USER DROPDOWN STYLES --- */
.user-menu-container {
    position: relative;
    display: inline-block;
}

.user-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    border-radius: 30px;
    transition: 0.2s;
}

.user-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.avatar-circle {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), #b8860b); /* Uses your Gold Color */
    color: black;
    font-weight: bold;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.username-text {
    font-weight: 500;
    font-size: 14px;
}

/* THE DROPDOWN BOX */
.user-dropdown {
    display: none; /* Hidden by default */
    position: absolute;
    top: 100%;
    right: 0;
    width: 200px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    padding: 5px 0;
    z-index: 1000;
    margin-top: 10px;
}

/* ADD THIS */
.user-dropdown.active {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

/* LINKS */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #ccc;
    text-decoration: none;
    font-size: 14px;
    transition: 0.2s;
}

.dropdown-item i { width: 20px; text-align: center; }

.dropdown-item:hover {
    background: #2a2a2a;
    color: white;
}

/* Admin Link Special Style */
.admin-link {
    color: #3498db; /* Blue highlight */
    font-weight: 600;
}
.admin-link:hover {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

/* Divider Line */
.dropdown-divider {
    height: 1px;
    background: #333;
    margin: 5px 0;
}

/* Logout Red Hover */
.logout-item:hover {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* =========================================
   8. MOBILE RESPONSIVENESS
   ========================================= */

/* Mobile Header with Toggle */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
    z-index: 1000;
    align-items: center;
    justify-content: space-between;
}

.mobile-header-logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: 1px;
}

.mobile-header-logo span {
    color: var(--primary);
}

.mobile-menu-toggle {
    background: var(--bg-panel);
    color: var(--text-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

/* Overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    backdrop-filter: blur(3px);
}

/* Mobile Styles */
@media (max-width: 1024px) {
    /* Show mobile header */
    .mobile-header {
        display: flex;
    }
    
    /* Adjust body padding to account for mobile header */
    body {
        padding-top: 74px; /* Height of mobile header */
        height: calc(100vh - 74px);
    }
    
    /* Hide sidebar by default on mobile */
    .sidebar {
        position: fixed;
        top: 74px; /* Start below mobile header */
        left: -260px; /* Hidden off-screen */
        height: calc(100vh - 74px);
        width: 260px;
        z-index: 1001;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.5);
        overflow-y: auto;
        border-right: none;
    }
    
    /* When sidebar is active (open) */
    .sidebar.active {
        left: 0;
    }
    
    /* Show overlay when sidebar is active */
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Adjust main content for mobile */
    .main-content {
        padding: 20px;
        padding-top: 20px;
        height: calc(100vh - 74px);
        overflow-y: auto;
    }
    
    /* Remove logo from sidebar on mobile since it's in header */
    .sidebar .logo {
        display: none;
    }
    
    /* Adjust surah-view layout for mobile */
    .surah-layout {
        flex-direction: column;
        height: auto;
        overflow-y: auto;
        margin-top: -74px; /* Compensate for body padding */
    }
    
    .inner-sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #222;
        position: static;
    }
    
    .content-area {
        padding: 20px;
    }
    
    /* Adjust player container for mobile */
    .player-container {
        flex-direction: column;
        height: auto;
        gap: 20px;
        margin-top: 20px;
    }
    
    .video-area,
    .playlist-area {
        flex: none;
        width: 100%;
        height: auto;
    }
    
    .playlist-area {
        height: 400px; /* Fixed height for playlist on mobile */
    }
    
    /* Adjust grid layouts for mobile */
    .surah-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Adjust header sizes */
    h1 {
        font-size: 24px;
    }
    
    .main-title {
        font-size: 36px;
    }
    
    .arabic-title {
        font-size: 24px;
    }
    
    /* Adjust admin dashboard */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-split {
        flex-direction: column;
    }
    
    /* Adjust user bar for mobile */
    .user-bar {
        position: static;
        margin-bottom: 20px;
        background: rgba(0, 0, 0, 0.5);
        padding: 10px 15px;
        border-radius: 10px;
        width: auto;
    }
    
    /* Adjust video wrapper aspect ratio */
    .video-wrapper {
        aspect-ratio: 16/9;
    }
    
    /* Adjust tabs for mobile */
    .tab-btn {
        padding: 8px 15px;
        font-size: 14px;
        margin-right: 5px;
    }
    
    /* Adjust filter pills */
    .top-filter-bar {
        padding-bottom: 10px;
        margin-bottom: 20px;
    }
    
    .filter-pill {
        padding: 6px 15px;
        font-size: 12px;
    }
    
    /* Content tabs in surah-view */
    .content-tabs {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 30px;
    }
    
    .content-tabs .tab-btn {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }
    
    /* Lessons grid for mobile */
    .lessons-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Language cards grid for mobile */
    .lang-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 30px;
    }
    
    .lang-card {
        height: 250px;
    }
    
    /* Subcategory cards for mobile */
    .subcat-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .subcat-card {
        height: 180px;
    }
    
    /* Fix for home page language view */
    .lang-grid {
        margin-top: 20px;
    }
    
    /* Adjust back to top spacing */
    .browse-header {
        margin-top: 0;
        padding-top: 10px;
    }
}

/* Tablet Styles (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .mobile-header {
        display: none;
    }
    
    body {
        padding-top: 0;
        height: 100vh;
    }
    
    .sidebar {
        width: 220px;
        top: 0;
        left: 0;
        height: 100vh;
    }
    
    .main-content {
        padding: 25px 30px;
        height: auto;
    }
    
    .surah-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .player-container {
        flex-direction: column;
        height: auto;
    }
    
    .video-area,
    .playlist-area {
        flex: none;
        width: 100%;
    }
    
    .playlist-area {
        height: 500px;
        margin-top: 20px;
    }
    
    .inner-sidebar {
        width: 280px;
    }
    
    .lang-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Small mobile devices (480px and below) */
@media (max-width: 480px) {
    .mobile-header {
        padding: 12px 15px;
    }
    
    body {
        padding-top: 68px;
        height: calc(100vh - 68px);
    }
    
    .sidebar {
        top: 68px;
        height: calc(100vh - 68px);
    }
    
    .main-content {
        padding: 15px;
        height: calc(100vh - 68px);
    }
    
    .mobile-header-logo {
        font-size: 20px;
    }
    
    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
    }
    
    .surah-grid {
        grid-template-columns: 1fr;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .subcat-row {
        grid-template-columns: 1fr;
    }
    
    .filter-pill {
        padding: 5px 12px;
        font-size: 11px;
    }
    
    .content-area {
        padding: 15px;
    }
    
    .main-title {
        font-size: 28px;
    }
    
    .arabic-title {
        font-size: 20px;
    }
    
    .nav-item {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    /* Adjust user dropdown for mobile */
    .user-dropdown {
        position: fixed;
        top: 68px;
        right: 15px;
        left: 15px;
        width: auto;
    }
}

/* Large mobile devices (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .user-dropdown {
        position: fixed;
        top: 74px;
        right: 20px;
        left: 20px;
        width: auto;
    }
}

/* Inner sidebar toggle for surah-view */
.inner-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    z-index: 1002;
    box-shadow: 0 4px 15px rgba(192, 57, 43, 0.4);
    transition: transform 0.3s ease;
}

.inner-sidebar-toggle:hover {
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .inner-sidebar {
        position: fixed;
        top: 74px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 74px);
        z-index: 1001;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: #050505;
    }
    
    .inner-sidebar.active {
        left: 0;
    }
    
    .inner-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* =========================================
   NEW HEADER & LAYOUT STYLES
   ========================================= */

/* 1. Vertical Layout (For Public Pages) */
body.public-page {
    flex-direction: column; /* Stacks Header on top of Content */
}

body.public-page .main-content {
    width: 100%;
    max-width: 1600px; /* Limits width on huge screens */
    margin: 0 auto;
    padding: 30px;
}

/* 2. Header Styles */
.main-header {
    height: 70px;
    background-color: #0f0f0f; /* Dark background */
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    flex-shrink: 0; /* Prevents header from shrinking */
    z-index: 1000;
}

.header-logo {
    font-size: 24px;
    font-weight: 800;
    color: white;
    text-decoration: none;
    letter-spacing: 1px;
}
.header-logo span { color: var(--primary); }

.header-nav {
    display: flex;
    gap: 40px;
}

.nav-link {
    color: #888;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-link:hover { color: white; }
.nav-link.active { color: var(--primary); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* User Dropdown Tweaks */
.user-menu-container { position: relative; cursor: pointer; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-radius: 30px; transition: 0.2s; background: transparent; border:none; color:white;}
.user-btn:hover { background: rgba(255,255,255,0.05); }

.dropdown-header {
    padding: 15px 20px;
    border-bottom: 1px solid #333;
    display: flex;
    flex-direction: column;
}
.dropdown-header strong { color: white; display: block; }
.dropdown-header span { color: #888; font-size: 12px; }

/* Mobile Responsiveness for Header */
@media (max-width: 768px) {
    .header-nav {
        position: fixed;
        bottom: 0; left: 0; width: 100%;
        background: #151515;
        border-top: 1px solid #333;
        justify-content: space-around;
        padding: 15px;
        z-index: 999;
    }
    .nav-link { flex-direction: column; font-size: 10px; gap: 4px; }
    .nav-link i { font-size: 18px; }
    
    .desktop-only { display: none; }
    body.public-page .main-content { padding-bottom: 80px; } /* Space for bottom nav */
}

/* =========================================
   FINAL LAYOUT FIXES (Paste at bottom of style.css)
   ========================================= */

/* 1. FIX MOBILE SCROLLING & SPACING */
@media (max-width: 1024px) {
    body.public-page {
        /* Remove the top padding from old sidebar layout */
        padding-top: 0 !important; 
        
        /* UNLOCK SCROLLING: This fixes the "can't scroll" issue */
        overflow-y: auto !important; 
        height: auto !important;   
    }
    
    body.public-page .main-content {
        /* Ensure content grows naturally so you can scroll it */
        height: auto !important;
        overflow: visible !important;
    }
    
    /* Ensure header sits normally at the top */
    .main-header {
        position: relative; 
        top: 0;
    }
}

/* 2. FIX PC SIDE SPACES (Make it Full Width) */

body.public-page .main-content {

    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: ;
}

/* =========================================
   MOBILE LANGUAGE GRID (Vertical Stack - Larger & Clean)
   ========================================= */
@media (max-width: 768px) {
    
    /* 1. Stack them vertically (1 Column) */
    .lang-grid {
        display: grid !important;
        grid-template-columns: 1fr !important; 
        gap: 15px !important; /* Slightly more space between cards */
        margin-top: 20px !important;
        height: auto !important; 
    }

    /* 2. Make cards Larger */
    .lang-card {
        width: 100% !important;
        height: 180px !important; /* Increased height (was 130px) */
        min-height: auto !important;
        border-radius: 16px !important; /* Softer corners */
        box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
    }

    /* 3. Adjust Background Image (Fix: Fill entire space) */
    .lang-bg {
        opacity: 0.6 !important; 
        background-position: center center !important; 
        background-size: cover !important; /* Forces image to fill the card */
        background-repeat: no-repeat !important;
        height: 100% !important; /* Ensures the bg div is full height */
        width: 100% !important;
        position: absolute; /* Locks it to the card corners */
        top: 0; left: 0;
        transition: transform 0.5s ease;
    }

    /* 4. Text Layout (Clean - No Red Box) */
    .lang-content {
        padding: 8px 30px !important; 
        justify-content: center !important; 
        align-items: flex-start !important; 
        background: linear-gradient(to right, rgba(0,0,0,0.9) 20%, transparent) !important;
    }

    .lang-title {
        font-size: 24px !important; /* Bigger Title */
        margin-bottom: 5px !important;
        font-weight: 800 !important;
        text-transform: uppercase;
        letter-spacing: 1px;
        text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    }

    .lang-sub {
        font-size: 14px !important;
        font-weight: 600 !important;
        color: #d4af37 !important; /* Gold Text (No Red Box) */
        background: none !important; /* REMOVED THE BOX */
        padding: 0 !important;
        opacity: 1 !important;
        letter-spacing: 0.5px;
    }
}



/* =========================================
   MOBILE MENU FIXES
   ========================================= */

/* 1. HIDE EVERYTHING ON DESKTOP */
@media (min-width: 769px) {
    .mobile-header, 
    .mobile-side-menu, 
    .sidebar-overlay {
        display: none !important;
    }
}

/* =========================================
   MOBILE MENU FIXES (Scoped to Public Pages Only)
   ========================================= */

/* 1. HIDE EVERYTHING ON DESKTOP */
@media (min-width: 769px) {
    .public-page .mobile-header, 
    .public-page .mobile-side-menu, 
    .public-page .sidebar-overlay {
        display: none !important;
    }
}

/* 2. MOBILE STYLES (Only for screens smaller than 768px) */
@media (max-width: 768px) {
    
    /* A. The Top Bar (Visible) */
    .public-page .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #121212;
        padding: 15px 20px;
        border-bottom: 1px solid #333;
        width: 100%;
        position: sticky;
        top: 0;
        z-index: 500;
    }

    .public-page .mobile-header-logo {
        font-size: 20px;
        font-weight: 800;
        color: white;
        text-decoration: none;
        letter-spacing: 1px;
    }
    .public-page .mobile-header-logo span { color: var(--primary); }

    .public-page .mobile-menu-toggle {
        background: none;
        border: none;
        color: white;
        font-size: 22px;
        cursor: pointer;
    }

    /* B. The Side Menu Drawer (HIDDEN by default) */
    .public-page .mobile-side-menu {
        display: block;
        position: fixed; /* Floats on top of page */
        top: 0;
        left: 0;
        width: 280px; /* Width of the menu */
        height: 100vh;
        background: #1e1e1e;
        border-right: 1px solid #333;
        z-index: 20000; /* Very high to sit on top of everything */
        
        /* CRITICAL: Hides it off-screen to the left */
        transform: translateX(-100%); 
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        overflow-y: auto;
    }

    /* Class to show the menu */
    .public-page .mobile-side-menu.active {
        transform: translateX(0); /* Slides it in */
    }

    /* C. The Dark Overlay */
    .public-page .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0; 
        left: 0; 
        width: 100%; 
        height: 100%;
        background: rgba(0,0,0,0.7);
        backdrop-filter: blur(3px);
        z-index: 19999; /* Just below the menu */
        
        /* Hidden by default */
        opacity: 0;
        visibility: hidden; 
        transition: 0.3s ease;
    }

    .public-page .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* D. Menu Links Styling */
    .public-page .mobile-link {
        display: flex;
        align-items: center;
        padding: 12px 15px;
        color: #ccc;
        text-decoration: none;
        font-size: 15px;
        border-radius: 8px;
        margin-bottom: 5px;
        transition: 0.2s;
    }
    .public-page .mobile-link:hover, 
    .public-page .mobile-link.active {
        background: #252525;
        color: white;
    }
    .public-page .mobile-link i {
        width: 25px; /* Aligns icons nicely */
        text-align: center;
        margin-right: 10px;
    }
}

/* --- FIX: UNIFORM BACKGROUND (Safe Version) --- */
html, body {
    background-color: #121212 !important; /* Force one unified dark color */
    margin: 0;
    width: 100%;
}

/* Apply background color but DO NOT force height or flex layout */
.main-content {
    background-color: #121212 !important; 
    /* Removed 'min-height' and 'display: flex' to restore your original alignment */
}

/* Mobile Fix: Ensure the body background covers the full screen */
@media (max-width: 1024px) {
    body.public-page {
        background-color: #121212 !important;
        min-height: 100vh; /* Only ensure body is tall enough on mobile */
    }
}

