/* Sportstake Quiz - Dark Projection Theme
   Optimised for pub/venue projected environments */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2cb1ff;
    --primary-dark: #1a8fd4;
    --secondary: #ff6b35;
    --success: #00e676;
    --danger: #ff4757;
    --warning: #ffc312;
    --dark: #0f0e17;
    --dark-mid: #1a1932;
    --light: rgba(255,255,255,0.06);
    --white: #fffffe;
    --text: rgba(255,255,255,0.92);
    --text-muted: rgba(255,255,255,0.55);
    --border: rgba(255,255,255,0.12);

    --answer-a: #e63946;
    --answer-b: #2176ff;
    --answer-c: #f4a100;
    --answer-d: #06d6a0;

    --surface: rgba(255,255,255,0.06);
    --surface-hover: rgba(255,255,255,0.12);
    --surface-border: rgba(255,255,255,0.10);

    --radius: 16px;
    --radius-sm: 10px;
}


body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0f0e17 0%, #1a1932 40%, #2d1b4e 70%, #0f0e17 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text);
    padding: 10px;
}

body.host-view {
    padding: 0;
}
body.host-view::before {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0f0e17 0%, #1a1932 40%, #2d1b4e 70%, #0f0e17 100%);
    background-size: 400% 400%;
    animation: gradientShift 25s ease infinite;
    z-index: -2;
}
body.host-view::after {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 25% 20%, rgba(44,177,255,0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 80%, rgba(106,17,203,0.07) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: rgba(26,25,50,0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    padding: 20px;
    min-height: calc(100vh - 20px);
}

/* Fix dropdown options invisible on dark theme */
select option {
  color: #111 !important;
  background: #fff !important;
}

/* Make the selected value readable */
select {
  color: #fff;              /* or var(--text) if you have it */
  background: var(--dark);  /* or your input background variable */
}


h1, h2, h3 { color: var(--white); margin-bottom: 15px; font-weight: 700; }
h1 { font-size: 28px; text-align: center; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 14px 28px;
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s;
    width: 100%;
    margin: 5px 0;
    letter-spacing: 0.3px;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6c5ce7);
    color: var(--white);
    box-shadow: 0 4px 20px rgba(44,177,255,0.3);
}
.btn-primary:hover {
    box-shadow: 0 6px 28px rgba(44,177,255,0.45);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #00c853, #00e676);
    color: #0a3d0a;
    box-shadow: 0 4px 20px rgba(0,230,118,0.3);
}
.btn-success:hover {
    box-shadow: 0 6px 28px rgba(0,230,118,0.45);
    transform: translateY(-1px);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 2px solid rgba(255,71,87,0.35);
}
.btn-danger:hover { background: rgba(255,71,87,0.1); }

.btn-warning { background: var(--warning); color: var(--dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ===== Forms ===== */
.form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text); }

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: var(--white);
    transition: border-color 0.3s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44,177,255,0.15);
}
input::placeholder { color: var(--text-muted); }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.checkbox-item { display: flex; align-items: center; gap: 5px; color: var(--text); }
.checkbox-item input[type="checkbox"] { width: auto; margin: 0; }

/* ===== Alerts ===== */
.alert { padding: 14px 18px; border-radius: 10px; margin-bottom: 20px; font-weight: 500; }
.alert-success { background: rgba(0,230,118,0.12); color: #69f0ae; border: 1px solid rgba(0,230,118,0.25); }
.alert-error { background: rgba(255,71,87,0.12); color: #ff6b7a; border: 1px solid rgba(255,71,87,0.25); }
.alert-info { background: rgba(44,177,255,0.12); color: #81d4fa; border: 1px solid rgba(44,177,255,0.25); }
.alert-warning { background: rgba(255,195,18,0.12); color: #ffd54f; border: 1px solid rgba(255,195,18,0.25); }

.loading { text-align: center; padding: 40px; font-size: 18px; color: var(--primary); }

/* ===== Question Styles ===== */
.question-container { text-align: center; padding: 20px 0; }
.question-number { font-size: 15px; font-weight: 600; color: var(--text-muted); margin-bottom: 10px; }
.question-text { font-size: 24px; font-weight: 700; margin: 20px 0; line-height: 1.35; color: var(--white); }

/* Category Badge */
.category-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(44,177,255,0.12); border: 1px solid rgba(44,177,255,0.3);
    color: var(--primary); font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 2px;
    padding: 5px 16px; border-radius: 30px; margin-bottom: 8px;
}

/* ===== Timer ===== */
.timer {
    font-family: 'JetBrains Mono', monospace;
    font-size: 48px; font-weight: 700;
    color: var(--primary); margin: 20px 0;
}
.timer.warning {
    color: var(--danger);
    animation: timerPulse 0.6s ease infinite;
}
@keyframes timerPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.06); opacity: 0.85; }
}

/* SVG Timer Ring (host view) */
.timer-ring-wrap {
    position: relative; width: 110px; height: 110px; margin: 10px auto;
}
.timer-ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring-wrap .timer-track { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 5; }
.timer-ring-wrap .timer-fill {
    fill: none; stroke: var(--primary); stroke-width: 5; stroke-linecap: round;
    stroke-dasharray: 264; stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.3s linear, stroke 0.3s;
    filter: drop-shadow(0 0 8px rgba(44,177,255,0.4));
}
.timer-ring-wrap.urgent .timer-fill {
    stroke: var(--danger); filter: drop-shadow(0 0 12px rgba(255,71,87,0.5));
}
.timer-ring-number {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: 'JetBrains Mono', monospace; font-size: 38px; font-weight: 700; color: var(--white);
}
.timer-ring-wrap.urgent .timer-ring-number {
    color: var(--danger); animation: timerPulse 0.5s ease infinite;
}

/* Progress Bar */
.progress-track {
    width: 220px; height: 5px;
    background: rgba(255,255,255,0.08); border-radius: 5px;
    margin: 6px auto 0; overflow: hidden;
}
.progress-fill { height: 100%; background: var(--primary); border-radius: 5px; transition: width 0.5s ease; }

/* ===== Answer Options ===== */
.answer-options { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 20px 0; }

.answer-btn {
    padding: 18px 20px;
    font-family: 'Outfit', sans-serif; font-size: 18px; font-weight: 700;
    background: var(--surface); border: 2px solid var(--surface-border);
    border-radius: 14px; cursor: pointer; transition: all 0.2s;
    text-align: left; color: var(--white);
    display: flex; align-items: center; gap: 14px;
}
.answer-btn:hover:not(:disabled) { background: var(--surface-hover); border-color: rgba(255,255,255,0.2); transform: translateY(-1px); }
.answer-btn:active:not(:disabled) { transform: scale(0.98); }
.answer-btn:disabled { cursor: not-allowed; opacity: 0.5; }

/* Colour-coded answer buttons (host projected view) */
.answer-btn.color-a { background: var(--answer-a); border-color: var(--answer-a); box-shadow: 0 4px 18px rgba(230,57,70,0.3); color: white; }
.answer-btn.color-b { background: var(--answer-b); border-color: var(--answer-b); box-shadow: 0 4px 18px rgba(33,118,255,0.3); color: white; }
.answer-btn.color-c { background: var(--answer-c); border-color: var(--answer-c); box-shadow: 0 4px 18px rgba(244,161,0,0.3); color: white; }
.answer-btn.color-d { background: var(--answer-d); border-color: var(--answer-d); box-shadow: 0 4px 18px rgba(6,214,160,0.3); color: white; }

.answer-btn.color-a:hover, .answer-btn.color-b:hover,
.answer-btn.color-c:hover, .answer-btn.color-d:hover { filter: brightness(1.1); transform: translateY(-2px); }

.answer-letter { font-family: 'JetBrains Mono', monospace; font-size: 20px; font-weight: 700; opacity: 0.5; min-width: 28px; }
.answer-vote-count { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 16px; font-weight: 700; opacity: 0; transition: opacity 0.3s; }
.answer-btn.show-votes .answer-vote-count { opacity: 0.7; }

.answer-btn.correct { box-shadow: 0 0 0 4px var(--success), 0 4px 28px rgba(0,230,118,0.4) !important; position: relative; }
.answer-btn.correct::after {
    content: '✓'; position: absolute; right: 20px; font-size: 28px; color: white;
    animation: checkBounce 0.35s ease;
}
@keyframes checkBounce {
    0% { transform: scale(0) rotate(-45deg); opacity: 0; }
    60% { transform: scale(1.2) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}
.answer-btn.incorrect { opacity: 0.35 !important; }

/* Answer Status Counter */
.answer-status-bar {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin: 10px 0; min-height: 30px; font-size: 16px; font-weight: 600; color: var(--text-muted);
}
.answer-status-bar .status-count { font-family: 'JetBrains Mono', monospace; color: var(--primary); font-weight: 700; }

/* ===== Leaderboard ===== */
.leaderboard { margin: 20px 0; }
.leaderboard-item {
    display: flex; align-items: center; padding: 14px 18px; margin: 8px 0;
    background: var(--surface); border-radius: 12px; border-left: 4px solid var(--border);
}
.leaderboard-item.rank-1 { background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,237,78,0.08)); border-left-color: #ffd700; }
.leaderboard-item.rank-2 { background: linear-gradient(135deg, rgba(192,192,192,0.12), rgba(232,232,232,0.06)); border-left-color: #c0c0c0; }
.leaderboard-item.rank-3 { background: linear-gradient(135deg, rgba(205,127,50,0.12), rgba(230,165,93,0.06)); border-left-color: #cd7f32; }

.rank-number {
    font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 700;
    width: 40px; height: 40px; line-height: 40px; text-align: center;
    color: var(--text-muted); border-radius: 10px; background: rgba(255,255,255,0.06);
}
.leaderboard-item.rank-1 .rank-number { color: #ffd700; background: rgba(255,215,0,0.12); }
.leaderboard-item.rank-2 .rank-number { color: #c0c0c0; background: rgba(192,192,192,0.10); }
.leaderboard-item.rank-3 .rank-number { color: #cd7f32; background: rgba(205,127,50,0.10); }

.player-name { flex: 1; font-size: 18px; font-weight: 600; margin-left: 15px; color: var(--white); }
.player-points { font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 700; color: var(--success); }

/* ===== Lobby Misc ===== */
.player-list { margin: 20px 0; }
.player-item { padding: 12px; margin: 8px 0; background: var(--surface); border-radius: 8px; font-size: 16px; color: var(--text); }

.qr-container { text-align: center; padding: 20px; background: var(--surface); border-radius: 12px; margin: 20px 0; }
.join-code { font-family: 'JetBrains Mono', monospace; font-size: 48px; font-weight: 700; letter-spacing: 8px; color: var(--primary); margin: 20px 0; }
.join-url { font-size: 14px; color: var(--text-muted); word-break: break-all; margin-top: 10px; }

/* Player Chips */
.player-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 600px; margin: 12px auto; }
.player-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface); border: 1px solid var(--surface-border);
    padding: 6px 14px; border-radius: 20px; font-size: 14px; font-weight: 600; color: var(--white);
    animation: chipIn 0.3s ease-out;
}
.player-chip .chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: dotPulse 2s ease infinite; }
@keyframes chipIn { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes dotPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Admin */
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 2px solid var(--border); }
.question-list { margin: 20px 0; }
.question-item { padding: 15px; margin: 10px 0; background: var(--surface); border-radius: 8px; border-left: 4px solid var(--primary); }
.question-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.question-meta { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.question-actions { display: flex; gap: 5px; }
.btn-sm { padding: 6px 12px; font-size: 14px; width: auto; }

/* ===== Responsive ===== */
@media (min-width: 768px) {
    .container { padding: 30px; }
    h1 { font-size: 32px; }
    .question-text { font-size: 28px; }
    .answer-btn { padding: 20px; font-size: 20px; }
}

/* ===== Utilities ===== */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none; }
