/* ============================================
   Connect 4 AI - Main Styles
   Theme: Dark (matching portfolio)
   ============================================ */

/* CSS Variables */
:root {
    --background: #0a0a0a;
    --foreground: #fafafa;
    --card: #141414;
    --card-border: #262626;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #22c55e;
    --muted: #a1a1aa;
    --danger: #ef4444;

    /* Game specific */
    --human-color: #3b82f6;
    --ai-color: #ef4444;
    --board-bg: #1a1a2e;
    --board-border: #16213e;
    --cell-empty: #0f0f1a;

    /* Fonts */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Sizing */
    --cell-size: 70px;
    --disc-size: 56px;
    --board-gap: 0px;
}

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

/* Base */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* ============================================
   Game Screen
   ============================================ */

.game-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--background);
    position: relative;
}

/* Gradient orbs (like portfolio) */
.game-screen::before,
.game-screen::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.game-screen::before {
    top: 10%;
    right: 10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 70%);
    animation: float 8s ease-in-out infinite;
}

.game-screen::after {
    bottom: 10%;
    left: 10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.15) 0%, transparent 70%);
    animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-30px); }
}

/* ============================================
   Header
   ============================================ */

.game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
    text-decoration: none;
    font-family: var(--font-mono);
}

.logo-accent {
    color: var(--primary);
}

.global-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.5rem 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
}

.stat-label {
    font-size: 0.625rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.125rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--foreground);
}

.stat-divider {
    width: 1px;
    height: 30px;
    background: var(--card-border);
}

/* ============================================
   Main Game Area
   ============================================ */

.game-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 1rem 2rem;
    position: relative;
    z-index: 1;
    gap: 1.5rem;
}

/* Turn Indicator */
.turn-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 50px;
    padding: 0.5rem 1.5rem 0.5rem 0.5rem;
    transition: all 0.3s ease;
}

.turn-indicator.human-turn {
    border-color: var(--human-color);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.turn-indicator.ai-turn {
    border-color: var(--ai-color);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.turn-disc {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.turn-indicator.human-turn .turn-disc {
    background: var(--human-color);
    box-shadow: 0 0 15px var(--human-color);
}

.turn-indicator.ai-turn .turn-disc {
    background: var(--ai-color);
    box-shadow: 0 0 15px var(--ai-color);
}

.turn-text {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   Game Board
   ============================================ */

.board-container {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
}

.board-glow {
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--primary), var(--ai-color));
    border-radius: 18px;
    opacity: 0.3;
    filter: blur(8px);
    z-index: -1;
}

#game-board {
    display: block;
    background: var(--board-bg);
    border-radius: 16px;
    border: 3px solid var(--board-border);
}

/* Column Indicators (for hover) */
.column-indicators {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    pointer-events: none;
    border-radius: 16px;
    overflow: hidden;
}

.col-indicator {
    pointer-events: auto;
    cursor: pointer;
    transition: background 0.2s ease;
}

.col-indicator:hover {
    background: rgba(59, 130, 246, 0.1);
}

.col-indicator.disabled {
    pointer-events: none;
    cursor: not-allowed;
}

/* ============================================
   Game Info
   ============================================ */

.game-info {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted);
}

.player-disc {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.human-disc {
    background: var(--human-color);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.ai-disc {
    background: var(--ai-color);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.vs-text {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--card-border);
    text-transform: uppercase;
}

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

.btn-new-game {
    padding: 0.75rem 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-sans);
    color: var(--foreground);
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-new-game:hover {
    background: var(--card-border);
    transform: translateY(-2px);
}

.btn-play-again {
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-sans);
    color: #000;
    background: var(--foreground);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-play-again:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

/* ============================================
   Result Modal
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.4s ease;
}

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

.modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.modal-icon.win {
    background: rgba(34, 197, 94, 0.2);
    border: 2px solid var(--secondary);
    color: var(--secondary);
}

.modal-icon.lose {
    background: rgba(239, 68, 68, 0.2);
    border: 2px solid var(--danger);
    color: var(--danger);
}

.modal-icon.draw {
    background: rgba(161, 161, 170, 0.2);
    border: 2px solid var(--muted);
    color: var(--muted);
}

.modal-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.modal-subtitle {
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 2rem;
}

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

@media (max-width: 600px) {
    :root {
        --cell-size: 50px;
        --disc-size: 40px;
    }

    #game-board {
        width: 350px;
        height: 300px;
    }

    .global-stats {
        padding: 0.375rem 0.75rem;
        gap: 0.75rem;
    }

    .stat-label {
        font-size: 0.5rem;
    }

    .stat-value {
        font-size: 0.875rem;
    }

    .game-main {
        padding: 5rem 0.5rem 1rem;
        gap: 1rem;
    }

    .modal-content {
        padding: 2rem;
    }
}
