/* ===========================================
   THE BIG QUIZ - Core Styles
   Quiltt brand aligned with game show excitement
   =========================================== */

/* CSS Variables */
:root {
    /* Quiltt Brand Colors */
    --quiltt-teal: #00A5A8;
    --quiltt-teal-dark: #008587;
    --quiltt-teal-light: #E0F7F7;
    
    /* Quiz Theme - Lighter main area */
    --quiz-dark: #374151;
    --quiz-dark-light: #4B5563;
    --quiz-dark-deeper: #1F2937;
    
    /* Background for main content */
    --bg-main: #F3F4F6;
    --bg-card: #FFFFFF;
    
    /* Primary Accent - Quiltt Teal */
    --quiz-accent: #00A5A8;
    --quiz-accent-light: #4ECDC4;
    --quiz-accent-glow: rgba(0, 165, 168, 0.3);
    
    /* Answer colors - Quiltt pastels inspired */
    --answer-red: #EF4444;
    --answer-red-dark: #DC2626;
    --answer-blue: #3B82F6;
    --answer-blue-dark: #2563EB;
    --answer-green: #10B981;
    --answer-green-dark: #059669;
    --answer-yellow: #F59E0B;
    --answer-yellow-dark: #D97706;
    
    /* Status colors */
    --correct: #10B981;
    --wrong: #EF4444;
    --eliminated: #6B7280;
    
    /* Text */
    --text-light: #FFFFFF;
    --text-muted: rgba(255, 255, 255, 0.7);
    --text-dark: #1F2937;
    --text-medium: #4B5563;
    
    /* Pastels for accents */
    --pastel-mint: #D1FAE5;
    --pastel-blue: #DBEAFE;
    --pastel-peach: #FED7AA;
    --pastel-yellow: #FEF3C7;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(0, 165, 168, 0.3);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
    
    /* Fonts */
    --font-display: 'Fredoka', 'Comic Sans MS', sans-serif;
    --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Google Fonts - same as Quiltt */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@400;500;600;700&display=swap');

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--quiz-dark);
    color: var(--text-light);
    min-height: 100vh;
    line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

@media (max-width: 600px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

/* ===========================================
   Layout Components
   =========================================== */

.quiz-container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-lg);
}

.quiz-header {
    background: linear-gradient(135deg, var(--quiltt-teal) 0%, var(--quiltt-teal-dark) 100%);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
}

.quiz-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--text-light);
}

.quiz-logo img {
    height: 40px;
    width: auto;
}

.quiz-logo-text {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-light);
}

/* ===========================================
   Cards & Panels
   =========================================== */

.quiz-card {
    background: var(--quiz-dark-light);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-md);
}

.quiz-card--highlight {
    border-color: var(--quiltt-teal);
    box-shadow: var(--shadow-glow);
}

/* ===========================================
   Buttons
   =========================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.75rem 1.25rem;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--quiltt-teal);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    background: var(--quiltt-teal-dark);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: white;
    color: var(--quiltt-teal);
    border: 2px solid var(--quiltt-teal);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--quiltt-teal-light);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--quiltt-teal);
}

.btn-lg {
    padding: 1rem 1.75rem;
    font-size: 1.125rem;
}

.btn-block {
    width: 100%;
}

/* ===========================================
   Form Elements
   =========================================== */

.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: var(--space-sm);
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    color: var(--text-light);
    transition: all var(--transition-fast);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    outline: none;
    border-color: var(--quiltt-teal);
    box-shadow: 0 0 0 3px var(--quiz-accent-glow);
    background: rgba(255, 255, 255, 0.15);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2300A5A8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

/* ===========================================
   Answer Buttons (A, B, C, D)
   =========================================== */

.answer-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin: var(--space-xl) 0;
}

@media (max-width: 500px) {
    .answer-grid {
        grid-template-columns: 1fr;
    }
}

.answer-btn {
    position: relative;
    padding: 1.25rem;
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: left;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-height: 80px;
    box-shadow: var(--shadow-sm);
}

.answer-btn:hover:not(:disabled):not(.eliminated) {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.answer-btn:active:not(:disabled):not(.eliminated) {
    transform: scale(0.98);
}

.answer-letter {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.answer-text {
    flex: 1;
    line-height: 1.4;
}

/* Answer color variants */
.answer-btn--a {
    background: linear-gradient(135deg, var(--answer-red) 0%, var(--answer-red-dark) 100%);
    color: white;
}

.answer-btn--b {
    background: linear-gradient(135deg, var(--answer-blue) 0%, var(--answer-blue-dark) 100%);
    color: white;
}

.answer-btn--c {
    background: linear-gradient(135deg, var(--answer-green) 0%, var(--answer-green-dark) 100%);
    color: white;
}

.answer-btn--d {
    background: linear-gradient(135deg, var(--answer-yellow) 0%, var(--answer-yellow-dark) 100%);
    color: white;
}

/* Eliminated state */
.answer-btn.eliminated {
    background: var(--eliminated) !important;
    color: rgba(255, 255, 255, 0.5) !important;
    cursor: not-allowed;
    transform: scale(0.95);
    opacity: 0.6;
}

.answer-btn.eliminated .answer-letter {
    background: rgba(0, 0, 0, 0.3);
}

/* Selected state */
.answer-btn.selected {
    box-shadow: 0 0 0 4px white, var(--shadow-md);
}

/* Correct/Wrong reveal */
.answer-btn.correct {
    background: var(--correct) !important;
    color: white !important;
    animation: pulse-correct 0.5s ease;
}

.answer-btn.wrong {
    background: var(--wrong) !important;
    color: white !important;
}

@keyframes pulse-correct {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ===========================================
   Timer Display
   =========================================== */

.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: var(--space-xl) 0;
}

.timer-ring {
    position: relative;
    width: 140px;
    height: 140px;
}

.timer-ring svg {
    transform: rotate(-90deg);
}

.timer-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
}

.timer-ring-progress {
    fill: none;
    stroke: var(--quiltt-teal);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.timer-ring-progress.warning {
    stroke: var(--answer-yellow);
}

.timer-ring-progress.danger {
    stroke: var(--answer-red);
}

.timer-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.timer-seconds {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-light);
    line-height: 1;
}

.timer-points {
    font-size: 0.9rem;
    color: var(--quiltt-teal);
    font-weight: 600;
    margin-top: var(--space-xs);
}

/* ===========================================
   Question Display
   =========================================== */

.question-container {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.question-category {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--quiltt-teal-light);
    color: var(--quiltt-teal-dark);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.question-number {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
}

.question-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
    max-width: 700px;
    margin: 0 auto;
}

@media (max-width: 600px) {
    .question-text {
        font-size: 1.25rem;
    }
}

/* ===========================================
   Score Display
   =========================================== */

.score-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.3);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.score-item {
    text-align: center;
}

.score-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-value {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--quiltt-teal);
}

.score-value--points {
    color: var(--correct);
}

.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--answer-yellow), var(--answer-yellow-dark));
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
}

/* ===========================================
   Category Selection (Practice Mode)
   =========================================== */

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-md);
}

.category-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.category-card:hover {
    border-color: var(--quiltt-teal);
    background: var(--quiltt-teal-light);
    background: rgba(0, 165, 168, 0.1);
    transform: translateY(-2px);
}

.category-card.selected {
    border-color: var(--quiltt-teal);
    background: rgba(0, 165, 168, 0.15);
    box-shadow: var(--shadow-glow);
}

.category-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
}

.category-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-light);
}

.category-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* ===========================================
   Leaderboard
   =========================================== */

.leaderboard {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.leaderboard-header {
    background: rgba(0, 165, 168, 0.1);
    padding: var(--space-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--quiltt-teal);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
}

.leaderboard-rank--1 {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: var(--quiz-dark);
}

.leaderboard-rank--2 {
    background: linear-gradient(135deg, #C0C0C0, #A8A8A8);
    color: var(--quiz-dark);
}

.leaderboard-rank--3 {
    background: linear-gradient(135deg, #CD7F32, #B87333);
    color: white;
}

.leaderboard-name {
    flex: 1;
    font-weight: 600;
}

.leaderboard-score {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--quiltt-teal);
}

/* ===========================================
   Result Screen
   =========================================== */

.result-screen {
    text-align: center;
    padding: var(--space-2xl);
}

.result-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
}

.result-title {
    font-family: var(--font-display);
    font-size: 2rem;
    margin-bottom: var(--space-md);
}

.result-score {
    font-family: var(--font-display);
    font-size: 3rem;
    color: var(--quiltt-teal);
    margin-bottom: var(--space-lg);
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.result-stat {
    text-align: center;
}

.result-stat-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-light);
}

.result-stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ===========================================
   Animations
   =========================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateX(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

@keyframes pop {
    0% { transform: scale(0.8); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.animate-fadeIn { animation: fadeIn 0.3s ease; }
.animate-slideUp { animation: slideUp 0.4s ease; }
.animate-slideIn { animation: slideIn 0.4s ease; }
.animate-pop { animation: pop 0.4s ease; }
.animate-shake { animation: shake 0.3s ease; }
.animate-pulse { animation: pulse 1s ease infinite; }

/* Staggered animations for answer buttons */
.answer-btn:nth-child(1) { animation-delay: 0.05s; }
.answer-btn:nth-child(2) { animation-delay: 0.1s; }
.answer-btn:nth-child(3) { animation-delay: 0.15s; }
.answer-btn:nth-child(4) { animation-delay: 0.2s; }

/* ===========================================
   Utilities
   =========================================== */

.text-center { text-align: center; }
.text-teal { color: var(--quiltt-teal); }
.text-muted { color: var(--text-muted); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.hidden { display: none !important; }

/* ===========================================
   Toast Notifications
   =========================================== */

.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    background: var(--quiz-dark-light);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-width: 280px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--quiltt-teal);
}

.toast.success { border-left-color: var(--correct); }
.toast.error { border-left-color: var(--wrong); }

/* ===========================================
   Loading Spinner
   =========================================== */

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--quiltt-teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    gap: var(--space-lg);
}

/* ===========================================
   Responsive Adjustments
   =========================================== */

@media (max-width: 600px) {
    :root {
        --space-lg: 1rem;
        --space-xl: 1.5rem;
        --space-2xl: 2rem;
    }
    
    .quiz-container {
        padding: var(--space-md);
    }
    
    .quiz-card {
        padding: var(--space-lg);
    }
    
    .timer-ring {
        width: 120px;
        height: 120px;
    }
    
    .timer-seconds {
        font-size: 2rem;
    }
}
