/* Basic resets and styles */
/* Hide number input spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

:root {
    --primary-color: #00ff88;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #eee;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Navbar */
.navbar {
    background: #000;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links a {
    color: #fff;
    text-decoration: none;
    margin-left: 20px;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Auth Cards */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80vh;
}

.auth-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 10px;
    background: #333;
    border: 1px solid #444;
    color: #fff;
    border-radius: 4px;
}

.btn {
    display: inline-block;
    background: var(--primary-color);
    color: #000;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    text-align: center;
    text-decoration: none;
}

.btn:hover {
    opacity: 0.9;
}

.btn-small {
    width: auto;
    padding: 5px 15px;
    font-size: 0.9rem;
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 2rem;
}

.game-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #333;
    transition: transform 0.2s;
}

.game-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.status-OPEN {
    background: #28a745;
    color: #fff;
}

.status-CLOSED {
    background: #dc3545;
    color: #fff;
}

.status-GENERATED {
    background: #17a2b8;
    color: #fff;
}

.date {
    font-size: 0.9rem;
    color: #aaa;
}

.teams {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
}

/* Pool Grid */
.pool-container {
    max-width: 1400px;
    margin: 0 auto;
}

.game-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: flex-start;
}

.grid-section {
    flex: 2;
    min-width: 600px;
}

.participants-section {
    flex: 1;
    min-width: 300px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #333;
    max-height: 800px;
    overflow-y: auto;
}

/* Base grid styles */
.squares-grid {
    display: grid;
    /* 1. Side Label (30px) 2. Row Header (50px) 3-12. Cells (1fr) */
    grid-template-columns: 30px 50px repeat(10, 1fr);
    /* 1. Top Label (30px) 2. Col Header (50px) 3-12. Cells (1fr) */
    grid-template-rows: 30px 50px repeat(10, 1fr);
    gap: 2px;
    margin-bottom: 2rem;
    overflow-x: auto;
}

.vertical-text-cell {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    background: #222;
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    padding: 5px 0;
}

.horizontal-text-cell {
    background: #222;
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .grid-section {
        min-width: 100%;
    }

    .participants-section {
        min-width: 100%;
    }
}

.participants-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.participants-table th {
    text-align: left;
    border-bottom: 1px solid #444;
    padding: 8px;
    color: var(--primary-color);
}

.participants-table td {
    padding: 8px;
    border-bottom: 1px solid #333;
    font-size: 0.9rem;
}

.username-col {
    font-weight: bold;
    color: #fff;
}

.grid-cell {
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    font-size: 0.75rem;
    text-align: center;
    word-break: break-all;
    padding: 2px;
}

.header-cell {
    background: #444;
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.corner-cell {
    background: transparent;
}

@media (max-width: 900px) {
    .grid-section {
        min-width: 100%;
    }

    .participants-section {
        min-width: 100%;
    }
}

.participants-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.participants-table th {
    text-align: left;
    border-bottom: 1px solid #444;
    padding: 8px;
    color: var(--primary-color);
}

.participants-table td {
    padding: 8px;
    border-bottom: 1px solid #333;
    font-size: 0.9rem;
}

.username-col {
    font-weight: bold;
    color: #fff;
}

.owned-cell {
    background: rgba(0, 255, 136, 0.2);
    border: 1px solid var(--primary-color);
}

.reservation-panel {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    margin-top: 2rem;
}

.alert {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-danger {
    background: #721c24;
    color: #f8d7da;
}

.alert-success {
    background: #155724;
    color: #d4edda;
}

.alert-warning {
    background: #856404;
    color: #fff3cd;
}

/* Old Scoreboard Styles (Keep for backup/index) */
.score-display {
    margin: 10px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.score-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.game-status-text {
    font-size: 0.8rem;
    color: #aaa;
    text-align: right;
    margin-top: 5px;
}

.scoreboard {
    background: #222;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #444;
    margin: 15px 0;
    text-align: center;
}

.score-team {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 10px;
}

.score-meta {
    color: #aaa;
    font-size: 0.9rem;
    margin-top: 5px;
}

/* New Detailed Scoreboard & Winners */
.scoreboard-full {
    background: #222;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #444;
    margin: 15px auto;
    max-width: 800px;
}

.score-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.score-table th,
.score-table td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #333;
}

.score-table th {
    color: var(--primary-color);
    text-transform: uppercase;
    font-size: 0.8rem;
}

.team-name {
    font-weight: bold;
    text-align: left;
    font-size: 1.1rem;
}

.total-score {
    font-weight: bold;
    font-size: 1.2rem;
    color: #fff;
}

.current-winners {
    margin-top: 15px;
    text-align: center;
    border-top: 1px solid #444;
    padding-top: 15px;
}

.winners-grid {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.winner-card {
    background: #333;
    padding: 10px;
    border-radius: 5px;
    min-width: 100px;
    border: 1px solid #444;
}

.q-label {
    display: block;
    font-size: 0.75rem;
    color: #aaa;
    margin-bottom: 5px;
}

.w-name {
    display: block;
    font-weight: bold;
    color: var(--primary-color);
}

.score-meta-p {
    margin-top: 10px;
    color: #777;
    font-size: 0.9rem;
    text-align: center;
}

.winning-cell {
    border: 3px solid #ffaa00 !important;
    box-shadow: 0 0 10px #ffaa00;
    z-index: 10;
    position: relative;
    animation: pulse-gold 2s infinite;
}

@keyframes pulse-gold {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 170, 0, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 170, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 170, 0, 0);
    }
}