:root {
    /* --- Dark Mode (Default) Variables --- */
    --bg-deep: #050508;
    --bg-surface: #0f1219;
    --text-main: #f0f4f8;
    --text-muted: #94a3b8;
    
    /* Input Fields (Dark Mode) */
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-text: #ffffff;      /* Text is White */
    --input-placeholder: rgba(255, 255, 255, 0.5);
    
    /* Neon Accents */
    --primary: #00f2ff;
    --primary-dim: rgba(0, 242, 255, 0.1);
    --secondary: #bd00ff;
    --secondary-dim: rgba(189, 0, 255, 0.1);
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
    
    /* UI Elements */
    --glass-bg: rgba(15, 18, 25, 0.9);
    --glass-border: rgba(255, 255, 255, 0.08);
    --card-hover: rgba(255, 255, 255, 0.03);
    
    /* Effects */
    --glow-primary: 0 0 20px rgba(0, 242, 255, 0.4);
    --glow-text: 0 0 10px rgba(0, 242, 255, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* --- PILLS (Dark Mode Default) --- */
    --pills-container-bg: #000000;
    --pills-border-color: rgba(255,255,255,0.1);
    
    --pill-bg: rgba(0, 0, 0, 0.5); 
    --pill-text: #00f2ff;
    --pill-border: #00f2ff;
    --pill-shadow: 0 0 5px rgba(0, 242, 255, 0.2);
    
    --pill-hover-bg: #00f2ff;
    --pill-hover-text: #000000;
    --pill-hover-shadow: 0 0 20px rgba(0, 242, 255, 0.6);
    --pill-hover-border: #00f2ff;
}

body.light-mode {
    /* --- Light Mode Variables --- */
    --bg-deep: #f1f5f9;       
    --bg-surface: #ffffff;    
    --text-main: #0f172a;     /* Dark Blue/Black Text */
    --text-muted: #64748b;    
    
    /* Input Fields (Light Mode) */
    --input-bg: #e2e8f0;      
    --input-border: #cbd5e1;  
    --input-text: #000000;    /* BLACK TEXT for Visibility */
    --input-placeholder: #64748b; 
    
    /* Accents */
    --primary: #007aff;       
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(0, 0, 0, 0.1);
    
    --glow-primary: 0 4px 15px rgba(0, 122, 255, 0.2);
    --glow-text: none;

    /* --- PILLS (Light Mode Override) --- */
    --pills-container-bg: rgba(255, 255, 255, 0.95);
    --pills-border-color: rgba(0,0,0,0.1);

    --pill-bg: #f0f0f0;
    --pill-text: #333;
    --pill-border: #ddd;
    --pill-shadow: none;

    --pill-hover-bg: #e0e0e0;
    --pill-hover-text: #000;
    --pill-hover-shadow: none;
    --pill-hover-border: #ccc;
}

/* Reset & Setup */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-deep);
    background-image: 
        linear-gradient(var(--glass-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--glass-border) 1px, transparent 1px);
    background-size: 50px 50px;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

h1, h2, h3, .logo { font-family: 'Orbitron', sans-serif; letter-spacing: 0.5px; }

/* Navbar */
nav {
    position: fixed; top: 0; width: 100%; z-index: 1000;
    background: var(--glass-bg); backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border); padding: 0.8rem 0;
}
.navbar-container { max-width: 1600px; margin: 0 auto; padding: 0 2rem; display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.8rem; font-weight: 800; background: linear-gradient(90deg, #fff, var(--primary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; position: relative; }
body.light-mode .logo { background: linear-gradient(90deg, #007aff, #00c6ff); -webkit-background-clip: text; }
.logo::after { content: 'BETA'; font-size: 0.5rem; position: absolute; top: 0; right: -30px; background: var(--secondary); padding: 2px 6px; border-radius: 4px; color: white; font-family: 'Outfit', sans-serif; }

.nav-links { display: flex; gap: 2.5rem; }
.nav-links a { color: var(--text-muted); text-decoration: none; font-weight: 500; font-size: 0.95rem; transition: var(--transition); text-transform: uppercase; letter-spacing: 1px; font-size: 0.8rem; }
.nav-links a:hover, .nav-links a.active { color: var(--primary); text-shadow: var(--glow-text); }

.nav-actions { display: flex; gap: 1rem; align-items: center; }

/* Search Bar */
.search-bar { 
    background: var(--input-bg); 
    border: 1px solid var(--input-border); 
    padding: 0.6rem 1.2rem; 
    border-radius: 50px; 
    color: var(--input-text); 
    width: 200px; 
    transition: var(--transition); 
    font-family: inherit; 
}
.search-bar::placeholder { color: var(--input-placeholder); }
.search-bar:focus { width: 280px; border-color: var(--primary); box-shadow: 0 0 15px var(--primary-dim); outline: none; }

.btn { padding: 0.6rem 1.5rem; border-radius: 4px; font-weight: 600; font-family: 'Orbitron', sans-serif; font-size: 0.75rem; letter-spacing: 1px; cursor: pointer; transition: var(--transition); border: none; clip-path: polygon(10% 0, 100% 0, 100% 70%, 90% 100%, 0 100%, 0 30%); text-decoration: none; display: inline-block; line-height: 1.5; }
.btn-primary { background: var(--primary); color: #000; box-shadow: var(--glow-primary); }
body.light-mode .btn-primary { color: #fff; } 
.btn-primary:hover { background: #fff; transform: translateY(-2px); box-shadow: 0 0 30px var(--primary); }
body.light-mode .btn-primary:hover { background: #0056b3; color: white; }

.btn-outline { background: transparent; border: 1px solid var(--glass-border); color: var(--text-main); box-shadow: inset 0 0 0 1px var(--primary); }
.btn-outline:hover { background: var(--primary-dim); color: var(--primary); }

.mode-toggle { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; transition: var(--transition); }
.mode-toggle:hover { color: var(--primary); transform: rotate(15deg); }

/* Sidebar */
#sidebar { position: fixed; left: 0; top: 0; height: 100%; width: 280px; background: var(--glass-bg); backdrop-filter: blur(20px); border-right: 1px solid var(--glass-border); padding: 100px 2rem 2rem; transform: translateX(-100%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); z-index: 900; }
#sidebar.open { transform: translateX(0); }
.sidebar-content h3 { font-size: 0.9rem; color: var(--text-muted); margin: 2rem 0 1rem; text-transform: uppercase; letter-spacing: 2px; }
.sidebar-content ul { list-style: none; }
.sidebar-content li { margin-bottom: 0.5rem; }
.sidebar-content a { display: flex; align-items: center; padding: 0.8rem; color: var(--text-main); text-decoration: none; border-radius: 8px; transition: var(--transition); font-weight: 300; }
.sidebar-content a:hover { background: var(--primary-dim); color: var(--primary); padding-left: 1.2rem; }
.sidebar-toggle { position: fixed; bottom: 30px; left: 30px; width: 50px; height: 50px; border-radius: 50%; background: var(--bg-surface); border: 1px solid var(--primary); color: var(--primary); z-index: 950; cursor: pointer; box-shadow: var(--glow-primary); display: grid; place-items: center; font-size: 1.2rem; transition: var(--transition); }
.sidebar-toggle:hover { transform: scale(1.1); background: var(--primary); color: #000; }

/* Main Layout */
main { margin-left: 0; padding-top: 80px; transition: margin-left 0.4s ease; flex: 1; display: flex; flex-direction: column; }
body.sidebar-active main { margin-left: 280px; }

/* User Dropdown */
.user-menu { position: relative; display: inline-block; }
.user-trigger { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.05); padding: 5px 15px 5px 5px; border-radius: 50px; border: 1px solid var(--glass-border); cursor: pointer; transition: var(--transition); }
body.light-mode .user-trigger { background: rgba(0,0,0,0.05); border-color: #cbd5e1; }
.user-trigger:hover { border-color: var(--primary); background: rgba(255,255,255,0.1); }
.avatar { width: 32px; height: 32px; background: var(--gradient); border-radius: 50%; display: grid; place-items: center; font-weight: bold; color: white; font-size: 0.9rem; }
.username { font-size: 0.9rem; font-weight: 600; color: var(--text-main); }
.user-dropdown { position: absolute; top: 120%; right: 0; width: 200px; background: var(--bg-surface); border: 1px solid var(--glass-border); border-radius: 12px; padding: 10px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); opacity: 0; visibility: hidden; transform: translateY(-10px); transition: var(--transition); backdrop-filter: blur(10px); z-index: 1500; }
.user-menu:hover .user-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 10px 15px; color: var(--text-muted); text-decoration: none; border-radius: 8px; font-size: 0.9rem; transition: 0.2s; }
.dropdown-item:hover { background: var(--primary-dim); color: var(--primary); }
.dropdown-divider { height: 1px; background: var(--glass-border); margin: 8px 0; }

/* Modal */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); backdrop-filter: blur(8px); align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s ease; }
.modal.show { display: flex; opacity: 1; }
.modal-content { background: var(--bg-surface); border: 1px solid var(--primary); box-shadow: 0 0 30px var(--primary-dim); width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; padding: 2.5rem; border-radius: 16px; position: relative; transform: scale(0.95); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.modal-content::-webkit-scrollbar { width: 4px; }
.modal-content::-webkit-scrollbar-thumb { background: var(--primary); }
.modal.show .modal-content { transform: scale(1); }
.close-modal { position: absolute; top: 15px; right: 20px; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; transition: 0.2s; z-index: 10; }
.close-modal:hover { color: var(--primary); text-shadow: var(--glow-text); }

.auth-tabs { display: flex; margin-bottom: 2rem; border-bottom: 1px solid var(--glass-border); }
.auth-tab { flex: 1; background: none; border: none; padding: 1rem; color: var(--text-muted); font-family: 'Orbitron', sans-serif; cursor: pointer; transition: 0.3s; border-bottom: 2px solid transparent; }
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); text-shadow: var(--glow-text); }
.auth-form { display: none; }
.auth-form.active { display: block; animation: fadeIn 0.4s ease; }

.input-group { margin-bottom: 1.2rem; position: relative; }
.input-group i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); z-index: 2; }

/* MODAL INPUTS */
.modal-input { 
    width: 100%; padding: 12px 12px 12px 45px; 
    background: var(--input-bg); 
    border: 1px solid var(--input-border); 
    border-radius: 8px; 
    color: var(--input-text); 
    font-family: 'Outfit', sans-serif; 
    transition: 0.3s; 
}
.modal-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 10px var(--primary-dim); }
.modal-input::placeholder { color: var(--input-placeholder); }

select.modal-input { appearance: none; cursor: pointer; }
select.modal-input option { background: var(--bg-surface); color: var(--text-main); }
::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }
body.light-mode ::-webkit-calendar-picker-indicator { filter: invert(0); }

.checkbox-group { display: flex; align-items: center; gap: 10px; margin: 1rem 0; font-size: 0.85rem; color: var(--text-muted); text-align: left; }
.checkbox-group input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
.checkbox-group a { color: var(--primary); text-decoration: none; }

.modal-btn { width: 100%; padding: 12px; margin-top: 0.5rem; background: var(--gradient); border: none; border-radius: 8px; color: white; font-weight: bold; font-family: 'Orbitron', sans-serif; cursor: pointer; transition: 0.3s; text-transform: uppercase; letter-spacing: 1px; }
.modal-btn:hover { transform: translateY(-2px); box-shadow: 0 0 20px var(--primary-dim); }
.auth-footer { margin-top: 1.5rem; text-align: center; font-size: 0.85rem; color: var(--text-muted); }
.auth-footer a { color: var(--primary); text-decoration: none; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Footer */
footer { margin-top: auto; background: var(--bg-surface); border-top: 1px solid var(--glass-border); padding: 1rem 1rem; text-align: center; position: relative; z-index: 10; width: 100%; }
footer p { color: var(--text-muted); margin-bottom: 1.5rem; }
.footer-links a { color: var(--text-muted); margin: 0 1rem; text-decoration: none; font-size: 0.9rem; }
.footer-links a:hover { color: var(--primary); }

@media (max-width: 768px) {
  .pills-scroll {
    justify-content: flex-start; /* IMPORTANT: don’t center a scroll row */
    padding: 0 1rem;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .pill {
    scroll-snap-align: start;
    flex: 0 0 auto;
    padding: 8px 18px;
    font-size: 0.85rem;
  }
}

/* --- PILL CONTAINER & PILLS STYLING --- */
.category-pills-container {
    padding: 15px 0;
    margin-bottom: 2rem;
    position: sticky;
    top: 60px; 
    z-index: 90;
    backdrop-filter: blur(10px);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    
    /* Variable-based background */
    background-color: var(--pills-container-bg) !important;
    border-bottom: 1px solid var(--pills-border-color);
}

.pills-scroll {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    overflow-x: auto;
    padding: 0 2rem;
    scrollbar-width: none;
}
.pills-scroll::-webkit-scrollbar { display: none; }

.pill {
    padding: 8px 25px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.3s ease;
    
    /* Variable-based pill styles */
    background: var(--pill-bg);
    color: var(--pill-text);
    border: 1px solid var(--pill-border);
    box-shadow: var(--pill-shadow);
}

.pill:hover, .pill.active {
    transform: translateY(-2px);
    background: var(--pill-hover-bg);
    color: var(--pill-hover-text) !important;
    border-color: var(--pill-hover-border);
    box-shadow: var(--pill-hover-shadow);
}

.pill-nsfw {
    color: #ff4757 !important;
    border-color: #ff4757 !important;
    background: rgba(255, 71, 87, 0.1) !important;
    box-shadow: none !important;
}
.pill-nsfw:hover {
    background: #ff4757 !important;
    color: white !important;
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.5) !important;
}

@media (max-width: 768px) {
    .navbar-container { padding: 0 1rem; }
    .nav-links { display: none; }
    .search-bar { width: 140px; }
    .search-bar:focus { width: 180px; }
}

/* --- NEON UI UPGRADES --- */

/* 1. NEON GAME & STREAM CARDS */
/* Applies a subtle border by default, and a strong glow on hover */
.card, .game-card, .mini-card {
    border: 1px solid rgba(0, 242, 255, 0.2); /* Faint blue border */
    background: var(--bg-surface);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Hover Effect: intense glow + slight lift */
.card:hover, .game-card:hover, .mini-card:hover {
    border-color: #00f2ff;
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.4), inset 0 0 10px rgba(0, 242, 255, 0.1);
    transform: translateY(-5px) scale(1.02);
    z-index: 10;
}

/* 2. SPOTLIGHT SECTION (Cyber Container) */
/* Gives the "Streamer Spotlight" box a techy look */
.spotlight-section {
    border: 1px solid rgba(0, 242, 255, 0.3);
    box-shadow: 0 0 30px rgba(0, 242, 255, 0.05);
    background: linear-gradient(180deg, rgba(0, 242, 255, 0.03) 0%, rgba(0,0,0,0) 100%) !important;
    position: relative;
}

/* Adds a glowing line at the top of the spotlight box */
.spotlight-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 1px;
    background: linear-gradient(90deg, transparent, #00f2ff, transparent);
    box-shadow: 0 0 15px #00f2ff;
}

/* 3. SECTION HEADERS (Glowing Accent) */
/* Adds a neon underline to "Top Live Channels", "Action", etc. */
.section-header h2 {
    position: relative;
    display: inline-block;
    padding-bottom: 10px;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 60px; /* Short accent line */
    height: 3px;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
    border-radius: 2px;
}

/* 4. LIVE AVATAR PULSE (Red Glow) */
/* If a user has the .live-ring class (we will add this logic next), they pulse */
.live-pulse {
    position: relative;
}
.live-pulse::after {
    content: '';
    position: absolute;
    top: -4px; left: -4px; right: -4px; bottom: -4px;
    border-radius: 50%;
    border: 2px solid #ff4757;
    animation: pulse-red 2s infinite;
    z-index: 0;
}
.live-pulse img {
    position: relative;
    z-index: 1;
    border: 2px solid #ff4757; /* Solid red border */
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7); opacity: 1; }
    70% { box-shadow: 0 0 0 10px rgba(255, 71, 87, 0); opacity: 0; }
    100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); opacity: 0; }
}

/* =========================
   MOBILE NAVBAR FIX
   ========================= */

@media (max-width: 768px) {

  nav { padding: 0.6rem 0; }

  .navbar-container {
    padding: 0 0.9rem;
    gap: 10px;
  }

  /* Make logo smaller so it doesn’t eat the whole row */
  .logo { font-size: 1.25rem; }
  .logo::after { right: -26px; }

  /* Keep actions from overflowing */
  .nav-actions {
    gap: 0.5rem;
    flex-wrap: nowrap;
    align-items: center;
  }

  /* Search becomes compact */
  .search-bar {
    width: 120px;
    padding: 0.55rem 0.9rem;
  }
  .search-bar:focus { width: 150px; }

  /* Hide the username text on mobile (avatar is enough) */
  .user-trigger .username { display: none; }

  /* Make the user pill tighter */
  .user-trigger {
    padding: 4px 10px 4px 4px;
    gap: 8px;
  }
  .avatar { width: 28px; height: 28px; font-size: 0.8rem; }

  /* Buttons get smaller so they don't shove everything off-screen */
  .btn {
    padding: 0.55rem 1rem;
    font-size: 0.7rem;
  }

  /* Optional: hide “Go Live” button on mobile if you want to reduce clutter
     (comment out if you want it visible) */
  /* .nav-actions > a.btn.btn-primary { display:none; } */
}

/* Ultra small devices */
@media (max-width: 420px) {
  .search-bar { display: none; } /* stops the navbar overflowing on tiny screens */
}