/* ============================================
   Werewolf Game - Global Styles (Flix.id Style Match)
   ============================================ */

:root {
    /* Background & Gradients - Soft Blue/Grey Gradient matching the image */
    --bg-gradient: linear-gradient(120deg, #A8B5C0 0%, #798897 50%, #546270 100%); 
    
    /* Glass Effect - Softer, whiter */
    --bg-glass: rgba(255, 255, 255, 0.15); 
    --bg-glass-hover: rgba(255, 255, 255, 0.25);
    --glass-border: 1px solid rgba(255, 255, 255, 0.25);
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    
    /* Pill & Card Radius - Match image's soft rounded corners */
    --card-radius: 32px;
    --btn-radius: 50px; /* Fully rounded pill buttons */
    --input-radius: 20px;
    
    /* Brand/Accent Colors from Image */
    /* Muted Blue used in "Movie" pill bg */
    --accent-dark: #0f172a; 
    /* The active blue dot color */
    --accent: #60a5fa; 
    --accent-glow: rgba(96, 165, 250, 0.5);
    
    /* Colors for Tags/Pills */
    --tag-bg: rgba(255, 255, 255, 0.1);
    
    /* Functional Colors */
    --success: #34d399; 
    --warning: #fbbf24; 
    --danger: #f87171; 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'SF Pro Display', 'Inter', -apple-system, system-ui, sans-serif; /* Clean Sans Serif */
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   Splash Screen Animations
   ============================================ */

#splashScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeOut 1s ease-out 2s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        pointer-events: none;
    }
}

.splash-logo {
    font-size: 72px;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(96, 165, 250, 0.4));
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.splash-title {
    font-size: 48px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #e0e7ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.splash-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    animation: slideUp 1s ease-out 0.5s both;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.splash-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    margin-top: 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Mouse Glow Effect
   ============================================ */

#mouseGlow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.08) 0%, transparent 70%);
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s;
    z-index: 1;
}

/* ============================================
   Layout & Containers
   ============================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px;
}

/* Top Navigation Bar - Pill Shape like Image */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    margin-bottom: 40px;
    background: rgba(0, 0, 0, 0.2); /* Darker pill background for nav */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 50px; /* Pill shape */
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.logo {
    font-size: 24px;
    font-weight: 800;
    color: white;
    letter-spacing: 0.5px;
    background: none;
    -webkit-text-fill-color: white;
}

/* ============================================
   Cards (Glassmorphism)
   ============================================ */

/* Hero Section (Create Room) matching the Blue/Purple cards */
.hero-card {
    background: linear-gradient(135deg, #4f74df 0%, #2c4aaf 100%); /* Deep Blue from image left card */
    border-radius: var(--card-radius);
    padding: 40px;
    margin-bottom: 40px;
    box-shadow: 0 20px 40px rgba(44, 74, 175, 0.3);
    position: relative;
    overflow: hidden;
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Add a second variant for other sections if needed */
.hero-card.variant-2 {
    background: linear-gradient(135deg, #7c94b5 0%, #586b85 100%); /* Greyish Blue from image right card */
}

/* Decorative circles */
.hero-card::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    pointer-events: none;
}

.card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--card-radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

/* ============================================
   Buttons & Tags
   ============================================ */

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--btn-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    backdrop-filter: blur(4px);
}

.btn-primary {
    background: white; /* White button on colored card */
    color: #1e293b;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-primary:hover {
    background: #f1f5f9;
    transform: scale(1.05);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Category Tags */
.nav-pills {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.nav-pill {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    border: 1px solid rgba(255,255,255,0.05);
}

.nav-pill:hover, .nav-pill.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

/* ============================================
   Forms & Inputs (Search Bar Style)
   ============================================ */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    font-weight: 500;
    margin-left: 10px;
}

.form-input {
    width: 100%;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.2); /* Darker input background */
    border: none;
    border-radius: 50px; /* Pill input */
    color: white;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* ============================================
   Auth Pages (Glassmorphism)
   ============================================ */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 2;
}

.auth-box {
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 50px;
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.auth-title {
    font-size: 32px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff 0%, #e0e7ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    font-weight: 800;
}

.auth-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 40px;
    font-size: 16px;
}

.auth-toggle {
    margin-top: 30px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-toggle a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-toggle a:hover {
    color: #93c5fd;
    text-decoration: underline;
}
/* ============================================
   Room Grid (Poster Style)
   ============================================ */

.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); /* Narrower cards */
    gap: 30px;
}

.room-card {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform 0.3s ease;
    box-shadow: none;
    backdrop-filter: none;
    border-radius: 0;
}

.room-card:hover {
    transform: translateY(-10px);
    background: transparent;
    border: none;
    box-shadow: none;
}

.room-card::before {
    display: none;
}

/* The Image Container */
.room-cover {
    height: 320px;
    width: 100%;
    background-color: #334155;
    border-radius: 24px;
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
}

.room-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.room-card:hover .room-cover img {
    transform: scale(1.1);
}

.room-cover-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    display: flex;
    align-items: flex-end;
    padding: 15px;
}

.room-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.3);
}

.room-card:hover .room-play-btn {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Typography for Room Cards */
.room-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 5px;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 5px;
}

.room-meta {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 5px;
}

.meta-rating {
    color: #fbbf24;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-dot {
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
}

.room-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    z-index: 2;
}

/* Cleanup for old classes to avoid interference */
.room-header { display: none; }
.room-info { display: none; }

/* ============================================
   Game Room Layout
   ============================================ */

.game-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    min-height: calc(100vh - 140px);
}

.game-main {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.phase-banner {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.8), rgba(67, 56, 202, 0.8));
    backdrop-filter: blur(12px);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* ============================================
   Player Grid (Glass Slots)
   ============================================ */

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 24px;
    border: var(--glass-border);
    backdrop-filter: blur(16px);
}

.player-slot {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(4px);
}

.player-slot:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.player-slot.speaking {
    border-color: var(--warning);
    animation: speakingPulse 1.5s ease-in-out infinite;
    background: rgba(251, 191, 36, 0.1);
}

@keyframes speakingPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(251, 191, 36, 0.5);
    }
}

.player-slot.werewolf-teammate {
    border: 2px solid #f87171;
    background: rgba(248, 113, 113, 0.15);
    box-shadow: 0 0 20px rgba(248, 113, 113, 0.2);
}

.player-slot.werewolf-teammate::before {
    content: '🐺';
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 18px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.player-slot.dead {
    opacity: 0.5;
    filter: grayscale(100%);
    transform: scale(0.95);
}

.player-avatar {
    font-size: 56px;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.player-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.player-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.ai-badge {
    display: inline-block;
    background: rgba(74, 222, 128, 0.2);
    color: var(--success);
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    margin-top: 5px;
}

/* ============================================
   Action Panel (Glass)
   ============================================ */

.action-panel {
    padding: 20px;
    background: rgba(96, 165, 250, 0.15); /* Blue tint */
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 16px;
    margin-bottom: 25px;
    text-align: center;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(96, 165, 250, 0.15);
}

.action-btn {
    padding: 12px 24px;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    margin: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.action-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--accent-glow);
}

/* ============================================
   Chat Section (Glass Sidebar)
   ============================================ */

.chat-section {
    background: rgba(30, 41, 59, 0.6); /* Slightly darker for contrast */
    border-radius: 20px;
    border: var(--glass-border);
    display: flex;
    flex-direction: column;
    height: 100%;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 700;
    background: rgba(0, 0, 0, 0.1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.chat-message {
    margin-bottom: 15px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08); /* Message bubble */
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-sender {
    font-weight: 700;
    margin-bottom: 4px;
    color: #93c5fd;
    font-size: 13px;
}

.chat-text {
    color: var(--text-primary);
    line-height: 1.5;
}

.chat-input-container {
    padding: 20px;
    background: rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 12px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    transition: all 0.3s;
}

.chat-input:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--accent);
}

/* ============================================
   Modals (Glass Overlay)
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8); /* Dark slate overlay */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(24px);
    border-radius: 24px;
    padding: 50px;
    max-width: 500px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-icon {
    font-size: 64px;
    text-align: center;
    margin-bottom: 25px;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
}

.modal-title {
    font-size: 28px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-description {
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.8;
    font-size: 16px;
}

/* ============================================
   Utilities
   ============================================ */

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .game-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .chat-section {
        height: 500px; /* Fixed height for mobile chat */
        margin-top: 20px;
    }

    .players-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        padding: 15px;
    }

    .auth-box {
        padding: 30px 20px;
        margin: 20px;
    }

    .page-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
}
