/* =============================================================================
   SURGE GAMES PORTAL - CSS
   Matches Flutter app's glassmorphism design exactly
   
   Key values from Flutter GlassCard:
   - Background: jet black (#0a0a0a)
   - Glass: white 60% opacity, 10px blur, 20px border radius
   - Border: white 30% opacity
   - Shadow: black 10% opacity, 20px blur, 10px Y offset
   - Text on glass: BLACK (critical for readability)
   - CTAs: Gold (#FFD700) with black text
============================================================================= */

/* CSS Variables matching Flutter app */
:root {
    /* Background */
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    
    /* Glass Card (matching Flutter GlassConfig) */
    --glass-opacity: 0.6;
    --glass-opacity-desktop: 0.5;
    --glass-blur: 10px;
    --glass-border-radius: 20px;
    --glass-border-color: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    
    /* Text Colors */
    --text-on-glass: #000000;           /* Black text on glass - CRITICAL */
    --text-on-glass-secondary: rgba(0, 0, 0, 0.87);
    --text-on-glass-muted: rgba(0, 0, 0, 0.6);
    --text-on-dark: #ffffff;
    --text-on-dark-muted: rgba(255, 255, 255, 0.7);
    
    /* Accent Colors */
    --accent-gold: #FFD700;
    --accent-green: #4CAF50;
    --accent-blue: #2196F3;
    --accent-purple: #9C27B0;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
}

/* Global Styles */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: url('/static/images/colorful_Valley.jpg') center center / cover no-repeat fixed;
    background-color: var(--bg-primary);
    color: var(--text-on-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', 'Roboto', sans-serif;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

/* =============================================================================
   GLASS CARD - Exact match to Flutter GlassCard widget
============================================================================= */
.glass-card {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.6) 0%,
        rgba(255, 255, 255, 0.3) 100%
    );
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    padding: var(--spacing-md);
}

/* ALL text on glass cards must be BLACK for readability */
.glass-card,
.glass-card h1, .glass-card h2, .glass-card h3, 
.glass-card h4, .glass-card h5, .glass-card h6 {
    color: var(--text-on-glass);
}

.glass-card p, .glass-card span, .glass-card li {
    color: var(--text-on-glass-secondary);
}

.glass-card .text-muted {
    color: var(--text-on-glass-muted) !important;
}

/* Icons on glass cards are black */
.glass-card i {
    color: var(--text-on-glass);
}

/* Compact glass card variant */
.glass-card-compact {
    --glass-opacity: 0.55;
    border-radius: 12px;
    padding: var(--spacing-sm);
}

/* =============================================================================
   BUTTONS - Gold CTAs with black text
============================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-gold);
    color: var(--text-on-glass);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
    color: var(--text-on-glass);
    text-decoration: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-on-dark);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
    color: var(--text-on-dark);
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: var(--accent-gold);
    border: 2px solid var(--accent-gold);
}

.btn-outline:hover {
    background: var(--accent-gold);
    color: var(--text-on-glass);
    text-decoration: none;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* =============================================================================
   NAVIGATION
============================================================================= */
.navbar {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: var(--spacing-sm) var(--spacing-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-on-dark);
    font-weight: 700;
    font-size: 1.25rem;
}

.navbar-brand img {
    height: 40px;
}

.navbar-brand .text-accent {
    color: var(--accent-gold);
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: var(--text-on-dark-muted);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-on-dark);
    background: rgba(255, 255, 255, 0.1);
}

/* =============================================================================
   LAYOUT
============================================================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

.page-content {
    min-height: calc(100vh - 80px);
    padding: var(--spacing-lg) 0;
}

.hero {
    text-align: center;
    padding: var(--spacing-lg) 0;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
}

.hero .subtitle {
    font-size: 1.25rem;
    color: var(--text-on-dark-muted);
    margin-bottom: var(--spacing-lg);
}

/* Grid layouts */
.grid {
    display: grid;
    gap: var(--spacing-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* =============================================================================
   DECK CARDS
============================================================================= */
.deck-card {
    transition: transform 0.2s ease;
}

.deck-card:hover {
    transform: translateY(-4px);
}

.deck-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.deck-card .deck-meta {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.deck-card .badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-cards {
    background: rgba(33, 150, 243, 0.2);
    color: var(--accent-blue);
}

.badge-difficulty {
    background: rgba(156, 39, 176, 0.2);
    color: var(--accent-purple);
}

/* =============================================================================
   GAME PLAY SCREEN
============================================================================= */
.game-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Game Header with Score */
.game-header {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0.75rem 1rem;
}

.game-stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: var(--spacing-md);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-on-glass-muted);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-on-glass);
}

/* Marketing CTA */
.marketing-cta {
    text-align: center;
    padding: var(--spacing-sm);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.cta-text {
    color: var(--text-on-dark-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.marketing-cta .btn {
    font-size: 0.85rem;
}

.question-card {
    text-align: center;
    padding: var(--spacing-lg);
}

.question-card h2 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-lg);
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
}

@media (max-width: 600px) {
    .options-grid { grid-template-columns: 1fr; }
}

.option-btn {
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--text-on-glass);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent-gold);
}

.option-btn.correct {
    background: rgba(76, 175, 80, 0.3);
    border-color: var(--accent-green);
}

.option-btn.incorrect {
    background: rgba(244, 67, 54, 0.3);
    border-color: #f44336;
}

/* Progress bar */
.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--spacing-md);
}

.progress-fill {
    height: 100%;
    background: var(--accent-gold);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* =============================================================================
   LEADERBOARD
============================================================================= */
.leaderboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

.leaderboard-table th {
    text-align: left;
    padding: var(--spacing-sm);
    color: var(--text-on-glass-muted);
    font-weight: 500;
}

.leaderboard-table td {
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.05);
}

.leaderboard-table tr:first-child td { border-radius: 8px 0 0 8px; }
.leaderboard-table tr:last-child td { border-radius: 0 8px 8px 0; }

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 700;
}

.rank-1 { background: #FFD700; color: #000; }
.rank-2 { background: #C0C0C0; color: #000; }
.rank-3 { background: #CD7F32; color: #fff; }

/* =============================================================================
   FORMS
============================================================================= */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-on-glass);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-on-glass);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.2);
}

.alert {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    margin-bottom: var(--spacing-md);
}

.alert-error {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

/* =============================================================================
   FOOTER
============================================================================= */
.footer {
    background: rgba(0, 0, 0, 0.5);
    padding: var(--spacing-lg) var(--spacing-md);
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-brand img {
    height: 32px;
}

.footer-links {
    display: flex;
    gap: var(--spacing-md);
}

.footer-links a {
    color: var(--text-on-dark-muted);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--text-on-dark);
}

/* External link indicator */
.external-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.external-link i.bi-box-arrow-up-right {
    font-size: 0.8em;
    opacity: 0.7;
}

/* =============================================================================
   ADDITIONAL COMPONENTS
============================================================================= */

/* Section Title (outside glass cards) */
.section-title {
    color: var(--text-on-dark);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Deck Grid */
.deck-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

/* Leaderboard Grid */
.leaderboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--spacing-md);
}

/* Leaderboard Entry */
.leaderboard-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm);
    margin-bottom: 0.5rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.leaderboard-entry .rank {
    font-weight: 700;
    color: var(--accent-gold);
    min-width: 40px;
}

.leaderboard-entry .name {
    flex: 1;
    color: var(--text-on-glass);
}

.leaderboard-entry .score {
    font-weight: 600;
    color: var(--text-on-glass);
}

/* Daily Challenge Header */
.daily-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.daily-icon {
    font-size: 2.5rem;
    color: var(--accent-gold);
}

.daily-header h2 {
    margin-bottom: 0;
}

.topic-title {
    color: var(--text-on-glass-secondary);
    font-size: 1.1rem;
}

.topic-description {
    color: var(--text-on-glass-secondary);
    margin-bottom: var(--spacing-sm);
}

.topic-meta {
    display: flex;
    gap: var(--spacing-md);
    color: var(--text-on-glass-muted);
    font-size: 0.9rem;
}

.topic-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-on-glass-muted);
}

/* Hero Compact */
.hero-compact {
    padding: var(--spacing-md);
}

.hero-compact h1 {
    margin-bottom: 0.5rem;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/* Promo Section */
.promo-section {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 255, 255, 0.6) 100%);
    border: 1px solid rgba(255, 215, 0, 0.2);
}

/* =============================================================================
   UTILITIES
============================================================================= */
.text-center { text-align: center; }
.text-accent { color: var(--accent-gold) !important; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

/* Hide on mobile/desktop */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
    .hide-desktop { display: none !important; }
}

/* =============================================================================
   RESPONSIVE
============================================================================= */
@media (max-width: 768px) {
    :root {
        --glass-opacity: 0.65; /* Slightly higher on mobile for readability */
    }
    
    .hero h1 { font-size: 2rem; }
    .hero .subtitle { font-size: 1rem; }
    
    .footer-content {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }
}
