/* Dookio - Main Styles */
/* CSS Variables, Reset, and Base Styles */

/* ========== CSS VARIABLES ========== */
:root {
    /* Colors */
    --spotify-green: #1db954;
    --spotify-green-hover: #1ed760;
    --spotify-dark: #191414;
    --spotify-black: #121212;
    --spotify-light: #282828;
    --spotify-gray: #535353;
    --spotify-light-gray: #b3b3b3;
    
    /* Accent colors (warm energy) */
    --accent-warm: #e67e22;
    --accent-gold: #f1c40f;
    
    /* Game colors */
    --correct-color: #1db954;
    --incorrect-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #3498db;
    
    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #6a6a6a;
    
    /* Gradients */
    --bg-gradient: linear-gradient(135deg, #1db954, #191414);
    --card-gradient: linear-gradient(180deg, rgba(40, 40, 40, 0.9), rgba(18, 18, 18, 0.95));
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    
    /* Borders */
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    --border-radius-full: 50%;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Typography */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    --font-size-3xl: 3rem;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.5;
}

/* Global dim overlay - above background, below app content (matches main menu dim) */
.app-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1;
    pointer-events: none;
    transition: background 0.4s ease;
}

/* Slightly brighter when viewing cascade (join name step: scroll or hover over background) */
.app-backdrop.app-backdrop-bright {
    background: rgba(0, 0, 0, 0.22);
}

/* Ensure top bar and app content sit above the dim; top bar must be above app so logo receives clicks */
#top-bar-container {
    position: relative;
    z-index: 10;
}
#app {
    position: relative;
    z-index: 2;
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--spotify-green);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--spotify-green-hover);
}

/* ========== LAYOUT ========== */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: calc(60px + var(--spacing-lg)) var(--spacing-lg) var(--spacing-lg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.hidden {
    display: none !important;
}

/* ========== HEADER ========== */
.header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.header h1 {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--spacing-sm);
}

.logo {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

/* ========== CARDS ========== */
.card {
    background: linear-gradient(180deg, rgba(44, 44, 44, 0.95), rgba(20, 20, 20, 0.98));
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    width: 100%;
    max-width: 500px;
}

.login-card,
.join-card,
.lobby-card,
.game-card,
.host-source-card,
.main-menu-card,
.multiplayer-game-card,
.round-results-card,
.game-over-card,
.loading-card {
    background: linear-gradient(180deg, rgba(44, 44, 44, 0.95), rgba(20, 20, 20, 0.98));
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    width: 100%;
    max-width: 500px;
    text-align: center;
}

/* Wider lobby cards for horizontal screens to support 3 player tiles */
@media (orientation: landscape) and (min-width: 768px),
       (orientation: portrait) and (min-width: 1024px) {
    .lobby-card {
        max-width: 900px;
    }
}

/* ========== BUTTONS ========== */
button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-size: var(--font-size-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.game-btn {
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--border-radius-md);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.game-btn.primary {
    background: linear-gradient(135deg, var(--spotify-green), #15a044);
    color: var(--spotify-black);
    box-shadow: 0 2px 8px rgba(29, 185, 84, 0.2);
}

.game-btn.primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--spotify-green-hover), var(--spotify-green));
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(29, 185, 84, 0.35), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.game-btn.primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 0 10px rgba(29, 185, 84, 0.2);
}

.game-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.game-btn.secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.game-btn.secondary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.game-btn.large {
    padding: var(--spacing-lg) var(--spacing-2xl);
    font-size: var(--font-size-lg);
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* Spotify button */
.spotify-btn {
    background: linear-gradient(135deg, var(--spotify-green), #15a044);
    color: var(--spotify-black);
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: 50px;
    font-weight: 700;
    font-size: var(--font-size-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    width: 100%;
    max-width: 300px;
    box-shadow: 0 0 16px rgba(29, 185, 84, 0.3), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.spotify-btn:hover {
    background: linear-gradient(135deg, var(--spotify-green-hover), var(--spotify-green));
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0 24px rgba(29, 185, 84, 0.45), 0 6px 16px rgba(0, 0, 0, 0.35);
}

.spotify-btn:active {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 10px rgba(29, 185, 84, 0.2), 0 2px 6px rgba(0, 0, 0, 0.2);
}

.spotify-btn svg {
    width: 24px;
    height: 24px;
}

/* ========== INPUTS ========== */
input, select {
    font-family: inherit;
    font-size: var(--font-size-md);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    width: 100%;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--spotify-green);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.15), inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

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

.guess-input {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-lg);
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.game-code-input {
    font-size: var(--font-size-xl);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: 700;
}

.search-input {
    padding: var(--spacing-md) var(--spacing-lg);
    flex: 1;
    min-width: 0;
}

/* ========== SPINNER ========== */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--spotify-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-lg);
}

.spinner.small {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

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

/* ========== ERROR/SUCCESS STATES ========== */
.error-text {
    color: var(--incorrect-color);
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-sm);
}

.success-text {
    color: var(--correct-color);
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-sm);
}

/* ========== LOADING OVERLAY ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-overlay.hidden {
    display: none;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 480px) {
    .container {
        padding: calc(56px + var(--spacing-md)) var(--spacing-md) var(--spacing-md);
        min-height: 100vh;
        min-height: 100dvh;
    }
    
    /* Ensure section fills available space and centers content */
    .section {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    h1 {
        font-size: var(--font-size-2xl);
    }
    
    h2 {
        font-size: var(--font-size-xl);
    }
    
    .game-btn.large {
        padding: var(--spacing-md) var(--spacing-xl);
        font-size: var(--font-size-md);
    }
}

/* Expand container and card widths for horizontal tile layouts on larger screens */
@media (min-width: 768px) {
    .container {
        max-width: 1100px;
    }
    
    .section {
        justify-content: flex-start;
        padding-top: 3vh;
    }
    
    .main-menu-card,
    .game-card,
    .host-source-card {
        max-width: 1050px;
        min-height: 60vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .header {
        margin-bottom: var(--spacing-md);
    }
}

/* Landscape phones - also need wider containers */
@media (orientation: landscape) and (min-width: 600px) and (max-width: 767px) {
    .container {
        max-width: 95vw;
    }
    
    .section {
        justify-content: flex-start;
        padding-top: 2vh;
    }
    
    .main-menu-card,
    .game-card,
    .host-source-card {
        max-width: 90vw;
        min-height: 55vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .header {
        margin-bottom: var(--spacing-sm);
    }
}


