/* === G&G QUIZ GAME — Design System === */
:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #111640;
    --bg-card: rgba(26, 26, 78, 0.7);
    --bg-glass: rgba(255,255,255,0.05);
    --accent: #00d4ff;
    --accent-glow: rgba(0,212,255,0.3);
    --gold: #ffd700;
    --gold-glow: rgba(255,215,0,0.3);
    --green: #00e676;
    --red: #ff1744;
    --text: #f0f0ff;
    --text-muted: #8888aa;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
    --transition: all 0.3s cubic-bezier(.4,0,.2,1);
}

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

html, body { height: 100%; }

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(0,212,255,0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 80%, rgba(255,215,0,0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

#app { position: relative; z-index: 1; min-height: 100vh; }

/* === LOADING === */
.loading-screen {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: var(--bg-primary);
}
.loading-logo { text-align: center; }
.loading-icon { font-size: 4rem; display: block; margin-bottom: 1rem; animation: pulse 1.5s infinite; }
.loading-logo h1 { font-family: var(--font-heading); font-size: 2rem; color: var(--gold); }
.loading-logo p { color: var(--text-muted); margin-top: 1rem; }
.loading-spinner {
    width: 40px; height: 40px; margin: 1.5rem auto;
    border: 3px solid var(--bg-glass); border-top-color: var(--accent);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.5rem); }
a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--gold); }

/* === LAYOUT === */
.page-container { max-width: 900px; margin: 0 auto; padding: 1.5rem; }
.page-title { text-align: center; margin-bottom: 2rem; }
.page-title span { color: var(--gold); }

/* === CARDS === */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.card:hover { border-color: rgba(0,212,255,0.2); transform: translateY(-2px); }
.card-glow { box-shadow: var(--shadow), 0 0 30px var(--accent-glow); }

/* === BUTTONS === */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.8rem 1.8rem; border: none; border-radius: var(--radius-sm);
    font-family: var(--font-heading); font-weight: 600; font-size: 1rem;
    cursor: pointer; transition: var(--transition); text-decoration: none;
    position: relative; overflow: hidden;
}
.btn::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0; transition: var(--transition);
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, #00b4d8, #0077b6);
    color: white; box-shadow: 0 4px 15px rgba(0,180,216,0.3);
}
.btn-primary:hover { box-shadow: 0 6px 25px rgba(0,180,216,0.5); transform: translateY(-2px); }

.btn-gold {
    background: linear-gradient(135deg, #ffd700, #f4a100);
    color: #1a1a2e; box-shadow: 0 4px 15px var(--gold-glow);
}
.btn-gold:hover { box-shadow: 0 6px 25px rgba(255,215,0,0.5); transform: translateY(-2px); }

.btn-danger {
    background: linear-gradient(135deg, #ff1744, #d50000);
    color: white;
}

.btn-outline {
    background: transparent; border: 2px solid var(--accent);
    color: var(--accent);
}
.btn-outline:hover { background: var(--accent); color: var(--bg-primary); }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-lg { padding: 1rem 2.5rem; font-size: 1.2rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* === FORMS === */
.form-group { margin-bottom: 1.2rem; }
.form-label { display: block; font-weight: 600; margin-bottom: 0.4rem; color: var(--text); font-size: 0.9rem; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 0.8rem 1rem;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-sm); color: var(--text);
    font-family: var(--font-body); font-size: 1rem;
    transition: var(--transition); outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-error { color: var(--red); font-size: 0.8rem; margin-top: 0.3rem; }
.form-select option { background: var(--bg-secondary); color: var(--text); }

/* === NAV === */
.navbar {
    background: rgba(10,14,39,0.9); backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 0.8rem 1.5rem; position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
}
.navbar-brand {
    font-family: var(--font-heading); font-size: 1.3rem; font-weight: 800;
    color: var(--gold); display: flex; align-items: center; gap: 0.5rem;
}
.navbar-links { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.nav-link {
    padding: 0.5rem 1rem; border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 500; font-size: 0.9rem;
    transition: var(--transition);
}
.nav-link:hover, .nav-link.active { color: var(--accent); background: var(--bg-glass); }
.nav-user { display: flex; align-items: center; gap: 0.5rem; color: var(--gold); font-weight: 600; }

/* === ANSWER BUTTONS (GAME) === */
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin: 1.5rem 0; }
@media (max-width: 600px) { .answer-grid { grid-template-columns: 1fr; } }

.answer-btn {
    background: linear-gradient(135deg, rgba(26,26,78,0.9), rgba(17,22,64,0.9));
    border: 2px solid rgba(0,212,255,0.2);
    border-radius: var(--radius-sm); padding: 1rem 1.2rem;
    color: var(--text); font-family: var(--font-heading); font-size: 1rem; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; gap: 0.8rem; text-align: left;
    position: relative; overflow: hidden;
}
.answer-btn:hover:not(:disabled) {
    border-color: var(--accent); background: rgba(0,212,255,0.1);
    box-shadow: 0 0 20px var(--accent-glow); transform: scale(1.02);
}
.answer-label {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; background: var(--accent);
    color: var(--bg-primary); font-weight: 800; border-radius: 50%;
    flex-shrink: 0;
}
.answer-btn.correct {
    border-color: var(--green) !important;
    background: rgba(0,230,118,0.15) !important;
    box-shadow: 0 0 30px rgba(0,230,118,0.3) !important;
    animation: correctPulse 0.6s ease;
}
.answer-btn.wrong {
    border-color: var(--red) !important;
    background: rgba(255,23,68,0.15) !important;
    box-shadow: 0 0 30px rgba(255,23,68,0.3) !important;
    animation: shake 0.5s ease;
}
.answer-btn.eliminated { opacity: 0.2; pointer-events: none; transform: scale(0.95); }
.answer-btn:disabled { cursor: not-allowed; }

/* === TIMER === */
.timer-container { display: flex; align-items: center; justify-content: center; margin: 1rem 0; }
.timer-circle {
    width: 80px; height: 80px; position: relative;
    display: flex; align-items: center; justify-content: center;
}
.timer-svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer-track { fill: none; stroke: rgba(255,255,255,0.1); stroke-width: 4; }
.timer-progress {
    fill: none; stroke: var(--accent); stroke-width: 4;
    stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.timer-progress.warning { stroke: #ffab00; }
.timer-progress.danger { stroke: var(--red); }
.timer-text {
    font-family: var(--font-heading); font-size: 1.5rem; font-weight: 800;
    color: var(--text); z-index: 1;
}
.timer-text.warning { color: #ffab00; }
.timer-text.danger { color: var(--red); animation: pulse 0.5s infinite; }

/* === QUESTION CARD === */
.question-card {
    text-align: center; margin-bottom: 1.5rem;
}
.question-number {
    font-family: var(--font-heading); font-size: 0.9rem;
    color: var(--accent); text-transform: uppercase; letter-spacing: 2px;
    margin-bottom: 0.5rem;
}
.question-category {
    display: inline-block; padding: 0.3rem 0.8rem;
    background: var(--bg-glass); border-radius: 20px;
    font-size: 0.8rem; color: var(--gold); margin-bottom: 1rem;
}
.question-text {
    font-family: var(--font-heading); font-size: clamp(1.1rem, 3vw, 1.5rem);
    font-weight: 600; line-height: 1.4; margin-bottom: 1rem;
}
.question-image {
    max-width: 100%; max-height: 300px; border-radius: var(--radius-sm);
    margin: 1rem auto; display: block; object-fit: contain;
    border: 1px solid rgba(255,255,255,0.1);
}

/* === LIFELINE === */
.lifeline-bar { display: flex; justify-content: center; gap: 1rem; margin: 1rem 0; }
.lifeline-btn {
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,165,0,0.1));
    border: 2px solid var(--gold);
    border-radius: var(--radius-sm); color: var(--gold);
    font-family: var(--font-heading); font-weight: 700;
    cursor: pointer; transition: var(--transition);
}
.lifeline-btn:hover:not(:disabled) {
    background: var(--gold); color: var(--bg-primary);
    box-shadow: 0 0 20px var(--gold-glow);
}
.lifeline-btn:disabled { opacity: 0.3; cursor: not-allowed; border-color: var(--text-muted); color: var(--text-muted); }
.lifeline-btn.used { opacity: 0.3; text-decoration: line-through; }

/* === PROGRESS BAR (Money Ladder) === */
.progress-ladder {
    display: flex; gap: 0.3rem; justify-content: center; flex-wrap: wrap; margin: 1rem 0;
}
.progress-step {
    width: 36px; height: 36px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-family: var(--font-heading); font-weight: 700; font-size: 0.75rem;
    border: 2px solid rgba(255,255,255,0.15);
    background: var(--bg-glass); color: var(--text-muted);
    transition: var(--transition);
}
.progress-step.active { border-color: var(--accent); color: var(--accent); background: rgba(0,212,255,0.1); box-shadow: 0 0 10px var(--accent-glow); }
.progress-step.completed { border-color: var(--green); color: var(--green); background: rgba(0,230,118,0.1); }
.progress-step.failed { border-color: var(--red); color: var(--red); background: rgba(255,23,68,0.1); }

/* === LEADERBOARD TABLE === */
.leaderboard-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.leaderboard-table th {
    text-align: left; padding: 0.8rem; font-family: var(--font-heading);
    color: var(--accent); border-bottom: 2px solid rgba(0,212,255,0.2);
    font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px;
}
.leaderboard-table td {
    padding: 0.7rem 0.8rem; border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.9rem;
}
.leaderboard-table tr:hover td { background: var(--bg-glass); }
.rank-1 { color: var(--gold); font-weight: 800; }
.rank-2 { color: #c0c0c0; font-weight: 700; }
.rank-3 { color: #cd7f32; font-weight: 700; }

.avatar-sm {
    width: 32px; height: 32px; border-radius: 50%;
    object-fit: cover; border: 2px solid var(--accent);
}
.avatar-placeholder {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #0077b6);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem; color: white;
}

/* === STATS GRID === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.stat-card {
    background: var(--bg-glass); border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-sm); padding: 1.2rem; text-align: center;
}
.stat-value { font-family: var(--font-heading); font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }

/* === HOME MENU === */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; margin: 2rem 0; }
.menu-card {
    background: var(--bg-card); backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius); padding: 2rem;
    text-align: center; cursor: pointer; transition: var(--transition);
    text-decoration: none; color: var(--text);
}
.menu-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 12px 40px rgba(0,212,255,0.15); }
.menu-icon { font-size: 3rem; margin-bottom: 1rem; display: block; }
.menu-card h3 { font-family: var(--font-heading); margin-bottom: 0.5rem; }
.menu-card p { color: var(--text-muted); font-size: 0.9rem; }

/* === GAME RESULT === */
.result-header { text-align: center; margin-bottom: 2rem; }
.result-score {
    font-family: var(--font-heading); font-size: 3rem; font-weight: 900;
    background: linear-gradient(135deg, var(--gold), #ff8f00);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.result-details { margin: 1.5rem 0; }
.result-row { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid rgba(255,255,255,0.05); }

/* === DIFFICULTY SELECTOR === */
.difficulty-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.difficulty-btn {
    padding: 0.5rem 1.2rem; border: 2px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-sm); background: var(--bg-glass);
    color: var(--text-muted); font-family: var(--font-heading); font-weight: 600;
    cursor: pointer; transition: var(--transition);
}
.difficulty-btn:hover { border-color: var(--accent); color: var(--accent); }
.difficulty-btn.active-easy { border-color: var(--green); color: var(--green); background: rgba(0,230,118,0.1); }
.difficulty-btn.active-medium { border-color: #ffab00; color: #ffab00; background: rgba(255,171,0,0.1); }
.difficulty-btn.active-hard { border-color: var(--red); color: var(--red); background: rgba(255,23,68,0.1); }

/* === ALERTS === */
.alert {
    padding: 1rem 1.2rem; border-radius: var(--radius-sm);
    margin-bottom: 1rem; display: flex; align-items: center; gap: 0.8rem;
}
.alert-success { background: rgba(0,230,118,0.1); border: 1px solid rgba(0,230,118,0.3); color: var(--green); }
.alert-error { background: rgba(255,23,68,0.1); border: 1px solid rgba(255,23,68,0.3); color: var(--red); }
.alert-info { background: rgba(0,212,255,0.1); border: 1px solid rgba(0,212,255,0.3); color: var(--accent); }

/* === TABS === */
.tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 2px solid rgba(255,255,255,0.08); }
.tab {
    padding: 0.8rem 1.5rem; font-family: var(--font-heading); font-weight: 600;
    color: var(--text-muted); cursor: pointer; transition: var(--transition);
    border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* === IMAGE UPLOAD === */
.image-upload {
    border: 2px dashed rgba(255,255,255,0.15); border-radius: var(--radius-sm);
    padding: 2rem; text-align: center; cursor: pointer; transition: var(--transition);
}
.image-upload:hover { border-color: var(--accent); background: rgba(0,212,255,0.05); }
.image-preview { max-width: 200px; max-height: 200px; border-radius: var(--radius-sm); margin-top: 1rem; }

/* === ANIMATIONS === */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}
@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.slide-in { animation: slideIn 0.4s ease forwards; }
.fade-in { animation: fadeIn 0.3s ease forwards; }

/* === ERROR UI === */
#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 1000; background: var(--red); color: white;
    padding: 1rem; text-align: center;
}
#blazor-error-ui .reload { color: var(--gold); text-decoration: underline; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .navbar { flex-direction: column; gap: 0.5rem; }
    .navbar-links { justify-content: center; }
    .page-container { padding: 1rem; }
    .card { padding: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .menu-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .stat-value { font-size: 1.4rem; }
    .answer-btn { padding: 0.8rem; font-size: 0.9rem; }
    .answer-label { width: 30px; height: 30px; font-size: 0.8rem; }
    .leaderboard-table { font-size: 0.8rem; }
    .leaderboard-table th, .leaderboard-table td { padding: 0.5rem; }
}
