/* Guerreros del Ring - estilos generales (mobile-first, tema oscuro) */
:root {
  --bg: #09090c;
  --bg-2: #101015;
  --card: #15151c;
  --card-2: #1c1c25;
  --borde: rgba(255, 255, 255, 0.08);
  --borde-2: rgba(255, 255, 255, 0.14);
  --texto: #f5f5f7;
  --suave: #a3a3ad;
  --tenue: #6b6b76;
  --acento: #e3122b;
  --acento-2: #ff3048;
  --acento-oscuro: #8f0a1b;
  --verde: #22c55e;
  --verde-osc: #0f5f2e;
  --amarillo: #f5b301;
  --amarillo-osc: #6b4d00;
  --rojo: #ef4444;
  --rojo-osc: #6f1515;
  --radio: 18px;
  --radio-sm: 12px;
  --sombra: 0 10px 40px rgba(0, 0, 0, 0.45);
  --titulo: 'Bebas Neue', 'Impact', 'Arial Narrow', sans-serif;
  --cuerpo: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 100% -10%, rgba(227, 18, 43, 0.16), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(227, 18, 43, 0.08), transparent 60%);
  background-attachment: fixed;
  color: var(--texto);
  font-family: var(--cuerpo);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

h1, h2, h3, .titulo {
  font-family: var(--titulo);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1;
  margin: 0;
}
h1 { font-size: clamp(2.6rem, 9vw, 4.4rem); }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.35rem; }
.suave { color: var(--suave); }
.tenue { color: var(--tenue); }
.pequeno { font-size: 0.85rem; }
.centro { text-align: center; }
.negrita { font-weight: 700; }
.mono { font-variant-numeric: tabular-nums; }

.contenedor { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px; }
.contenedor.ancho { max-width: 1180px; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.logo svg { width: 42px; height: 42px; flex: none; }
.logo .nombre { font-family: var(--titulo); font-size: 1.45rem; letter-spacing: 0.04em; line-height: 0.95; }
.logo .nombre small { display: block; font-family: var(--cuerpo); font-size: 0.62rem; letter-spacing: 0.22em; color: var(--suave); font-weight: 600; text-transform: uppercase; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--borde-2);
  background: var(--card-2); color: var(--texto);
  font-weight: 700; font-size: 0.98rem; text-decoration: none;
  cursor: pointer; user-select: none;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s;
}
.btn:hover { border-color: rgba(255, 255, 255, 0.28); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primario {
  background: linear-gradient(135deg, var(--acento-2), var(--acento) 55%, #b40c20);
  border-color: transparent;
  box-shadow: 0 8px 26px rgba(227, 18, 43, 0.35);
}
.btn-primario:hover { box-shadow: 0 10px 34px rgba(227, 18, 43, 0.5); border-color: transparent; }
.btn-whatsapp { background: #1fae54; border-color: transparent; box-shadow: 0 8px 22px rgba(31, 174, 84, 0.3); }
.btn-fantasma { background: transparent; }
.btn-peligro { background: transparent; border-color: rgba(239, 68, 68, 0.5); color: #ff8a8a; }
.btn-bloque { width: 100%; }
.btn-grande { min-height: 58px; font-size: 1.08rem; }
.btn-chico { min-height: 38px; padding: 0 14px; font-size: 0.88rem; }
.btn-icono { width: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
.btn-icono.chico { width: 38px; min-height: 38px; }

/* ---------- Tarjetas ---------- */
.tarjeta {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 18px;
}
.tarjeta + .tarjeta { margin-top: 14px; }
.tarjeta-titulo { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tarjeta-titulo h3 { font-size: 1.3rem; }
.etiqueta { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--suave); font-weight: 700; }

/* ---------- Formularios ---------- */
.campo { display: block; margin-bottom: 14px; }
.campo > span { display: block; font-size: 0.82rem; font-weight: 600; color: var(--suave); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 14px;
  background: var(--bg-2); border: 1px solid var(--borde-2); border-radius: var(--radio-sm);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
  font-size: 16px;
}
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--acento); box-shadow: 0 0 0 3px rgba(227, 18, 43, 0.25); }
.input-pin { letter-spacing: 0.6em; text-align: center; font-size: 1.4rem; font-weight: 700; }
.fila { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.fila > .campo { min-width: 0; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--acento); }
.error-form { color: #ff8a8a; font-size: 0.9rem; min-height: 1.2em; margin: 4px 0 10px; }

.segmentado { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.segmentado label { position: relative; }
.segmentado input { position: absolute; opacity: 0; pointer-events: none; }
.segmentado span {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; border-radius: var(--radio-sm);
  border: 1px solid var(--borde-2); background: var(--bg-2); font-weight: 700; cursor: pointer; transition: all 0.15s;
}
.segmentado input:checked + span { border-color: var(--acento); background: rgba(227, 18, 43, 0.16); color: #fff; }
.segmentado input:focus-visible + span { box-shadow: 0 0 0 3px rgba(227, 18, 43, 0.3); }

/* ---------- Estados (semáforo) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
}
.badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.al_dia { color: var(--verde); background: rgba(34, 197, 94, 0.12); }
.badge.por_vencer { color: var(--amarillo); background: rgba(245, 179, 1, 0.12); }
.badge.vencido { color: var(--rojo); background: rgba(239, 68, 68, 0.13); }
.badge.inactivo { color: var(--tenue); background: rgba(255, 255, 255, 0.06); }

/* ---------- Avatar ---------- */
.avatar {
  --t: 48px;
  width: var(--t); height: var(--t); flex: none; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, #2a2a35, #1a1a22);
  border: 2px solid var(--borde-2);
  font-family: var(--titulo); font-size: calc(var(--t) * 0.42); letter-spacing: 0.04em; color: #fff;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.al_dia { border-color: var(--verde); }
.avatar.por_vencer { border-color: var(--amarillo); }
.avatar.vencido { border-color: var(--rojo); }

/* ---------- Recuadro demo ---------- */
.demo {
  margin-top: 18px; padding: 14px 16px; border-radius: var(--radio-sm);
  border: 1px dashed rgba(245, 179, 1, 0.45); background: rgba(245, 179, 1, 0.06);
  font-size: 0.88rem; color: var(--suave);
}
.demo b { color: var(--texto); }
.demo .etiqueta { color: var(--amarillo); display: block; margin-bottom: 6px; }
.demo button { background: none; border: 0; padding: 0; color: var(--amarillo); text-decoration: underline; cursor: pointer; font-weight: 700; font-size: 0.85rem; }
.demo code { font-family: ui-monospace, Consolas, monospace; color: var(--texto); background: rgba(255,255,255,.06); padding: 1px 6px; border-radius: 6px; }

/* ---------- Toast ---------- */
#toasts { position: fixed; left: 0; right: 0; top: 14px; z-index: 300; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; max-width: 480px; width: 100%;
  padding: 14px 18px; border-radius: 14px; background: #20202a; border: 1px solid var(--borde-2);
  box-shadow: var(--sombra); font-weight: 600; animation: entrarArriba 0.3s ease both;
}
.toast.ok { border-color: rgba(34, 197, 94, 0.5); }
.toast.error { border-color: rgba(239, 68, 68, 0.6); }
.toast.saliendo { animation: salirArriba 0.3s ease both; }

/* ---------- Modal ---------- */
.modal-fondo {
  position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: aparecer 0.2s ease both;
}
.modal {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--borde-2); border-bottom: 0;
  border-radius: 24px 24px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  animation: subir 0.3s cubic-bezier(.2,.9,.3,1) both;
}
.modal-cabecera { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-cabecera h2 { font-size: 1.8rem; }
@media (min-width: 640px) {
  .modal-fondo { align-items: center; padding: 20px; }
  .modal { border-radius: 24px; border-bottom: 1px solid var(--borde-2); padding: 24px; }
}

/* ---------- Listas ---------- */
.lista { display: grid; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px;
  background: var(--bg-2); border: 1px solid var(--borde);
}
.item .info { flex: 1; min-width: 0; }
.item .info .nombre { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .info .detalle { font-size: 0.84rem; color: var(--suave); }
.item .acciones { display: flex; gap: 6px; flex: none; }
.item.clic { cursor: pointer; transition: border-color 0.2s, transform 0.15s; }
.item.clic:hover { border-color: var(--borde-2); }
.vacio { text-align: center; color: var(--tenue); padding: 28px 10px; }

.tabla-simple { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tabla-simple th { text-align: left; color: var(--tenue); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 8px 6px; border-bottom: 1px solid var(--borde); }
.tabla-simple td { padding: 11px 6px; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.tabla-simple tr:last-child td { border-bottom: 0; }
.derecha { text-align: right; }

/* ---------- Cargando ---------- */
.cargando { display: grid; place-items: center; min-height: 40vh; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid rgba(255,255,255,.1); border-top-color: var(--acento); animation: girar 0.8s linear infinite; }

/* ---------- Animaciones ---------- */
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes entrarArriba { from { transform: translateY(-20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes salirArriba { to { transform: translateY(-20px); opacity: 0; } }
@keyframes girar { to { transform: rotate(360deg); } }
@keyframes pulso { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.animar { animation: subir 0.45s cubic-bezier(.2,.9,.3,1) both; }
.animar.d1 { animation-delay: 0.05s; } .animar.d2 { animation-delay: 0.1s; } .animar.d3 { animation-delay: 0.15s; }
.animar.d4 { animation-delay: 0.2s; } .animar.d5 { animation-delay: 0.25s; } .animar.d6 { animation-delay: 0.3s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Pantalla de acceso ---------- */
.acceso { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 28px 0 40px; }
.acceso .cabecera { text-align: center; margin-bottom: 24px; }
.acceso .cabecera h1 { font-size: 2.8rem; margin-top: 14px; }
.volver { display: inline-flex; align-items: center; gap: 6px; color: var(--suave); text-decoration: none; font-size: 0.9rem; font-weight: 600; margin-bottom: 18px; }
.volver svg { width: 18px; height: 18px; }

.pie { text-align: center; color: var(--tenue); font-size: 0.8rem; padding: 26px 16px calc(26px + env(safe-area-inset-bottom)); }
