/* KBC Quiz Manager - Responsive Dark Theme */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --bg-dark: #0f172a;
    --bg-surface: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --sidebar-width: 240px;
}

html, body {
    font-family: 'Roboto', sans-serif;
    margin: 0; padding: 0;
    min-height: 100vh;
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* ===== SIDEBAR / DRAWER ===== */
.sidebar {
    width: var(--sidebar-width);
    background: #16213e;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1001;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    top: 0; left: 0;
}

.sidebar .nav-link {
    display: block;
    padding: 12px 15px;
    color: #9ca3af;
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 3px;
    transition: all 0.2s;
}
.sidebar .nav-link:hover { background: rgba(124, 58, 237, 0.15); color: white; }
.sidebar .nav-link.active { background: #7c3aed; color: white; }

.drawer-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.drawer-overlay.show { display: block; opacity: 1; }

.drawer-close { display: none; text-align: right; padding: 10px 20px 0; }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s;
}

.topbar {
    height: 60px;
    background: #16213e;
    border-bottom: 1px solid #2a3f5f;
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 10px;
}

.hamburger {
    display: none;
    background: none; border: none;
    color: white; font-size: 24px;
    cursor: pointer; padding: 5px 10px;
    border-radius: 6px;
}
.hamburger:hover { background: rgba(255,255,255,0.1); }

/* ===== RESPONSIVE GRID CLASSES ===== */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.grid-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.grid-4col { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.host-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.stats-row { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 10px; }

/* ===== GAME ELEMENTS ===== */
.game-container { max-width: 900px; margin: 0 auto; padding: 20px; }
.game-container-wide { max-width: 1200px; margin: 0 auto; }

.option-btn {
    padding: 16px 20px;
    text-align: left;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: #16213e;
    border: 2px solid #2a3f5f;
    color: white;
    width: 100%;
    font-size: 15px;
}
.option-btn:hover:not(:disabled) { border-color: #7c3aed; transform: scale(1.01); }
.option-btn:disabled { cursor: not-allowed; opacity: 0.5; }
.option-btn.selected { background: rgba(124, 58, 237, 0.3); border-color: #7c3aed; }
.option-btn.correct { background: rgba(16, 185, 129, 0.2); border-color: #10b981; }
.option-btn.wrong { background: rgba(239, 68, 68, 0.2); border-color: #ef4444; }
.option-btn.hidden { opacity: 0.3; }

.lifeline-btn {
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
    border: 1px solid;
    white-space: nowrap;
}
.lifeline-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.lifeline-btn.fifty { background: rgba(245, 158, 11, 0.2); border-color: #f59e0b; color: #f59e0b; }
.lifeline-btn.skip { background: rgba(59, 130, 246, 0.2); border-color: #3b82f6; color: #3b82f6; }
.lifeline-btn.double { background: rgba(168, 85, 247, 0.2); border-color: #a855f7; color: #a855f7; }

.card { background: #16213e; border: 1px solid #2a3f5f; border-radius: 12px; padding: 20px; }
.question-card { background: linear-gradient(180deg, #0f172a, #1e293b); border: 2px solid #7c3aed; border-radius: 16px; padding: 25px; }
.answer-card-correct { background: linear-gradient(180deg, #0f172a, #1e293b); border: 2px solid #10b981; border-radius: 16px; padding: 25px; }
.answer-card-wrong { background: linear-gradient(180deg, #0f172a, #1e293b); border: 2px solid #ef4444; border-radius: 16px; padding: 25px; }

/* ===== LEADERBOARD ===== */
.live-lb { background: #16213e; border: 1px solid #2a3f5f; border-radius: 12px; overflow: hidden; }
.live-lb-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; background: #0f172a; cursor: pointer;
    user-select: none;
}
.live-lb-header:hover { background: rgba(124, 58, 237, 0.1); }
.live-lb-body { max-height: 300px; overflow-y: auto; }
.lb-row {
    display: flex; align-items: center; padding: 8px 16px;
    border-bottom: 1px solid rgba(42, 63, 95, 0.5);
    font-size: 14px; gap: 8px;
}
.lb-row.me { background: rgba(124, 58, 237, 0.15); }
.lb-row.top3 { background: rgba(251, 191, 36, 0.05); }
.lb-rank { width: 36px; font-weight: 700; flex-shrink: 0; }
.lb-name { flex: 1; color: white; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-stat { color: #9ca3af; font-size: 12px; text-align: right; min-width: 50px; }
.lb-pts { color: #fbbf24; font-weight: 700; text-align: right; min-width: 70px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); }
::-webkit-scrollbar-thumb { background: rgba(129,140,248,0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(129,140,248,0.4); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes glow { 0%,100% { box-shadow: 0 0 20px rgba(16,185,129,0.5); } 50% { box-shadow: 0 0 40px rgba(16,185,129,0.8); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.fade-in { animation: fadeIn 0.4s ease-out; }

/* ===== MUDBLAZOR OVERRIDES ===== */
.mud-paper { background-color: var(--bg-surface) !important; }
.mud-input-outlined .mud-input-outlined-border { border-color: rgba(255,255,255,0.2) !important; }
.mud-table-row:hover { background: rgba(99,102,241,0.08) !important; }
.mud-dialog { background: var(--bg-surface) !important; border: 1px solid var(--border-color); }
.mud-snackbar { border-radius: 12px !important; }

/* ===== MISC ===== */
.glass-card { background: rgba(30,41,59,0.8) !important; backdrop-filter: blur(20px); border: 1px solid var(--border-color) !important; }
.text-gradient { background: linear-gradient(135deg, var(--primary-light), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.btn-gradient { background: linear-gradient(135deg, var(--primary), var(--secondary)) !important; border: none !important; }
::selection { background: rgba(129,140,248,0.4); color: white; }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 280px; }
    .sidebar.sidebar-open { transform: translateX(0); }
    .drawer-overlay.show { display: block; }
    .drawer-close { display: block; }
    .main-content { margin-left: 0 !important; }
    .hamburger { display: block; }
    
    .grid-2col { grid-template-columns: 1fr !important; }
    .grid-4col { grid-template-columns: repeat(2, 1fr) !important; }
    .host-grid { grid-template-columns: 1fr !important; }
    .settings-grid { grid-template-columns: 1fr !important; }
    
    .game-container { padding: 12px; }
    .question-card, .answer-card-correct, .answer-card-wrong { padding: 16px; }
    .option-btn { padding: 14px 16px; font-size: 14px; }
    
    .topbar { padding: 0 12px; }
    .hide-mobile { display: none !important; }
    
    .lb-row { padding: 6px 12px; font-size: 13px; }
    .lb-stat { min-width: 40px; font-size: 11px; }
}

@media (max-width: 480px) {
    .grid-4col { grid-template-columns: 1fr 1fr !important; }
    .stats-row > div { min-width: 70px; }
    .lifeline-btn { padding: 8px 10px; font-size: 12px; }
    .question-card h2, .answer-card-correct h2, .answer-card-wrong h2 { font-size: 17px !important; }
}
