/* =============================================================
   Sistema de diseño - Piscina App
   Pensado para uso al aire libre, con sol directo en el móvil:
   alto contraste, botones grandes, sin texturas que se "laven".
   ============================================================= */

:root {
  /* Color */
  --azul-piscina: #0B5FA8;
  --azul-piscina-oscuro: #084A85;
  --azul-piscina-claro: #E8F1FA;
  --acento-boya: #FFB703;
  --verde-autorizado: #1A9E5E;
  --verde-autorizado-fondo: #E4F7EE;
  --rojo-denegado: #C42B2B;
  --rojo-denegado-fondo: #FDECEA;
  --naranja-menor: #8A4500;
  --naranja-menor-fondo: #FDF0E4;

  --fondo: #FAFAF7;
  --superficie: #FFFFFF;
  --borde: #E0DED6;
  --texto: #1A2740;
  --texto-secundario: #5C6B7A;
  --texto-terciario: #8C97A3;

  /* Tipografía */
  --fuente-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --fuente-numeros: "SF Mono", "Roboto Mono", Consolas, monospace;

  /* Espaciado */
  --espacio-xs: 6px;
  --espacio-sm: 10px;
  --espacio-md: 16px;
  --espacio-lg: 24px;
  --espacio-xl: 36px;

  /* Forma */
  --radio-sm: 8px;
  --radio-md: 14px;
  --radio-lg: 20px;
  --radio-pill: 999px;

  /* Sombra suave, para tarjetas */
  --sombra-tarjeta: 0 1px 3px rgba(26, 39, 64, 0.08), 0 1px 2px rgba(26, 39, 64, 0.04);
}

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

html, body {
  font-family: var(--fuente-base);
  background: var(--fondo);
  color: var(--texto);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--texto);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

p { color: var(--texto-secundario); }

a { color: var(--azul-piscina); text-decoration: none; }

/* ---------- Cabecera con patrón de ondas ---------- */

.cabecera {
  background: var(--azul-piscina);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(255,255,255,0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 100%, rgba(255,255,255,0.06) 0%, transparent 50%);
  color: white;
  padding: var(--espacio-md) var(--espacio-md) var(--espacio-lg);
  position: relative;
  overflow: hidden;
}

.cabecera::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 14px;
  background: var(--fondo);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M0 5 Q 5 0 10 5 T 20 5 T 30 5 T 40 5 T 50 5 T 60 5 T 70 5 T 80 5 T 90 5 T 100 5 V10 H0 Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M0 5 Q 5 0 10 5 T 20 5 T 30 5 T 40 5 T 50 5 T 60 5 T 70 5 T 80 5 T 90 5 T 100 5 V10 H0 Z'/%3E%3C/svg%3E");
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

.cabecera-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--espacio-sm);
}

.cabecera-titulo {
  font-size: 1.15rem;
  font-weight: 700;
}

.cabecera-subtitulo {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.78);
  margin-top: 2px;
}

.cabecera-icono-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
}

/* ---------- Contenido ---------- */

.contenido {
  flex: 1;
  padding: var(--espacio-md);
  padding-bottom: calc(var(--espacio-xl) + 70px); /* deja sitio a la nav inferior */
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Tarjetas ---------- */

.tarjeta {
  background: var(--superficie);
  border-radius: var(--radio-md);
  border: 1px solid var(--borde);
  box-shadow: var(--sombra-tarjeta);
  padding: var(--espacio-md);
  margin-bottom: var(--espacio-md);
}

.tarjeta-titulo {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--texto-terciario);
  margin-bottom: var(--espacio-sm);
}

/* ---------- Filas de datos ---------- */

.fila-dato {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--espacio-sm);
  padding: var(--espacio-sm) 0;
  border-bottom: 1px solid var(--borde);
  font-size: 0.92rem;
}

.fila-dato:last-child { border-bottom: none; }

.fila-dato-etiqueta { color: var(--texto-secundario); }

.fila-dato-valor {
  color: var(--texto);
  font-weight: 600;
  text-align: right;
  font-family: var(--fuente-numeros);
  font-size: 0.88rem;
}

/* ---------- Botones ---------- */

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--espacio-xs);
  width: 100%;
  padding: 14px var(--espacio-md);
  border-radius: var(--radio-md);
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--fuente-base);
  transition: transform 0.08s ease, opacity 0.15s ease;
  -webkit-appearance: none;
}

.boton:active { transform: scale(0.98); }
.boton:disabled { opacity: 0.5; cursor: not-allowed; }

.boton-primario {
  background: var(--azul-piscina);
  color: white;
}

.boton-primario:hover { background: var(--azul-piscina-oscuro); }

.boton-secundario {
  background: var(--superficie);
  color: var(--texto);
  border: 1.5px solid var(--borde);
}

.boton-peligro {
  background: var(--rojo-denegado);
  color: white;
}

.boton-pequeno {
  width: auto;
  padding: 8px 16px;
  font-size: 0.85rem;
}

/* ---------- Formularios ---------- */

.campo {
  margin-bottom: var(--espacio-md);
}

.campo label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--texto-secundario);
  margin-bottom: var(--espacio-xs);
}

.campo input,
.campo select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radio-sm);
  border: 1.5px solid var(--borde);
  font-size: 1rem;
  font-family: var(--fuente-base);
  background: var(--superficie);
  color: var(--texto);
}

.campo input:focus,
.campo select:focus {
  outline: none;
  border-color: var(--azul-piscina);
  box-shadow: 0 0 0 3px var(--azul-piscina-claro);
}

.campo-ayuda {
  font-size: 0.78rem;
  color: var(--texto-terciario);
  margin-top: 4px;
}

.campo-error {
  font-size: 0.8rem;
  color: var(--rojo-denegado);
  margin-top: 4px;
  font-weight: 600;
}

/* ---------- Insignias de estado ---------- */

.insignia {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radio-pill);
}

.insignia-ok {
  background: var(--verde-autorizado-fondo);
  color: var(--verde-autorizado);
}

.insignia-error {
  background: var(--rojo-denegado-fondo);
  color: var(--rojo-denegado);
}

.insignia-menor {
  background: var(--naranja-menor-fondo);
  color: var(--naranja-menor);
}

/* ---------- Navegación inferior ---------- */

.nav-inferior {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--superficie);
  border-top: 1px solid var(--borde);
  display: flex;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  max-width: 480px;
  margin: 0 auto;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--texto-terciario);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 0;
}

.nav-item.activo { color: var(--azul-piscina); }
.nav-item svg { width: 22px; height: 22px; }

/* ---------- Utilidades ---------- */

.centrado { text-align: center; }
.mt-md { margin-top: var(--espacio-md); }
.mt-lg { margin-top: var(--espacio-lg); }

.texto-secundario { color: var(--texto-secundario); font-size: 0.88rem; }

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: girar 0.7s linear infinite;
}

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

.mensaje-flotante {
  position: fixed;
  bottom: 90px;
  left: var(--espacio-md);
  right: var(--espacio-md);
  max-width: 448px;
  margin: 0 auto;
  background: var(--texto);
  color: white;
  padding: var(--espacio-sm) var(--espacio-md);
  border-radius: var(--radio-md);
  font-size: 0.88rem;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  z-index: 100;
  animation: aparecer 0.2s ease;
}

@keyframes aparecer {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Respeta si el usuario prefiere menos movimiento */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
