/**
 * Shared Game Header Styling
 * Dark header bar matching main Vault display pages
 */

.game-top-bar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10000 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    margin: 0 !important;
    transition: background-color 0.5s ease;
}

.game-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

.game-header-scoreboard {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
}

.scoreboard-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.scoreboard-label {
    font-weight: 500;
    opacity: 0.8;
}

.scoreboard-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--game-primary, #FAB719);
}

.scoreboard-card-count {
    font-size: 0.75rem;
    opacity: 0.7;
    font-weight: 400;
    margin-left: 0.25rem;
}

.scoreboard-separator {
    opacity: 0.6;
    font-weight: 500;
}

.game-top-bar .game-title-header {
    font-size: 1.8rem;
    font-family: "Rockwell", "Rockwell Nova", "Roboto Slab", serif;
    font-weight: 400;
    letter-spacing: 2px;
    /* Use CSS custom property for theme color, fallback to default yellow */
    color: var(--game-header-title-color, var(--game-primary, #FAB719));
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin: 0;
}

.game-top-bar .button-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.game-top-bar .top-bar-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-family: "Rockwell", "Rockwell Nova", "Roboto Slab", serif;
}

.game-top-bar .top-bar-btn i {
    font-size: 1rem;
    display: inline-block;
}

.game-top-bar .top-bar-btn .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.game-top-bar .top-bar-btn:hover {
    background: white;
    color: #C90C0F;
}

.game-top-bar .top-bar-btn.gamesroom-btn {
    background: rgba(250, 183, 25, 0.3);
    border-color: #FAB719;
}

.game-top-bar .top-bar-btn.gamesroom-btn:hover {
    background: #FAB719;
    color: #1f2937;
}

/* Add top padding to body/content to account for fixed header */
body.with-game-header {
    padding-top: 80px;
}

/* Burger menu for mobile */
.game-header-burger {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: transform 0.3s ease;
}

.game-header-burger:hover {
    transform: scale(1.1);
}

.game-header-mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.5);
    padding: 2rem;
    z-index: 1001;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.game-header-mobile-nav.active {
    right: 0;
}

.game-header-mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(250, 183, 25, 0.3);
}

.game-header-mobile-nav-header h2 {
    color: #FAB719;
    font-size: 1.25rem;
    margin: 0;
}

.game-header-close-menu {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.game-header-mobile-nav .top-bar-btn {
    width: 100%;
    margin-bottom: 0.75rem;
    justify-content: flex-start;
}

.game-header-mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.game-header-mobile-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .game-top-bar {
        padding: 0.75rem 1rem;
        flex-wrap: nowrap;
        gap: 1rem;
    }
    
    .game-top-bar .game-title-header {
        font-size: 1.2rem;
        letter-spacing: 1px;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .game-top-bar .button-group {
        display: none;
    }
    
    .game-header-burger {
        display: block;
        flex-shrink: 0;
        position: relative;
        z-index: 10001;
    }
    
    .game-header-mobile-nav {
        display: block;
    }
    
    .game-header-mobile-overlay {
        display: block;
    }

    /* Ensure all top bar buttons have high z-index on mobile */
    .game-top-bar .top-bar-btn,
    .game-header-close-menu {
        position: relative;
        z-index: 10001;
    }
    
    body.with-game-header {
        padding-top: 70px;
    }
}

@media (max-width: 480px) {
    .game-top-bar {
        padding: 0.75rem;
    }
    
    .game-top-bar .game-title-header {
        font-size: 1rem;
    }

    /* Ensure buttons remain on top on smaller mobile screens */
    .game-header-burger,
    .game-top-bar .top-bar-btn,
    .game-header-close-menu {
        position: relative;
        z-index: 10001;
    }
    
    body.with-game-header {
        padding-top: 65px;
    }
}

/* ============================================================================
   GAME-SPECIFIC TITLE COLOR OVERRIDES
   Each game can set its theme color via CSS custom property or body class
   ============================================================================ */

/* Mathdle - Red theme */
.mathdle-page .game-top-bar .game-title-header {
    color: var(--game-primary, #C90C0F) !important;
}

/* Yahtzee - Blue theme */
body:has(#yahtzee-menu) .game-top-bar .game-title-header,
body:has(.yahtzee-menu) .game-top-bar .game-title-header {
    color: var(--game-primary, #007bff) !important;
}

/* Countdown - Sky blue theme */
body:has(#countdown-menu) .game-top-bar .game-title-header,
body:has(.countdown-menu) .game-top-bar .game-title-header {
    color: var(--game-primary, #0EA5E9) !important;
}

/* Nim 21 - Indigo theme */
body:has(#nim21-menu) .game-top-bar .game-title-header,
body:has(.nim21-menu) .game-top-bar .game-title-header {
    color: var(--game-primary, #6366f1) !important;
}

/* Triggle - Coral red theme */
body:has(#triggle-menu) .game-top-bar .game-title-header,
body:has(.triggle-menu) .game-top-bar .game-title-header {
    color: var(--game-primary, #FF6B6B) !important;
}

/* Number One - Red theme */
body:has(#numero-uno-menu) .game-top-bar .game-title-header,
body:has(.numero-uno-menu) .game-top-bar .game-title-header {
    color: var(--game-primary, #E74C3C) !important;
}

/* Pwordle - Use game's primary color */
body:has(#pwordle-menu) .game-top-bar .game-title-header,
body:has(.pwordle-menu) .game-top-bar .game-title-header {
    color: var(--game-primary, #FAB719) !important;
}

/* Maths Connections - Use game's primary color */
body:has(#connections-menu) .game-top-bar .game-title-header,
body:has(.connections-menu) .game-top-bar .game-title-header {
    color: var(--game-primary, #FAB719) !important;
}

/* Battleships - Blue theme */
body:has(#battleships-game) .game-top-bar .game-title-header,
body:has(.battleships-menu) .game-top-bar .game-title-header {
    color: var(--game-primary, #3B82F6) !important;
}

/* Solitaire - Use game's primary color */
body:has(#solitaire-menu) .game-top-bar .game-title-header,
body:has(.solitaire-menu) .game-top-bar .game-title-header {
    color: var(--game-primary, #FAB719) !important;
}

/* Sudoku - Use game's primary color */
body:has(#sudoku-menu) .game-top-bar .game-title-header,
body:has(.sudoku-menu) .game-top-bar .game-title-header {
    color: var(--game-primary, #FAB719) !important;
}

/* RPSD Plus - Use game's primary color */
body:has(#rpsdplus-menu) .game-top-bar .game-title-header,
body:has(.rpsdplus-menu) .game-top-bar .game-title-header {
    color: var(--game-primary, #FAB719) !important;
}

/* Can You Sort It - Use game's primary color */
body:has(#canyousortit-menu) .game-top-bar .game-title-header,
body:has(.canyousortit-menu) .game-top-bar .game-title-header {
    color: var(--game-primary, #FAB719) !important;
}

