/* =====================================================================
   ZONEX — sistema de diseño base
   Paleta: negro con verde de señal. Tipografía: Rajdhani (display) +
   Inter (texto). El panel de jugador usa un layout dividido con una
   franja diagonal como elemento de marca; el panel admin es más
   utilitario y deliberadamente distinto (para que nunca se confunda
   con el portal de jugador).
   ===================================================================== */

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

:root {
    --zx-bg: #0B120D;
    --zx-bg-deep: #060907;
    --zx-surface: #121C15;
    --zx-border: #223328;
    --zx-green: #35D875;
    --zx-green-deep: #16532A;
    --zx-text: #EAF3EC;
    --zx-text-muted: #8FA894;
    --zx-danger: #E2574C;
    --zx-danger-bg: rgba(226, 87, 76, 0.12);
    --zx-amber: #FFB85C;

    --zx-font-display: 'Rajdhani', sans-serif;
    --zx-font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--zx-bg);
    color: var(--zx-text);
    font-family: var(--zx-font-body);
    font-size: 16px;
    line-height: 1.5;
}

a { color: var(--zx-green); }

/* ---------- Layout de autenticación (jugador): panel dividido ---------- */

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
}

@media (min-width: 900px) {
    .auth-shell { grid-template-columns: 1fr 1fr; }
}

.auth-hero {
    position: relative;
    background: radial-gradient(circle at 15% 85%, var(--zx-green-deep) 0%, transparent 55%), var(--zx-bg-deep);
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    min-height: 220px;
}

/* Tiene que ir DESPUÉS de la regla base de arriba — si va antes, la
   regla base (que también trae "display: flex" y no depende de ningún
   media query) le gana en el orden de cascada y el panel se sigue
   viendo en el celular a pesar de esto. Ya nos pasó una vez. */
@media (max-width: 899px) {
    .auth-hero { display: none; }
}

.auth-hero::before {
    /* franja diagonal — el único elemento decorativo grande de la marca */
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 60%;
    height: 160%;
    background: linear-gradient(135deg, transparent 46%, var(--zx-green-deep) 46%, var(--zx-green-deep) 52%, transparent 52%);
    opacity: 0.55;
}

.auth-hero__logo {
    position: relative;
    max-width: 150px;
    height: auto;
    margin-bottom: 4px;
}

.auth-hero__mark {
    position: relative;
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 3.4rem);
    letter-spacing: 0.02em;
    color: var(--zx-text);
    margin: 0;
}

.auth-hero__mark span { color: var(--zx-green); }

.auth-hero__tagline {
    position: relative;
    max-width: 34ch;
    color: var(--zx-text-muted);
    font-size: 1.05rem;
    margin: 12px 0 0;
}

.auth-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    overflow: hidden;
    background: var(--zx-bg);
}

.auth-panel::before,
.auth-panel::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.auth-panel::before {
    top: -18%;
    right: -18%;
    width: 65%;
    height: 65%;
    background: radial-gradient(circle, var(--zx-green-deep) 0%, transparent 72%);
    opacity: 0.4;
}

.auth-panel::after {
    bottom: -22%;
    left: -16%;
    width: 55%;
    height: 55%;
    background: radial-gradient(circle, var(--zx-green) 0%, transparent 72%);
    opacity: 0.16;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 1.7rem;
    margin: 0 0 6px;
}

.auth-card p.subtitle {
    color: var(--zx-text-muted);
    margin: 0 0 28px;
    font-size: 0.95rem;
}

/* ---------- Login admin: card centrada, sin hero — otro portal, otro tono ---------- */

.admin-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--zx-bg-deep);
    padding: 24px;
}

.admin-card {
    width: 100%;
    max-width: 360px;
    background: var(--zx-surface);
    border: 1px solid var(--zx-border);
    border-radius: 6px;
    padding: 32px;
}

.admin-card__label {
    color: var(--zx-text-muted);
    font-size: 0.85rem;
    margin: 0 0 4px;
}

.admin-card h1 {
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0 0 24px;
}

/* ---------- Formularios (compartido) ---------- */

.field { margin-bottom: 18px; }

.field label {
    display: block;
    font-size: 0.9rem;
    color: var(--zx-text-muted);
    margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="tel"],
.field select {
    width: 100%;
    background: var(--zx-surface);
    border: 1px solid var(--zx-border);
    border-radius: 4px;
    padding: 11px 13px;
    color: var(--zx-text);
    font-family: var(--zx-font-body);
    font-size: 1rem;
}

.field select {
    cursor: pointer;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--zx-green);
    box-shadow: 0 0 0 3px rgba(53, 216, 117, 0.18);
}

.password-wrap { position: relative; }

.password-wrap input { padding-right: 42px; }

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    margin: 0;
    cursor: pointer;
    color: var(--zx-text-muted);
    display: flex;
    align-items: center;
}

.password-toggle:hover { color: var(--zx-text); }

.password-toggle svg { width: 20px; height: 20px; }

.password-toggle .icon-eye-closed { display: none; }

.field-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
}

.field-check input { width: 16px; height: 16px; }

.field-check label { color: var(--zx-text-muted); font-size: 0.9rem; margin: 0; }

.avatar-choices {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.avatar-choice {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--zx-text-muted);
    font-size: 0.9rem;
    cursor: pointer;
}

.avatar-choice input { width: 16px; height: 16px; accent-color: var(--zx-green); }

/* ---------- Encabezado y stats del perfil ---------- */

.perfil-encabezado {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.avatar-editable {
    position: relative;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
}

.avatar-editable__overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: var(--zx-text);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.avatar-editable:hover .avatar-editable__overlay,
.avatar-editable:focus-visible .avatar-editable__overlay {
    opacity: 1;
}

.avatar-opciones {
    display: none;
    flex-wrap: wrap;
    gap: 12px;
    margin: -8px 0 20px;
}

.avatar-opciones form { display: contents; }

.avatar-opcion {
    background: none;
    border: 2px solid transparent;
    border-radius: 50%;
    padding: 2px;
    cursor: pointer;
    line-height: 0;
}

.avatar-opcion--activo { border-color: var(--zx-green); }

.perfil-enlace {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--zx-border);
    color: var(--zx-text);
    text-decoration: none;
}

.perfil-enlace svg { color: var(--zx-green); flex-shrink: 0; }

.perfil-enlace:last-of-type { border-bottom: none; margin-bottom: 12px; }

.ranking-mi-posicion {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--zx-surface);
    border: 1px solid var(--zx-border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 20px;
    text-decoration: none;
    color: var(--zx-text);
}

.ranking-mi-posicion__puesto {
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--zx-green);
    min-width: 34px;
}

.ranking-mi-posicion__texto {
    display: flex;
    flex-direction: column;
}

.perfil-seccion {
    border-top: 1px solid var(--zx-border);
}

.perfil-seccion:last-of-type { border-bottom: 1px solid var(--zx-border); }

.perfil-seccion__titulo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    cursor: pointer;
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--zx-text);
    list-style: none;
}

.perfil-seccion__titulo::-webkit-details-marker { display: none; }
.perfil-seccion__titulo::marker { content: ''; }

.perfil-seccion__flecha {
    transition: transform 0.2s ease;
    flex-shrink: 0;
    color: var(--zx-text-muted);
}

.perfil-seccion[open] .perfil-seccion__flecha { transform: rotate(180deg); }

.perfil-seccion__contenido { padding-bottom: 20px; }

.ranking-jugador {
    display: flex;
    align-items: center;
    gap: 8px;
}

.montos-rapidos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-width: 360px;
    margin-bottom: 16px;
}

.monto-chip {
    background: var(--zx-surface);
    border: 1px solid var(--zx-border);
    color: var(--zx-text);
    border-radius: 6px;
    padding: 12px 8px;
    font-family: var(--zx-font-body);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: center;
}

.monto-chip:hover { border-color: var(--zx-green-deep); }

.monto-chip--activo {
    border-color: var(--zx-green);
    background: rgba(53, 216, 117, 0.1);
    color: var(--zx-green);
}

.premio-boton {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--zx-green);
    padding: 0 0 0 4px;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
}

.premio-tooltip {
    position: fixed;
    background: var(--zx-green);
    color: #06120A;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 7px 14px;
    border-radius: 6px;
    z-index: 1200;
    white-space: nowrap;
    transform: translate(-50%, calc(-100% - 10px));
    pointer-events: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.premio-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--zx-green);
}

.torneo-preview {
    background: var(--zx-surface);
    border: 1px solid var(--zx-green-deep);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--zx-text);
}

.btn-crear-torneo {
    display: block;
    width: 100%;
    text-align: center;
    background: var(--zx-green);
    color: #06120A;
    font-weight: 700;
    font-family: var(--zx-font-display);
    padding: 14px;
    border-radius: 8px;
    text-decoration: none;
    margin-bottom: 8px;
}

.btn-crear-torneo:hover { background: #2bc465; }

.notif-permiso-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--zx-green-deep);
    color: var(--zx-text);
    padding: 10px 16px;
    font-size: 0.85rem;
    position: sticky;
    top: 0;
    z-index: 960;
}

.notif-permiso-banner span { flex: 1; }

.notif-permiso-banner button {
    background: var(--zx-green);
    color: var(--zx-bg-deep);
    border: none;
    border-radius: 4px;
    padding: 6px 14px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    flex-shrink: 0;
}

.notif-permiso-banner__cerrar {
    background: none !important;
    color: var(--zx-text) !important;
    font-size: 1.1rem !important;
    padding: 0 4px !important;
    font-weight: 400 !important;
}

.perfil-encabezado__nombre {
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 1.2rem;
    margin: 0 0 4px;
}

.perfil-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.perfil-stat {
    flex: 1;
    background: var(--zx-surface);
    border: 1px solid var(--zx-border);
    border-radius: 8px;
    padding: 14px;
    text-decoration: none;
    color: var(--zx-text);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.perfil-stat strong {
    font-family: var(--zx-font-display);
    font-size: 1.3rem;
}

.codigo-invitacion {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.codigo-invitacion__codigo {
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.1em;
    background: var(--zx-surface);
    border: 1px dashed var(--zx-green-deep);
    color: var(--zx-green);
    border-radius: 6px;
    padding: 8px 16px;
}

.paquetes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.paquete-card {
    background: var(--zx-surface);
    border: 1px solid var(--zx-border);
    border-radius: 8px;
    padding: 16px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.paquete-card__monedas {
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0;
}

.paquete-card__cop {
    color: var(--zx-green);
    font-size: 0.9rem;
    margin: 0 0 8px;
}

/* ---------- Pop-up de premio del ranking mensual ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 9, 7, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 20px;
}

.modal-premio {
    background: var(--zx-surface);
    border: 1px solid var(--zx-green-deep);
    border-radius: 12px;
    padding: 28px;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.modal-premio__titulo {
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 1.6rem;
    color: var(--zx-green);
    margin: 0 0 12px;
}

.modal-premio .btn { margin-top: 16px; }

.modal-confirmar {
    background: var(--zx-surface);
    border: 1px solid var(--zx-border);
    border-radius: 12px;
    padding: 24px;
    max-width: 360px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.modal-confirmar__titulo {
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 1.3rem;
    margin: 0 0 12px;
}

.modal-confirmar__acciones {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* ---------- Pasos numerados (página de instalar.php) ---------- */

.pasos-instalar {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    counter-reset: paso;
}

.pasos-instalar li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
    color: var(--zx-text);
}

.pasos-instalar li::before {
    counter-increment: paso;
    content: counter(paso);
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--zx-green);
    color: var(--zx-bg-deep);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* El texto del paso va en un solo <span> — si el texto quedara suelto
   (con <strong> mezclado directo dentro del <li>), cada fragmento de
   texto se vuelve su propio elemento flex y el párrafo se ve partido
   en columnas raras. Envolviéndolo en un <span>, el <li> solo tiene 2
   hijos de verdad (el número y el texto), y el texto fluye normal. */
.pasos-instalar li span {
    flex: 1 1 auto;
    min-width: 0;
}

.plataforma-elegir {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

/* ---------- Banner compacto de promos (Inicio) ---------- */

.banner-promo {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--zx-surface);
    border: 1px solid var(--zx-border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 20px;
    text-decoration: none;
    color: var(--zx-text);
}

.banner-promo:hover { background: var(--zx-border); }

.banner-promo__icono { font-size: 1.25rem; flex: 0 0 auto; line-height: 1; }

.banner-promo__texto { flex: 1 1 auto; font-size: 0.88rem; font-weight: 600; }

.banner-promo__flecha { flex: 0 0 auto; color: var(--zx-text-muted); }

/* ---------- Alerta neutral/informativa (requisitos, avisos) ---------- */

.alert-info {
    background: rgba(255, 184, 92, 0.12);
    color: var(--zx-amber);
    border: 1px solid rgba(255, 184, 92, 0.35);
}

/* ---------- Lista simple con punto verde ---------- */

.lista-simple {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}

.lista-simple li {
    padding-left: 18px;
    position: relative;
    margin-bottom: 8px;
    color: var(--zx-text);
}

.lista-simple li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--zx-green);
}

.imagen-promo {
    width: 100%;
    max-width: 420px;
    display: block;
    margin: 0 auto 20px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* ---------- Tabla de ranking — compacta a propósito para que quepa
   en celular sin tener que deslizar a los lados. No usa .table-scroll
   (esa fuerza un ancho mínimo de 560px pensado para tablas de admin
   con más columnas, que aquí no hace falta). ---------- */

.ranking-scroll {
    overflow-x: auto;
}

.tabla-ranking th,
.tabla-ranking td {
    padding: 8px 4px;
}

.tabla-ranking th:first-child,
.tabla-ranking td:first-child {
    padding-left: 0;
    width: 22px;
}

.tabla-ranking th:last-child,
.tabla-ranking td:last-child {
    text-align: right;
    padding-right: 0;
    white-space: nowrap;
}

.tabla-ranking .ranking-jugador span {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Tabla de detalle de un torneo (etiqueta + valor) — mismo
   problema que el ranking: .table-scroll fuerza 560px de ancho mínimo,
   de sobra para 2 columnas simples, y eso hacía que en el celular
   quedara la mitad de la tabla escondida sin que se notara que había
   que deslizar. ---------- */

.detalle-scroll {
    overflow-x: auto;
}

/* ---------- Prueba social: total de jugadores (login, registro, Inicio) ---------- */

.prueba-social {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(53, 216, 117, 0.10);
    border: 1px solid rgba(53, 216, 117, 0.3);
    color: var(--zx-green);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    margin-bottom: 16px;
}

.tabla-detalle th {
    width: 45%;
    white-space: normal;
}

.tabla-detalle td {
    white-space: normal;
}

.btn {
    display: inline-block;
    width: 100%;
    text-align: center;
    background: var(--zx-green);
    color: var(--zx-bg-deep);
    border: none;
    border-radius: 4px;
    padding: 12px 16px;
    font-family: var(--zx-font-body);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { background: #2bc465; }

.auth-links {
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--zx-text-muted);
}

.auth-divider {
    display: flex;
    align-items: center;
    color: var(--zx-text-muted);
    font-size: 0.8rem;
    margin: 28px 0 16px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--zx-border);
}

.auth-divider span { padding: 0 12px; }

.auth-links-label {
    text-align: center;
    color: var(--zx-text-muted);
    font-size: 0.9rem;
    margin: 0 0 10px;
}

.alert {
    border-radius: 4px;
    padding: 12px 14px;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.alert-error {
    background: var(--zx-danger-bg);
    color: #FF9A91;
    border: 1px solid rgba(226, 87, 76, 0.35);
}

.alert-locked {
    background: var(--zx-danger-bg);
    color: #FF9A91;
    border: 1px solid rgba(226, 87, 76, 0.35);
}

.alert-locked a.btn {
    margin-top: 10px;
}

.alert-success {
    background: rgba(53, 216, 117, 0.1);
    color: var(--zx-green);
    border: 1px solid rgba(53, 216, 117, 0.3);
}

/* ---------- Páginas autenticadas (jugador + admin): topbar y contenido ---------- */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: var(--zx-bg-deep);
    border-bottom: 1px solid var(--zx-border);
    position: sticky;
    top: 0;
    z-index: 950;
}

.topbar__brand {
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--zx-text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.topbar__brand img {
    height: 26px;
    width: auto;
    display: block;
}

.topbar__brand span { color: var(--zx-green); }

.topbar__brand small {
    font-family: var(--zx-font-body);
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--zx-text-muted);
    margin-left: 6px;
}

.topbar__nav a {
    color: var(--zx-text-muted);
    text-decoration: none;
    margin-left: 20px;
    font-size: 0.9rem;
}

.topbar__nav a:hover { color: var(--zx-text); }

.content {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.content h1 {
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 1.8rem;
    margin: 0 0 20px;
}

.content h2 {
    font-family: var(--zx-font-display);
    font-weight: 600;
    font-size: 1.3rem;
    margin: 28px 0 12px;
}

.content h3 {
    font-size: 1.05rem;
    margin: 20px 0 10px;
    color: var(--zx-text-muted);
}

.balance-card {
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 2.4rem;
    color: var(--zx-green);
    margin: 4px 0 20px;
}

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

.divider {
    border: none;
    border-top: 1px solid var(--zx-border);
    margin: 32px 0;
}

/* ---------- Tablas ---------- */

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

.table th, .table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--zx-border);
    font-size: 0.92rem;
}

.table th {
    color: var(--zx-text-muted);
    font-weight: 600;
    font-size: 0.82rem;
}

.table tbody tr:hover { background: rgba(53, 216, 117, 0.04); }

.monto-positivo { color: var(--zx-green); }
.monto-negativo { color: #FF9A91; }

/* ---------- Búsqueda y formularios en línea ---------- */

.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    max-width: 420px;
}

.search-form input {
    flex: 1;
    background: var(--zx-surface);
    border: 1px solid var(--zx-border);
    border-radius: 4px;
    padding: 9px 12px;
    color: var(--zx-text);
    font-family: var(--zx-font-body);
}

.search-form .btn { width: auto; padding: 9px 18px; }

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 28px;
    max-width: 640px;
}

.form-inline .field { margin-bottom: 0; flex: 1; min-width: 180px; }
.form-inline .btn { width: auto; padding: 11px 20px; }

.btn-secondary {
    background: transparent;
    color: var(--zx-green);
    border: 1px solid var(--zx-green-deep);
}

.btn-secondary:hover { background: rgba(53, 216, 117, 0.08); }

.link-action {
    color: var(--zx-green);
    font-size: 0.9rem;
    text-decoration: none;
}

.link-action:hover { text-decoration: underline; }

.link-action--btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

/* ---------- Acciones en botones separados, para no confundirse de link
   al hacer clic (tabla de torneos y de retiros pendientes, admin) ---------- */

.torneo-acciones,
.retiro-acciones {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.torneo-acciones form,
.retiro-acciones form { margin: 0; }

.torneo-acciones .link-action,
.torneo-acciones .link-action--btn,
.retiro-acciones .link-action,
.retiro-acciones .link-action--btn {
    display: inline-block;
    background: var(--zx-surface);
    border: 1px solid var(--zx-border);
    color: var(--zx-text);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.torneo-acciones .link-action:hover,
.torneo-acciones .link-action--btn:hover,
.retiro-acciones .link-action:hover,
.retiro-acciones .link-action--btn:hover {
    background: var(--zx-border);
    text-decoration: none;
}

.torneo-acciones .link-action--peligro,
.retiro-acciones .link-action--peligro {
    color: #FF9A91;
    border-color: rgba(226, 87, 76, 0.35);
    background: var(--zx-danger-bg);
}

.torneo-acciones .link-action--peligro:hover,
.retiro-acciones .link-action--peligro:hover {
    background: rgba(226, 87, 76, 0.22);
}

/* ---------- Utilidades para el módulo de torneos ---------- */

.btn-auto {
    width: auto;
    display: inline-block;
}

.table td form,
.table th form {
    display: inline-block;
    margin: 0 8px 0 0;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-proximo   { background: rgba(53, 216, 117, 0.14); color: var(--zx-green); }
.badge-en_curso  { background: rgba(53, 216, 117, 0.24); color: var(--zx-green); }
.badge-aplazado  { background: rgba(226, 87, 76, 0.12); color: #FFB199; }
.badge-cancelado { background: rgba(226, 87, 76, 0.12); color: #FF9A91; }
.badge-finalizado {
    background: var(--zx-surface);
    color: var(--zx-text-muted);
    border: 1px solid var(--zx-border);
}

.badge-pendiente  { background: rgba(255, 184, 92, 0.14); color: var(--zx-amber); }
.badge-pagado     { background: rgba(53, 216, 117, 0.14); color: var(--zx-green); }
.badge-rechazado  { background: rgba(226, 87, 76, 0.12); color: #FF9A91; }

.stacked-form { max-width: 420px; }

.table input[type="number"] {
    width: 70px;
    background: var(--zx-surface);
    border: 1px solid var(--zx-border);
    border-radius: 4px;
    padding: 6px 8px;
    color: var(--zx-text);
    font-family: var(--zx-font-body);
}

.table input[type="number"]:focus {
    outline: none;
    border-color: var(--zx-green);
}

.table input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--zx-green);
}

.fila-yo {
    background: rgba(53, 216, 117, 0.08);
    font-weight: 600;
}

.fila-separador td {
    text-align: center;
    color: var(--zx-text-muted);
    padding: 4px 12px;
    border-bottom: none;
}

.nav-badge {
    display: inline-block;
    background: var(--zx-green);
    color: var(--zx-bg-deep);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 2px;
}

.notif-list {
    list-style: none;
    margin: 20px 0 0;
    padding: 0;
}

.notif-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--zx-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notif-item--sin-leer {
    border-left: 3px solid var(--zx-green);
    padding-left: 12px;
}

.notif-item__link {
    color: var(--zx-text);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notif-item__link:hover .notif-item__msg { text-decoration: underline; }

.notif-item__msg {
    color: var(--zx-text-muted);
    font-size: 0.9rem;
}

.notif-item__fecha {
    font-size: 0.78rem;
}

/* ---------- Avatares ---------- */

.avatar-round {
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
    background: var(--zx-surface);
    flex-shrink: 0;
}

.avatar-placeholder {
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--zx-green-deep);
    color: var(--zx-green);
    font-family: var(--zx-font-display);
    font-weight: 700;
    flex-shrink: 0;
}

/* ---------- Topbar: campana + avatar ---------- */

.topbar__user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar__bell {
    position: relative;
    display: inline-flex;
    color: var(--zx-text-muted);
}

.topbar__bell svg { width: 22px; height: 22px; }

.topbar__bell .nav-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    margin: 0;
}

.topbar__avatar-link { display: inline-flex; }

.btn-instalar-pwa {
    display: none;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--zx-green-deep);
    color: var(--zx-green);
    border-radius: 4px;
    padding: 6px 10px;
    font-family: var(--zx-font-body);
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-instalar-pwa svg { width: 16px; height: 16px; }

@media (max-width: 768px) {
    .btn-instalar-pwa.btn-instalar-pwa--listo { display: inline-flex; }
    .btn-instalar-pwa--login.btn-instalar-pwa--listo { display: flex; }
}

.btn-instalar-pwa--login {
    display: none;
    width: 100%;
    justify-content: center;
    padding: 11px 16px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* ---------- Saludo del dashboard (avatar + nombre + ver perfil) ---------- */

.dashboard-saludo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.dashboard-saludo__texto h1 {
    margin: 0;
    font-size: 1.3rem;
}

.dashboard-saludo__texto a {
    font-size: 0.85rem;
    color: var(--zx-green);
    text-decoration: none;
}

/* ---------- Tarjeta de saldo con icono ---------- */

.wallet-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    background: var(--zx-surface);
    border: 1px solid var(--zx-border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.wallet-card__saldo-link {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: inherit;
}

.wallet-card__icono {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--zx-green-deep);
    color: var(--zx-green);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wallet-card__icono svg { width: 26px; height: 26px; }

.wallet-card__texto p { margin: 0; }

.wallet-card__monedas {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    color: var(--zx-text-muted);
    font-size: 0.85rem;
    text-decoration: none;
}

.wallet-card__monedas:hover { color: var(--zx-text); }

.wallet-card__moneda-punto {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--zx-green);
    display: inline-block;
    flex-shrink: 0;
}

.sala-card {
    background: var(--zx-surface);
    border: 1px solid var(--zx-green-deep);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}

.sala-card__titulo {
    font-family: var(--zx-font-display);
    font-weight: 700;
    color: var(--zx-green);
    margin: 0 0 12px;
}

.sala-card__fila {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--zx-border);
    flex-wrap: wrap;
}

.sala-card__fila:last-child { border-bottom: none; }

.sala-card__etiqueta {
    color: var(--zx-text-muted);
    font-size: 0.85rem;
    width: 90px;
    flex-shrink: 0;
}

.sala-card__valor {
    font-family: var(--zx-font-display);
    font-weight: 600;
    font-size: 1.1rem;
    word-break: break-all;
    flex: 1;
}

.sala-card__copiar {
    background: var(--zx-green-deep);
    border: none;
    color: var(--zx-green);
    border-radius: 6px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.sala-card__copiar:hover { background: rgba(53, 216, 117, 0.3); }

.wallet-card__monto {
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--zx-text);
}

/* ---------- Fila de atajos con icono ---------- */

.shortcuts-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}

.shortcuts-row--2 {
    grid-template-columns: repeat(2, 1fr);
}

.shortcut-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: var(--zx-surface);
    border: 1px solid var(--zx-border);
    border-radius: 8px;
    padding: 14px 8px;
    color: var(--zx-text);
    text-decoration: none;
    font-size: 0.78rem;
    text-align: center;
}

.shortcut-btn:hover { border-color: var(--zx-green-deep); }

.shortcut-btn svg {
    width: 22px;
    height: 22px;
    color: var(--zx-green);
}

/* ---------- Encabezado de sección con "Ver todos" ---------- */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 28px 0 12px;
}

.section-header h2 { margin: 0; }

.section-header a {
    font-size: 0.85rem;
    color: var(--zx-green);
    text-decoration: none;
    white-space: nowrap;
}

/* ---------- Cards de torneo ---------- */

.torneo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 8px;
}

.torneo-card {
    background: var(--zx-surface);
    border: 1px solid var(--zx-border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.torneo-card__imagen {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--zx-bg-deep);
}

.torneo-card__imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.torneo-card__imagen a {
    display: block;
    width: 100%;
    height: 100%;
}

.torneo-card__badges {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.torneo-card__badge {
    background: rgba(0, 0, 0, 0.78);
    color: var(--zx-green);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 5px 10px;
    border-radius: 4px;
}

.torneo-card__badge--aplazado {
    color: #FFB199;
}

.torneo-card__cuerpo {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.torneo-card__titulo {
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 1.05rem;
    margin: 0;
}

.torneo-card__meta {
    color: var(--zx-text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.torneo-card__fila {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--zx-text-muted);
    margin: 4px 0 8px;
}

.torneo-card__pagos {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.torneo-card__pago { display: flex; flex-direction: column; }

.torneo-card__pago-monto {
    font-family: var(--zx-font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--zx-green);
    line-height: 1.15;
}

.torneo-card__pago-etiqueta {
    font-size: 0.75rem;
    color: var(--zx-text-muted);
}

.torneo-card__pagos .torneo-card__pago:last-child { align-items: flex-end; }

.torneo-card__meta--fecha {
    color: var(--zx-green);
    font-weight: 700;
}

.torneo-card__btn {
    margin-top: auto;
    text-align: center;
}

/* ---------- Carrusel de "Próximos torneos" (solo en Inicio) ----------
   .torneo-grid (arriba) sigue igual y la sigue usando la lista completa
   de Torneos — esto es aparte, solo para la vista previa de Inicio. */

.torneo-carrusel {
    position: relative;
    margin-bottom: 8px;
}

.torneo-carrusel__pista {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}

.torneo-carrusel__pista::-webkit-scrollbar { display: none; }

.torneo-carrusel__item {
    flex: 0 0 100%;
    min-width: 0;
    scroll-snap-align: start;
}

@media (min-width: 768px) {
    .torneo-carrusel__item { flex: 0 0 calc((100% - 16px * 2) / 3); }
}

@media (min-width: 1200px) {
    .torneo-carrusel__item { flex: 0 0 calc((100% - 16px * 3) / 4); }
}

.torneo-carrusel__flecha {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.torneo-carrusel__flecha:hover { background: rgba(0, 0, 0, 0.88); }

.torneo-carrusel__flecha--izq { left: 8px; }
.torneo-carrusel__flecha--der { right: 8px; }

.torneo-carrusel__flecha--oculta {
    visibility: hidden;
    pointer-events: none;
}

/* ---------- Bottom nav (fijo, solo móvil) ---------- */

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--zx-bg-deep);
    border-top: 1px solid var(--zx-border);
    z-index: 900;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--zx-text-muted);
    text-decoration: none;
    font-size: 0.66rem;
    padding: 4px 4px;
    flex: 1;
}

.bottom-nav__item svg { width: 22px; height: 22px; }

.bottom-nav__item--activo { color: var(--zx-green); }

.bottom-nav__icon-wrap { position: relative; display: inline-flex; }

.bottom-nav__badge {
    position: absolute;
    top: -4px;
    right: -9px;
    margin: 0;
}

@media (max-width: 768px) {
    .bottom-nav { display: flex; justify-content: space-around; align-items: center; }
    .content { padding-bottom: 88px; }
    .topbar__nav { display: none; }
    .shortcuts-row { grid-template-columns: repeat(3, 1fr); }
}

.table-scroll {
    overflow-x: auto;
    margin-bottom: 20px;
}

.table-scroll .table {
    margin-bottom: 0;
    min-width: 560px;
}

/* ---------- Toast de notificaciones en vivo (polling) ---------- */

.notif-toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 320px;
}

.notif-toast {
    background: var(--zx-surface);
    border: 1px solid rgba(53, 216, 117, 0.35);
    border-left: 3px solid var(--zx-green);
    border-radius: 4px;
    padding: 12px 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.85rem;
    animation: notif-toast-entrar 0.25s ease-out;
}

.notif-toast strong {
    color: var(--zx-green);
    font-family: var(--zx-font-display);
    font-size: 0.95rem;
}

.notif-toast span {
    color: var(--zx-text-muted);
}

.notif-toast--clicable {
    cursor: pointer;
}

.notif-toast--salir {
    animation: notif-toast-salir 0.3s ease-in forwards;
}

@keyframes notif-toast-entrar {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes notif-toast-salir {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-8px); }
}
