/* ══════════════════════════════════════════════════════════════
   QUINIELA MUNDIAL 2026 — Estilos
   ══════════════════════════════════════════════════════════════ */

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

:root {
    --blue:      #185FA5;
    --blue-lt:   #E6F1FB;
    --blue-dk:   #0C447C;
    --green:     #3B6D11;
    --green-lt:  #EAF3DE;
    --amber:     #BA7517;
    --amber-lt:  #FAEEDA;
    --red:       #A32D2D;
    --red-lt:    #FCEBEB;
    --gray:      #5F5E5A;
    --gray-lt:   #F1EFE8;
    --border:    rgba(0,0,0,0.12);
    --shadow:    0 1px 4px rgba(0,0,0,0.08);
    --radius:    10px;
    --radius-sm: 6px;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    background: #F5F6F8;
    color: #1a1a1a;
    min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
    background: var(--blue);
    color: #fff;
    padding: 0 1.5rem;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-brand { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.topbar-user  { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar-user .pts { background: rgba(255,255,255,0.18); padding: 3px 10px; border-radius: 20px; }
.topbar-user .btn-out { background: transparent; border: 1px solid rgba(255,255,255,0.4);
    color: #fff; padding: 4px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; }
.topbar-user .btn-out:hover { background: rgba(255,255,255,0.15); }

/* ── CONTENEDOR ─────────────────────────────────────────────── */
.container { max-width: 860px; margin: 0 auto; padding: 1.5rem 1rem; }

/* ── AUTH ───────────────────────────────────────────────────── */
.auth-wrap { min-height: calc(100vh - 52px); display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}
.auth-logo { text-align: center; font-size: 40px; margin-bottom: 1rem; }
.auth-title { text-align: center; font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.auth-sub   { text-align: center; font-size: 13px; color: var(--gray); margin-bottom: 1.5rem; }

/* ── FORM ELEMENTS ──────────────────────────────────────────── */
.field       { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--gray); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #1a1a1a;
    transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #fff;
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    text-decoration: none;
}
.btn:hover { background: var(--gray-lt); border-color: #bbb; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dk); border-color: var(--blue-dk); }
.btn-full    { width: 100%; }
.btn-sm      { padding: 5px 12px; font-size: 12px; }
.btn-danger  { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-lt); }

/* ── TABS ───────────────────────────────────────────────────── */
.tabs { display: flex; gap: 3px; background: #e8eaed; padding: 3px; border-radius: var(--radius); margin-bottom: 1.5rem; }
.tab  { flex: 1; padding: 8px; text-align: center; border-radius: 8px; cursor: pointer; font-size: 13px;
        font-weight: 500; color: var(--gray); border: none; background: transparent; transition: all 0.15s; }
.tab.active { background: #fff; color: var(--blue); box-shadow: var(--shadow); }

/* ── CHIPS (filtro de grupos) ───────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 1.25rem; }
.chip  { padding: 5px 13px; border-radius: 20px; border: 1px solid var(--border); font-size: 12px;
         font-weight: 500; cursor: pointer; color: var(--gray); background: #fff; transition: all 0.15s; }
.chip.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ── SECCIÓN LABEL ──────────────────────────────────────────── */
.sec-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gray); margin-bottom: 10px; }

/* ── TARJETA DE PARTIDO ─────────────────────────────────────── */
.match-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.25rem;
    margin-bottom: 10px;
}
.match-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.match-info { font-size: 11px; color: var(--gray); font-weight: 500; }
.badge { font-size: 11px; padding: 2px 9px; border-radius: 20px; font-weight: 600; }
.badge-open   { background: var(--green-lt); color: var(--green); }
.badge-closed { background: var(--amber-lt); color: var(--amber); }
.badge-done   { background: var(--blue-lt);  color: var(--blue);  }

/* Fila de equipos y marcadores */
.match-body { display: grid; grid-template-columns: 1fr 120px 1fr; gap: 8px; align-items: center; }
.team-side  { text-align: center; }
.team-flag  { font-size: 26px; display: block; margin-bottom: 4px; }
.team-name  { font-size: 12px; font-weight: 600; line-height: 1.3; }

.center-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }

/* Inputs de predicción */
.score-inputs { display: flex; align-items: center; gap: 6px; }
.sc-input {
    width: 46px; height: 46px; text-align: center; font-size: 20px; font-weight: 700;
    border: 2px solid var(--border); border-radius: var(--radius-sm);
    background: var(--gray-lt); color: #1a1a1a; font-family: inherit;
}
.sc-input:focus { border-color: var(--blue); background: #fff; outline: none; }
.sc-sep { font-size: 18px; color: #bbb; font-weight: 300; }

/* Resultado real vs predicción */
.results-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.result-box { text-align: center; padding: 8px; border-radius: var(--radius-sm); }
.result-box .rb-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.result-box .rb-score { font-size: 22px; font-weight: 700; }
.rb-real { background: var(--blue-lt); }
.rb-real .rb-label { color: var(--blue-dk); }
.rb-real .rb-score { color: var(--blue); }
.rb-pred { background: var(--gray-lt); }
.rb-pred .rb-label { color: var(--gray); }
.rb-pred .rb-score { color: #333; }

/* Badge de puntos ganados */
.pts-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; margin-top: 8px; }
.pts-3  { background: var(--green-lt); color: var(--green); }
.pts-1  { background: var(--amber-lt); color: var(--amber); }
.pts-0  { background: var(--red-lt);   color: var(--red);   }

/* Fila de acción (guardar) */
.action-row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); gap: 8px; flex-wrap: wrap; }
.action-row .saved-text { font-size: 12px; color: var(--gray); }

/* ── LEADERBOARD ────────────────────────────────────────────── */
.lb-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.lb-table th { background: var(--blue); color: #fff; padding: 10px 12px; font-size: 12px; font-weight: 600; text-align: left; text-transform: uppercase; letter-spacing: 0.05em; }
.lb-table th:not(:first-child):not(:nth-child(2)) { text-align: center; }
.lb-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-lt); font-size: 13px; }
.lb-table td:not(:first-child):not(:nth-child(2)) { text-align: center; }
.lb-table tr:last-child td { border-bottom: none; }
.lb-table tr.me td { background: var(--blue-lt); font-weight: 600; }
.lb-table tr:hover td { background: var(--gray-lt); }
.lb-table tr.me:hover td { background: #d4e8f8; }
.lb-pos  { font-weight: 700; color: var(--gray); font-size: 14px; }
.lb-pts  { font-weight: 700; color: var(--blue); font-size: 15px; }

/* ── ADMIN ──────────────────────────────────────────────────── */
.admin-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.25rem; margin-bottom: 8px; }
.admin-row  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── TOAST ──────────────────────────────────────────────────── */
#toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
    background: #1a1a1a; color: #fff; padding: 10px 20px; border-radius: var(--radius);
    font-size: 13px; font-weight: 500; z-index: 999; transition: transform 0.25s ease;
    white-space: nowrap; pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ── LOADING ────────────────────────────────────────────────── */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── EMPTY STATE ────────────────────────────────────────────── */
.empty { text-align: center; padding: 3rem 1rem; color: var(--gray); }
.empty .icon { font-size: 36px; display: block; margin-bottom: 10px; }

/* ── GRUPO HEADER ───────────────────────────────────────────── */
.group-header { display: flex; align-items: center; gap: 10px; margin: 1.5rem 0 10px; }
.group-badge  { background: var(--blue); color: #fff; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.group-title  { font-size: 15px; font-weight: 600; }

/* ── MESSAGES ───────────────────────────────────────────────── */
.msg     { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 12px; }
.msg-err { background: var(--red-lt);   color: var(--red);   }
.msg-ok  { background: var(--green-lt); color: var(--green); }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    .match-body { grid-template-columns: 1fr 90px 1fr; }
    .team-flag  { font-size: 20px; }
    .sc-input   { width: 40px; height: 40px; font-size: 17px; }
    .results-row { grid-template-columns: 1fr; gap: 6px; }
}
