/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    /* Backgrounds */
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    /* Brand Colors */
    --primary: #3b82f6;      /* Blue */
    --accent: #f59e0b;       /* Amber/Yellow */
    --success: #22c55e;      /* Green */
    --danger: #ef4444;       /* Red */
    
    /* Text Colors */
    --text-main: #f8fafc;    /* White-ish */
    --text-muted: #94a3b8;   /* Grey */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* =========================================
   2. LAYOUT & UTILITIES
   ========================================= */
.container {
    width: 100%;
    max-width: 500px; /* Mobile-first width */
    padding: 1.5rem;
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

.text-right {
    text-align: right;
}

/* =========================================
   3. GLASSMORPHISM CARD
   ========================================= */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px); /* Safari support */
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    
    /* Animation for smooth screen switching */
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   4. TYPOGRAPHY
   ========================================= */
h1, h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: white;
}

h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
}

p {
    line-height: 1.5;
    color: var(--text-muted);
}

/* =========================================
   5. FORMS & INPUTS
   ========================================= */
input {
    width: 100%;
    padding: 14px;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* =========================================
   6. BUTTONS
   ========================================= */
button {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    margin-bottom: 0.5rem;
}

button:active {
    transform: scale(0.97);
}

button:hover {
    opacity: 0.9;
}

/* Secondary Button (Outline) */
button.secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
}

button.secondary:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

/* Danger Button */
button.danger {
    background: var(--danger);
}

/* Yellow/Action Button */
button.btn-yellow {
    background: var(--accent);
    color: #000; /* Black text for contrast */
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* =========================================
   7. DASHBOARD & STATS (Admin)
   ========================================= */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255,255,255,0.03);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.05);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums; /* Fixed width numbers */
}

/* Status Badge */
.status-badge {
    background: rgba(255,255,255,0.05);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

/* =========================================
   8. QUIZ INTERFACE (Participant)
   ========================================= */
/* Timer Bar */
.timer-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    margin: 1rem 0 2rem 0;
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    background: var(--accent);
    width: 100%;
    /* Transition is handled via JS for precision */
}

/* Question Styling */
.question-text {
    font-size: 1.25rem;
    line-height: 1.5;
    margin-bottom: 2rem;
    font-weight: 600;
    text-align: center;
}

/* Options Grid */
.options-grid {
    display: grid;
    gap: 12px;
}

.option-btn {
    text-align: left;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    padding: 16px;
    font-size: 1rem;
    transition: all 0.2s;
}

.option-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.1);
    transform: translateX(5px); /* Slight slide effect */
}

/* Feedback States */
.option-btn.correct {
    background: rgba(34, 197, 94, 0.2) !important;
    border-color: var(--success) !important;
    color: var(--success);
}

.option-btn.wrong {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: var(--danger) !important;
    color: var(--danger);
}

/* =========================================
   9. LEADERBOARD TABLE
   ========================================= */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.leaderboard-table th {
    text-align: left;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.leaderboard-table td {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.95rem;
}

.rank-1 {
    color: var(--accent);
    font-weight: bold;
    font-size: 1.1rem;
}

.rank-top {
    color: white;
    font-weight: 600;
}

/* =========================================
   10. LOADING SPINNER
   ========================================= */
.spinner {
    display: inline-block;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =========================================
   11. MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 480px) {
    .container {
        padding: 1rem;
        max-width: 100%;
    }
    
    .glass-card {
        padding: 1.5rem;
    }

    .dashboard-stats {
        gap: 5px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
}
/* =========================================
   FORCE LEADERBOARD DESIGN (Floating Pills)
   ========================================= */

/* 1. The Main "Leader board" Banner */
.lb-main-title {
    background: linear-gradient(180deg, #1e40af 0%, #172554 100%) !important;
    color: white !important;
    padding: 15px !important;
    border-radius: 12px !important;
    font-size: 1.4rem !important;
    font-weight: bold !important;
    text-align: center !important;
    box-shadow: 0 4px 15px rgba(30, 64, 175, 0.4) !important;
    margin-bottom: 20px !important;
    display: block !important;
}

/* 2. The Container for the List */
.lb-list-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important; /* Space between white pills */
    padding: 10px 5px !important;
}

/* 3. Grid Layout for Rows & Headers */
.lb-grid {
    display: grid !important;
    /* Columns: Rank | Team ID | Team Name | Score */
    grid-template-columns: 0.5fr 1fr 1.5fr 0.8fr !important;
    gap: 10px !important;
    align-items: center !important;
}

/* 4. Blue Header Pills */
.lb-header-row {
    margin-bottom: 5px !important;
}

.lb-col-header {
    background: #1e40af !important; /* Blue */
    color: white !important;
    padding: 8px 4px !important;
    border-radius: 20px !important; /* Rounded Buttons */
    font-size: 0.85rem !important;
    font-weight: bold !important;
    text-align: center !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

/* 5. White Data Rows (The Floating Cards) */
.lb-data-row {
    background: white !important;
    color: #0f172a !important; /* Dark Text */
    padding: 15px 10px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2) !important; /* Drop Shadow */
    font-weight: 600 !important;
    font-size: 0.95rem !important;
}

.lb-cell {
    text-align: center !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 6. Rank #1 Highlight (Gold Border) */
.lb-data-row.top-rank {
    border: 3px solid #f59e0b !important; /* Gold/Orange Border */
    background: #fffbeb !important;
    transform: scale(1.02);
}
/* GRID: 4 Columns (Rank | ID | Name | Score) - NO TIME */
.lb-grid {
    display: grid !important;
    grid-template-columns: 0.6fr 0.8fr 1.5fr 0.8fr !important; 
    gap: 10px !important;
    align-items: center !important;
}

.lb-col-header {
    font-size: 0.85rem !important;
    padding: 10px 5px !important;
}
/* =========================================
   ✨ ATTRACTIVE STAR RATING STYLES
   ========================================= */
.feedback-box {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    text-align: center;
}

/* The Star Container */
.stars-wrapper {
    display: flex;
    justify-content: center;
    gap: 15px; /* Space between stars */
    margin: 15px 0;
}

/* Individual Stars */
.star-rating {
    font-size: 3rem; /* Big Size */
    cursor: pointer;
    color: #475569; /* Dark Grey (Inactive) */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bouncy animation */
    display: inline-block;
    user-select: none;
}

/* Hover Effect (Slightly larger) */
.star-rating:hover {
    transform: scale(1.3);
    color: #fbbf24; /* Preview Gold */
}

/* Active / Selected State (Gold + Glow) */
.star-rating.active {
    color: #fbbf24; /* Bright Gold */
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.8); /* Golden Glow */
    transform: scale(1.2);
}

/* The Text Area */
.styled-textarea {
    width: 90%;
    padding: 12px;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.2);
    color: white;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
    resize: none;
}

.styled-textarea:focus {
    border-color: #fbbf24; /* Gold border on focus */
}

/* The Submit Button */
.btn-submit-feedback {
    margin-top: 15px;
    background: linear-gradient(45deg, #fbbf24, #d97706); /* Gold Gradient */
    color: black;
    border: none;
    padding: 12px 30px;
    border-radius: 50px; /* Pill shape */
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
    transition: transform 0.2s;
}

.btn-submit-feedback:active {
    transform: scale(0.95);
}
/* =========================================
   📝 NEW WHITE CARD DESIGN
   ========================================= */

/* The White Container */
.question-card {
    background: #ffffff;
    color: #333333;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    margin-bottom: 25px;
    text-align: left;
    border-left: 6px solid #3b82f6; /* Blue accent line */
}

/* Header: Question Number & Timer */
.q-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.q-count {
    font-size: 1rem;
    font-weight: 700;
    color: #2563eb;
}

.timer-box {
    background: #8595e8;
    color: #ed0505;
    padding: 5px 12px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 4px;
    font-family: monospace;
}

/* THE MAGIC: Preserves Code Formatting (Indentations/New Lines) */
.question-text {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.6;
    white-space: pre-wrap;  /* 👈 KEEPS SPACES & ENTERS! */
    font-family: 'Consolas', 'Courier New', monospace;
    background: #f8fafc; 
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    display: block;
}

/* White Option Buttons */
.option-btn {
    display: block;
    width: 100%;
    background: #ffffff;
    color: #333;
    padding: 15px 20px;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.option-btn:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
    border-color: #3b82f6;
}

/* Keep Green/Red colors for results */
.option-btn.correct { background: #22c55e !important; color: white !important; }
.option-btn.wrong { background: #ef4444 !important; color: white !important; }
/* =========================================
   🏆 FINAL LEADERBOARD DESIGN (Corrected)
   ========================================= */

/* 1. The Blue Header Bar */
.final-header-bar {
    background: #0d47a1; /* Deep Blue */
    color: white;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    text-transform: capitalize;
}

/* 2. The Column Headers (Blue Pills) */
.final-pill-row {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr 2fr 1fr; /* Rank | ID | Name | Score */
    gap: 10px;
    margin-bottom: 15px;
}

.final-pill {
    background: #1565c0;
    color: white;
    padding: 8px 5px;
    border-radius: 20px; /* Round Pill Shape */
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 3. The Data Rows (White Cards) */
.final-row {
    background: #ffffff;
    color: #333;
    padding: 15px 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 0.8fr 1.2fr 2fr 1fr; /* Matches Headers */
    align-items: center;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-weight: 500;
    font-size: 0.95rem;
}

/* 4. The Appreciation Card (Bottom) */
.thank-you-card {
    background: #ffffff;
    color: #333;
    padding: 30px 20px;
    border-radius: 12px;
    margin-top: 30px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.thank-text {
    font-size: 1rem;
    line-height: 1.5;
    color: #444;
    margin-bottom: 25px;
}

/* 5. Feedback Button (Blue) */
.btn-feedback-blue {
    background: #0d47a1;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    max-width: 250px;
    transition: background 0.2s;
}

.btn-feedback-blue:hover { 
    background: #0a357a; 
}

/* 6. Feedback Form Container (Hidden initially) */
#feedback-ui {
    display: none; 
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}
/* =========================================
   👑 ADMIN DASHBOARD STYLES
   ========================================= */

/* Stats Grid (3 Boxes) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-box {
    background: #1e293b;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #334155;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: #3b82f6;
    margin: 10px 0;
}
/* =========================================
   👑 ADMIN DASHBOARD STYLES (Vertical)
   ========================================= */

/* Main Container (Narrow like Mobile App) */
.admin-container {
    max-width: 500px; 
    margin: 0 auto;
    width: 100%;
}

/* 1. STATS ROW (4 Black Boxes) */
.admin-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.admin-stat-box {
    background: #000000;
    color: white;
    padding: 10px 5px;
    border-radius: 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.active-box { border: 2px solid #00a8ff; } /* Blue outline for Active */

.stat-label { font-size: 0.65rem; margin-bottom: 5px; line-height: 1.2; opacity: 0.9; }
.stat-val { font-size: 1.2rem; font-weight: bold; }

/* 2. BIG TIMER (Digital Clock) */
.admin-timer-display {
    text-align: center;
    font-size: 3rem;
    font-weight: 800;
    background: white;
    color: black;
    border: 3px solid #333;
    width: fit-content;
    margin: 0 auto 25px auto;
    padding: 5px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    letter-spacing: 2px;
}

/* 3. BUTTON STACK */
.admin-button-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 35px;
}

.admin-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 5px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}
.admin-btn:active { transform: scale(0.98); }

.btn-blue { background: #1e40af; color: white; border: 1px solid #172554; } 
.btn-blue:hover { background: #1e3a8a; }

.btn-red { background: #b91c1c; color: white; border: 1px solid #991b1b; }

/* 4. SECTION HEADERS */
.admin-section-header {
    background: #1e40af;
    color: white;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    margin-bottom: 15px;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* 5. LIVE QUESTION CARD (Orange Accent) */
.admin-live-q-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    border-left: 6px solid #f59e0b;
}

.admin-q-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.admin-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.admin-opt-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 10px;
    border-radius: 8px;
    color: #475569;
    font-size: 0.85rem;
    text-align: left;
}

/* 6. LIVE LEADERBOARD (Blue Header + White Rows) */
.admin-lb-header {
    display: grid;
    grid-template-columns: 0.5fr 1fr 2fr 1fr;
    gap: 10px;
    background: #1e3a8a;
    color: white;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: bold;
    text-align: center;
    font-size: 0.8rem;
}

.admin-lb-row {
    display: grid;
    grid-template-columns: 0.5fr 1fr 2fr 1fr;
    gap: 10px;
    background: white;
    padding: 12px 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    align-items: center;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}
/* =========================================
   🏆 FINAL SCREEN STYLES (Target Design Match)
   ========================================= */

/* Main Title */
.fs-title {
    color: #2563eb; 
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
}

/* "Leader board" Header Box */
.fs-main-header {
    background: #0d47a1; /* Dark Blue */
    color: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

/* Grid Layout */
.fs-grid-layout {
    display: grid;
    grid-template-columns: 0.6fr 1fr 2fr 0.8fr; 
    gap: 8px;
    align-items: center;
}

/* Column Headers (Pills) */
.fs-pill {
    background: #1565c0; /* Blue */
    color: white;
    padding: 8px 4px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Data Rows (Zebra Striping) */
.fs-row {
    background: #f3f4f6; /* Default Light Grey */
    color: #333;
    padding: 12px 5px;
    border-radius: 6px;
    margin-bottom: 5px;
    text-align: center;
    font-weight: 500;
    font-size: 0.95rem;
}

/* Make every ODD row white (Zebra Effect) */
.fs-row:nth-child(odd) {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Appreciation Card (Grey Box) */
.fs-card {
    background: #f3f4f6; /* Light Grey Background */
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    margin-top: 30px;
}

.fs-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    display: block;
    color: #333;
}

.fs-text {
    color: #1f2937;
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 25px;
    font-weight: 500;
}

/* Button */
.fs-btn {
    background: #0d47a1;
    color: white;
    padding: 12px 40px;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.1s;
}
.fs-btn:active { transform: scale(0.98); }

/* Stars */
.star-rating {
    font-size: 2.5rem;
    cursor: pointer;
    color: #cbd5e1; /* Grey inactive */
    transition: color 0.2s;
    margin: 0 2px;
}
.star-rating.active { color: #f59e0b; } /* Gold active */
