/* =====================================================================
   Los pibes del IUPFA — Prode Mundial 2026
   Paleta: slate #334141, magenta #ba0063, claro #f3f3f3
   Tipografía: Bebas Neue (títulos) + Montserrat (cuerpo)
   ===================================================================== */

:root {
    --bg:       #f3f3f3;
    --surface:  #ffffff;
    --ink:      #334141;   /* texto principal (slate) */
    --muted:    #8a9494;
    --accent:   #ba0063;   /* magenta de marca */
    --accent-d: #8e004b;   /* magenta hover */
    --link:     #b60464;
    --dark:     #2b3636;   /* barra superior / footer */
    --dark-2:   #222b2b;
    --line:     #e3e3e1;
    --ok:       #2e7d32;
    --warn:     #c77700;
    --danger:   #c0392b;
    --radius:   10px;
    --shadow:   0 1px 3px rgba(51,65,65,.08), 0 6px 18px rgba(51,65,65,.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 {
    font-family: 'Bebas Neue', 'Montserrat', sans-serif;
    font-weight: 400;
    letter-spacing: .5px;
    line-height: 1.05;
    color: var(--ink);
    margin: 0 0 .4rem;
}
h1 { font-size: 2.2rem; }
h2 { font-size: 1.55rem; }

/* ---------- Header ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .7rem 1.4rem;
    background: var(--dark);
    border-bottom: 3px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; }
.brand:hover { text-decoration: none; }
.logo { height: 38px; width: 38px; object-fit: cover; border-radius: 8px; display: block; }
.brand-sep { width: 1px; height: 24px; background: rgba(255,255,255,.25); }
.brand-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.35rem;
    letter-spacing: 1px;
    color: #fff;
    text-transform: uppercase;
}
.brand-sub {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1rem;
    letter-spacing: .8px;
    color: rgba(255,255,255,.7);
    text-transform: uppercase;
}
.topbar nav { display: flex; align-items: center; gap: 1.3rem; flex-wrap: wrap; margin-left: auto; margin-right: 1.1rem; }
.topbar nav a { color: rgba(255,255,255,.82); font-size: .82rem; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.topbar nav a:hover { color: #fff; text-decoration: none; }
.topbar .user { color: #fff; font-weight: 700; font-size: .82rem; }
.btn-link { color: var(--accent) !important; }

/* Selector de idioma (separado del resto de la nav) */
.lang-switch {
    display: inline-flex; gap: .2rem; align-items: center;
    background: rgba(0,0,0,.22);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px; padding: .2rem;
}
.lang-switch .lang {
    display: inline-flex; align-items: center; gap: .35rem;
    color: rgba(255,255,255,.62); font-size: .74rem; font-weight: 700;
    padding: .28rem .6rem; border-radius: 999px; letter-spacing: .3px;
}
.lang-switch .lang .flag { font-size: 1rem; line-height: 1; }
.lang-switch .lang:hover { color: #fff; text-decoration: none; }
.lang-switch .lang.active { color: #fff; background: var(--accent); }

/* Número de partido */
.match-no {
    display: inline-block; background: var(--accent); color: #fff;
    font-weight: 800; font-size: .72rem; padding: .05rem .4rem;
    border-radius: 5px; margin-right: .4rem; letter-spacing: .3px;
}

.nav-toggle {
    display: none;
    background: none; border: 0; color: #fff;
    font-size: 1.5rem; cursor: pointer; line-height: 1;
}

/* ---------- Layout ---------- */
.container { max-width: 900px; margin: 0 auto; padding: 2rem 1.2rem 3.5rem; }

.page-head { margin-bottom: 1.4rem; }
.page-head h1 { margin: 0 0 .15rem; }
.page-head h1::after {
    content: ""; display: block; width: 54px; height: 4px;
    background: var(--accent); margin-top: .5rem; border-radius: 2px;
}

.stage {
    margin: 2rem 0 .7rem;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--line);
    padding-bottom: .35rem;
}

.muted { color: var(--muted); }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.3rem;
    margin-bottom: 1.2rem;
    box-shadow: var(--shadow);
}
.card.narrow { max-width: 430px; margin-left: auto; margin-right: auto; }

/* ---------- Forms ---------- */
label { display: block; margin: .8rem 0; font-size: .82rem; font-weight: 600; color: var(--ink); text-transform: uppercase; letter-spacing: .4px; }
input, select {
    display: block;
    width: 100%;
    margin-top: .35rem;
    padding: .6rem .75rem;
    background: #fff;
    border: 1px solid #cfd6d6;
    border-radius: 8px;
    color: var(--ink);
    font-size: 1rem;
    font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(186,0,99,.12); }
input[type="number"] { width: auto; }

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: .65rem 1.15rem;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    cursor: pointer;
    transition: background .15s ease;
}
.btn:hover { background: var(--accent-d); text-decoration: none; color: #fff; }
.btn-sm { padding: .4rem .8rem; font-size: .72rem; }
.btn-warn { background: var(--warn); }
.btn-warn:hover { background: #a96400; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #9c2c20; }

/* ---------- Flash ---------- */
.flash { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; border-left: 4px solid; }
.flash-success { background: #eaf6ea; border-color: var(--ok); color: #1e5620; }
.flash-error { background: #fbeae8; border-color: var(--danger); color: #8e2419; }

/* ---------- Partidos ---------- */
.view-toggle { display: flex; align-items: center; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.view-toggle .view-by { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; margin-right: .2rem; }
.view-toggle .seg {
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    padding: .35rem .8rem; border-radius: 999px; font-size: .82rem; font-weight: 700;
}
.view-toggle .seg:hover { text-decoration: none; border-color: var(--accent); }
.view-toggle .seg.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.preds-note {
    background: #fdf4f8;
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: .7rem 1rem;
    margin-bottom: 1.1rem;
    font-weight: 600;
    font-size: .92rem;
}
.matches { display: grid; gap: .7rem; }
.match-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    box-shadow: var(--shadow);
    transition: border-color .15s ease;
}
.match-card:hover { border-color: #cdd4d4; }
.match-card.locked { opacity: .85; background: #fafafa; }
.match-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: .7rem; }
.kickoff { color: var(--muted); font-size: .8rem; font-weight: 600; }
.badge { font-size: .66rem; padding: .2rem .6rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; border: 1px solid; }
.badge-open { color: var(--ok); border-color: var(--ok); background: #eaf6ea; }
.badge-live { color: var(--warn); border-color: var(--warn); background: #fdf3e3; }
.badge-final { color: #fff; background: var(--dark); border-color: var(--dark); }

.match-form { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.teams { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.team { min-width: 90px; font-weight: 600; }
.team.home { text-align: right; }
.teams input { width: 3.2rem; text-align: center; margin-top: 0; font-weight: 700; }
.vs { color: var(--muted); font-weight: 700; }
.pts { color: var(--accent); font-weight: 800; font-size: 1.05rem; }

/* ---------- Imagen de posiciones ---------- */
.standings-img { text-align: center; margin-bottom: 1.3rem; }
.standings-img img {
    width: 100%;
    max-width: 340px;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ---------- Tablas ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .65rem .55rem; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: var(--muted); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; }
.table tbody tr:hover { background: #faf7f9; }
.table .num { text-align: right; }
.table tbody tr:first-child td strong { color: var(--accent); }

/* ---------- Admin ---------- */
.stats { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.stat {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem 1.2rem; flex: 1; min-width: 120px; box-shadow: var(--shadow);
    text-transform: uppercase; font-size: .72rem; letter-spacing: .5px; color: var(--muted); font-weight: 600;
}
.stat .num { display: block; font-family: 'Bebas Neue', sans-serif; font-size: 2.2rem; color: var(--accent); letter-spacing: 1px; }
.admin-nav { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.inline-form label { margin: 0; }
.row-actions { flex-direction: column; align-items: flex-start; }
.pw-form input { width: 11rem; padding: .35rem .55rem; font-size: .85rem; margin-top: 0; }
.team-form { margin-top: .4rem; }
.team-form input { width: 9rem; padding: .3rem .5rem; font-size: .82rem; margin-top: 0; }

/* ---------- Disclaimer / Reglas ---------- */
.rules-img { margin-bottom: 1.4rem; text-align: center; }
.rules-img img {
    width: 100%;
    max-width: 480px;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.card.disclaimer { border-left: 5px solid var(--accent); background: #fdf4f8; }
.card.disclaimer h2 { color: var(--accent); }
.card.disclaimer p { margin: .5rem 0; }
ol.rules { padding-left: 1.3rem; margin: 0; }
ol.rules > li { margin: .6rem 0; }
ol.rules ul { margin: .4rem 0; padding-left: 1.1rem; }
ol.rules ul li { margin: .2rem 0; }

/* ---------- Footer ---------- */
.footer { text-align: center; color: rgba(255,255,255,.7); padding: 2rem 1rem; background: var(--dark-2); margin-top: 2rem; font-size: .8rem; }
.footer .help { margin-bottom: 1rem; }
.footer .help-note { color: rgba(255,255,255,.85); font-size: .9rem; margin: 0; }
.footer .help-ico { margin-right: .25rem; }

/* Burbuja flotante de ayuda (logueado) */
.help-fab {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    padding: .7rem 1rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: .9rem;
    box-shadow: 0 6px 18px rgba(0,0,0,.28);
}
.help-fab { border: 0; cursor: pointer; }
.help-fab:hover { background: var(--accent-d); color: #fff; text-decoration: none; }
.help-fab .ico { font-size: 1.1rem; line-height: 1; }

/* Modal de ayuda */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1100;
    background: rgba(20,25,25,.55);
    display: none; align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
    background: #fff; color: var(--ink);
    border-radius: var(--radius); max-width: 420px; width: 100%;
    padding: 1.6rem 1.5rem; text-align: center;
    box-shadow: 0 12px 44px rgba(0,0,0,.35);
}
.modal h2 { margin: 0 0 .6rem; }
.modal p { margin: 0; color: var(--ink); }
.modal-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: 1.3rem; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f3f3f3; color: var(--ink); }
@media (max-width: 680px) {
    .help-fab { right: 14px; bottom: 14px; padding: .8rem; }
    .help-fab .help-fab-text { display: none; }   /* en mobile queda solo el ícono */
}

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
    .nav-toggle { display: block; }
    .topbar { flex-wrap: wrap; }
    .topbar nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; gap: .7rem; padding-top: .6rem; margin-left: 0; margin-right: 0; }
    body.nav-open .topbar nav { display: flex; }
    .brand-title { font-size: 1.1rem; }
    h1 { font-size: 1.8rem; }
    .container { padding: 1.4rem 1rem 3rem; }

    /* Partidos: apilar el form para que el nombre del equipo no choque con el botón */
    .match-form { flex-direction: column; align-items: stretch; gap: .7rem; }
    .teams { justify-content: space-between; gap: .4rem; }
    .team { min-width: 0; flex: 1; font-size: .92rem; }
    .team.home { text-align: right; }
    .teams input { flex: 0 0 auto; width: 3rem; }
    .match-form .btn, .match-form .pts, .match-form > .muted { align-self: center; }

    /* Tabla de posiciones: que no desborde */
    .card { overflow-x: auto; }
    .table th, .table td { padding: .5rem .35rem; font-size: .85rem; }
    .table th { font-size: .66rem; }
}
