@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap');

:root {
    --primary: #003366;
    --primary-dark: #002244;
    --secondary: #00E5FF;
    --bg: #1a1a2e;
    --bg-card: #16213e;
    --bg-input: #0f3460;
    --text: #e8e8e8;
    --text-muted: #a0a0b0;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --border: #2a2a4a;
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.navbar {
    background: var(--bg-card);
    border-bottom: 2px solid var(--primary);
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.navbar .brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--secondary);
    text-decoration: none;
}

.navbar .brand span { color: var(--text); font-weight: 400; }

.navbar nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.navbar nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.navbar nav a:hover, .navbar nav a.active {
    background: var(--primary);
    color: white;
}

.navbar .user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.navbar .btn-logout {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

h1, h2, h3 {
    color: var(--secondary);
    margin-bottom: 1rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    margin-bottom: 1rem;
}

.card-header {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input, select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text);
    font-size: 1rem;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 51, 102, 0.3);
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: #222; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.85rem; }

/* Tabla de posiciones */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.7rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-input);
    color: var(--secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover { background: rgba(0, 51, 102, 0.2); }

.pos-1 { color: #00E5FF; font-weight: 700; }
.pos-2 { color: #c0c0c0; font-weight: 700; }
.pos-3 { color: #cd7f32; font-weight: 700; }

/* Partido cards */
.partido-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.partido-card.bloqueado {
    border-color: var(--danger);
    opacity: 0.8;
}

.partido-equipos {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.partido-equipos .vs {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.9rem;
}

.partido-resultado {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--secondary);
}

.partido-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.pronostico-inputs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pronostico-inputs input {
    width: 50px;
    text-align: center;
    padding: 0.4rem;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-grupo { background: #2980b9; color: white; }
.badge-octavos { background: #8e44ad; color: white; }
.badge-cuartos { background: #d35400; color: white; }
.badge-semi { background: #c0392b; color: white; }
.badge-final { background: #00E5FF; color: #003366; }
.badge-bloqueado { background: var(--danger); color: white; }
.badge-abierto { background: var(--success); color: white; }

/* Login page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 1rem;
}

.login-logo img {
    max-width: 160px;
    height: auto;
}

.login-box .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-top: -1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

.tabs button {
    flex: 1;
    padding: 0.7rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tabs button.active {
    color: var(--secondary);
    border-bottom-color: var(--secondary);
}

.error-msg {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.6rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: none;
}

.success-msg {
    background: rgba(39, 174, 96, 0.2);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 0.6rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: none;
}

/* Bracket (fases finales) */
.bracket-container {
    overflow-x: auto;
    padding: 1rem 0;
}

.bracket {
    display: flex;
    gap: 2rem;
    min-width: fit-content;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 1rem;
}

.bracket-round h3 {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.bracket-match {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    min-width: 180px;
}

.bracket-team {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.9rem;
}

.bracket-team.winner { color: var(--secondary); font-weight: 700; }

/* Responsive */
@media (max-width: 600px) {
    .navbar { flex-direction: column; align-items: flex-start; }
    .navbar nav { width: 100%; }
    .navbar nav a { flex: 1; text-align: center; }
    .partido-card { flex-direction: column; align-items: flex-start; }
    .container { padding: 1rem 0.5rem; }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Tabla de grupos */
.grupo-section {
    margin-bottom: 2rem;
}

.grupo-section h3 {
    margin-bottom: 0.6rem;
    font-size: 1.1rem;
}

.grupo-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.grupo-table thead th {
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.5rem 0.6rem;
    text-align: center;
    letter-spacing: 0.5px;
}

.grupo-table thead th:first-child,
.grupo-table thead th:nth-child(2) {
    text-align: left;
}

.grupo-table tbody td {
    padding: 0.6rem 0.6rem;
    text-align: center;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.grupo-table tbody td:first-child {
    text-align: center;
    font-weight: 700;
    color: var(--text-muted);
    width: 36px;
}

.grupo-table tbody td:nth-child(2) {
    text-align: left;
    font-weight: 600;
}

.grupo-table tbody td:last-child {
    font-weight: 700;
    color: var(--secondary);
}

.grupo-table tbody tr:last-child td {
    border-bottom: none;
}

.grupo-table tbody tr:hover {
    background: rgba(0, 51, 102, 0.2);
}

.grupo-table .equipo-nombre {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.grupo-table .dg-positivo {
    color: var(--success);
}

.grupo-table .dg-negativo {
    color: var(--danger);
}

.grupo-table .dg-neutro {
    color: var(--text-muted);
}

/* Banderas */
.flag-img {
    width: 24px;
    height: 18px;
    vertical-align: middle;
    border-radius: 2px;
    box-shadow: 0 0 2px rgba(0,0,0,0.3);
}

/* Footer */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 1.5rem 1rem;
    text-align: center;
    margin-top: 3rem;
}

.site-footer .footer-logo {
    display: inline-block;
    margin-bottom: 0.5rem;
}

.site-footer .footer-logo img {
    height: 40px;
    width: auto;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.site-footer .footer-logo img:hover {
    opacity: 1;
}

.site-footer .footer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.site-footer .footer-text a {
    color: var(--secondary);
    text-decoration: none;
}

.site-footer .footer-text a:hover {
    text-decoration: underline;
}

.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
