/* ============================================================
   BALONMANO TARAZONA PWA — Estilos
   Paleta oficial del club: Magenta #b00070 + Azul #1010a0
   ============================================================ */

/* ── Reset y base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colores oficiales del club */
  --magenta:        #b00070;
  --magenta-oscuro: #880055;
  --magenta-claro:  #f7e0ef;
  --azul:           #1010a0;
  --azul-medio:     #2828b8;
  --azul-claro:     #e0e0f7;

  --blanco:      #ffffff;
  --gris-claro:  #f4f4f8;
  --gris-medio:  #9090a8;
  --gris-oscuro: #404058;
  --texto:       #1a1a2e;
  --error:       #cc2200;
  --exito:       #00a870;

  --radio:       12px;
  --radio-sm:    8px;
  --sombra:      0 2px 12px rgba(16,16,160,.10);
  --sombra-card: 0 4px 20px rgba(16,16,160,.12);

  --fuente:      'Segoe UI', system-ui, -apple-system, sans-serif;
  --nav-h:       64px;
  --header-h:    60px;
}

html, body {
  height: 100%;
  font-family: var(--fuente);
  background: var(--gris-claro);
  color: var(--texto);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ── Pantalla de login ───────────────────────────────────── */
#pantalla-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 24px;
  background: linear-gradient(160deg, var(--azul) 0%, var(--magenta) 100%);
}

.login-logo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  margin-bottom: 20px;
  object-fit: contain;
  background: rgba(255,255,255,.12);
  padding: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
}

.login-titulo {
  color: var(--blanco);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  text-shadow: 0 1px 4px rgba(0,0,0,.3);
}

.login-subtitulo {
  color: rgba(255,255,255,.75);
  font-size: .9rem;
  text-align: center;
  margin-bottom: 36px;
}

#btn-google-login { margin-bottom: 16px; }

#login-error {
  display: none;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #ffe0f0;
  border-radius: var(--radio-sm);
  padding: 12px 16px;
  font-size: .85rem;
  text-align: center;
  max-width: 300px;
  margin-top: 16px;
}

/* ── App shell ───────────────────────────────────────────── */
#app {
  display: none;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* ── Header ──────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  background: linear-gradient(90deg, var(--azul) 0%, var(--magenta) 100%);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}

.header-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: contain;
  background: rgba(255,255,255,.15);
  padding: 3px;
}

.header-titulo {
  color: var(--blanco);
  font-weight: 700;
  font-size: 1rem;
  flex: 1;
  letter-spacing: .02em;
}

.header-usuario {
  display: flex;
  align-items: center;
  gap: 8px;
}

#usuario-foto {
  display: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4);
  object-fit: cover;
}

#usuario-nombre {
  color: rgba(255,255,255,.85);
  font-size: .78rem;
}

#usuario-rol {
  background: rgba(255,255,255,.2);
  color: var(--blanco);
  font-size: .62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border: 1px solid rgba(255,255,255,.3);
}

.btn-logout {
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color .15s;
}
.btn-logout:hover { color: var(--blanco); }

/* ── Contenido principal ─────────────────────────────────── */
.app-contenido {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--nav-h);
}

/* ── Pantallas ───────────────────────────────────────────── */
.pantalla {
  display: none;
  padding: 16px;
  min-height: calc(100vh - var(--header-h) - var(--nav-h));
  animation: fadeIn .2s ease;
}
.pantalla.activa { display: block; }

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

/* ── Nav inferior ────────────────────────────────────────── */
#nav-bottom {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-h);
  background: var(--blanco);
  border-top: 1px solid #e0e0ee;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 200;
  box-shadow: 0 -2px 12px rgba(16,16,160,.08);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  color: var(--gris-medio);
  transition: color .15s;
  position: relative;
}

.nav-item.activo { color: var(--magenta); }

.nav-item.activo::after {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: var(--magenta);
  border-radius: 0 0 3px 3px;
}

.nav-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.nav-label {
  font-size: .62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Pantalla inicio ─────────────────────────────────────── */
.inicio-bienvenida {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--magenta-claro);
}

.inicio-bienvenida h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--azul);
}

.temporada {
  font-size: .8rem;
  color: var(--gris-medio);
  margin-top: 2px;
}

/* ── Cards ───────────────────────────────────────────────── */
.cards-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--blanco);
  border-radius: var(--radio);
  padding: 16px;
  box-shadow: var(--sombra-card);
  border-left: 4px solid var(--azul);
}

.card-alerta {
  border-left-color: var(--magenta);
  background: var(--magenta-claro);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-titulo {
  font-weight: 700;
  font-size: .95rem;
  color: var(--azul);
}

.chip {
  background: var(--azul-claro);
  color: var(--azul);
  font-size: .68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}

.chip-magenta {
  background: var(--magenta-claro);
  color: var(--magenta);
}

.card-dato {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  border-top: 1px solid #eeeef5;
}

.dato-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gris-medio);
  font-weight: 600;
}

.dato-valor {
  font-size: .95rem;
  font-weight: 600;
  color: var(--texto);
}

.dato-sub {
  font-size: .8rem;
  color: var(--gris-oscuro);
}

/* ── Botones ─────────────────────────────────────────────── */
.btn-primario {
  background: var(--magenta);
  color: var(--blanco);
  border: none;
  border-radius: var(--radio-sm);
  padding: 11px 20px;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  margin-top: 12px;
  transition: background .15s;
}
.btn-primario:active { background: var(--magenta-oscuro); }

.btn-secundario {
  background: var(--azul-claro);
  color: var(--azul);
  border: none;
  border-radius: var(--radio-sm);
  padding: 8px 16px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background .15s;
}
.btn-secundario:active { background: #c8c8ee; }

/* ── Estados ─────────────────────────────────────────────── */
.cargando {
  text-align: center;
  padding: 48px 16px;
  color: var(--gris-medio);
  font-size: .9rem;
}

.cargando::before {
  content: '';
  display: block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--magenta-claro);
  border-top-color: var(--magenta);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 12px;
}

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

.error {
  background: #fff0ee;
  border: 1px solid #ffcccc;
  color: var(--error);
  border-radius: var(--radio-sm);
  padding: 12px 16px;
  font-size: .85rem;
  margin: 16px 0;
}

.proximamente {
  text-align: center;
  padding: 64px 16px;
  color: var(--gris-medio);
  font-size: 1rem;
}

/* ── Divisor de sección ──────────────────────────────────── */
.seccion-titulo {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--magenta);
  margin: 20px 0 10px;
}

/* ── Responsive escritorio ───────────────────────────────── */
@media (min-width: 480px) {
  body { background: #d8d8ee; }
  #app { box-shadow: 0 0 40px rgba(0,0,0,.15); }
}

/* ── Safe area iPhone ────────────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #nav-bottom {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  }
}

/* ── Sin datos ───────────────────────────────────────────── */
.sin-datos {
  color: var(--gris-medio);
  font-style: italic;
  font-weight: 400;
  font-size: .85rem;
}
