/* ================================================================
   COPA CAJAMARCA 2026 — styles.css
   Mobile First · Optimizado para tribuna (sol, pantalla pequeña)
   Tap targets mínimo 48px · Fuente legible a distancia
   ================================================================ */

@import './theme.css';

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  font-family: 'Barlow', sans-serif;
  background: var(--bg);
  color: var(--navy);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
}

img { display: block; max-width: 100%; }
button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  /* evita el 300ms delay en mobile */
  touch-action: manipulation;
}

/* ── HEADER ── */
.site-header {
  background: var(--navy);
  /* patrón diagonal sutil */
  background-image:
    repeating-linear-gradient(
      -45deg,
      transparent 0px,
      transparent 20px,
      rgba(255,255,255,.03) 20px,
      rgba(255,255,255,.03) 21px
    );
  padding: 20px 16px 0;
  /* Respeta status bar en iOS */
  padding-top: calc(20px + env(safe-area-inset-top));
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
}

.logo {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.header-text {
  flex: 1;
  min-width: 0;
}

.header-sup {
  display: block;
  font-family: 'Barlow', sans-serif;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .06em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: .02em;
  line-height: 1;
  text-transform: uppercase;
}

/* Píldora EN VIVO separada, pegada al borde inferior del header */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--gold);
  color: var(--gold-text);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 99px 99px 0 0; /* pegado abajo */
  margin-bottom: -1px;
  align-self: flex-end; /* alineada a la derecha */
  margin-left: auto;
}

/* wrapper de píldora para que quede pegada abajo-derecha */
.site-header {
  display: flex;
  flex-direction: column;
}
.live-pill-row {
  display: flex;
  justify-content: flex-end;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--gold-text);
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 1.3s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .35; transform: scale(.65); }
}

/* ── FILTROS ── */
.filters-container {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--white);
  border-bottom: 1px solid rgba(11,31,58,.08);
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  gap: 6px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  padding-left: 16px;
  width: 55px;
  flex-shrink: 0;
}

.filter-bar {
  display: flex;
  gap: 6px;
  padding: 0 16px 0 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-btn {
  flex-shrink: 0;
  height: 32px;
  padding: 0 14px;
  border-radius: 99px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--bg);
  border: 1.5px solid transparent;
  transition: background .18s var(--ease), color .18s var(--ease);
  /* Sin delay táctil */
  -webkit-tap-highlight-color: transparent;
}
.filter-btn:active { transform: scale(.96); }
.filter-btn.active {
  background: var(--navy);
  color: var(--gold);
}

/* ── BARRA DE ACTUALIZACIÓN ── */
.refresh-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--white);
  border-bottom: 1px solid rgba(11,31,58,.05);
}
.spin {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(11,31,58,.12);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── CONTENIDO PRINCIPAL ── */
.main-content {
  padding: 14px 12px 20px;
  max-width: 520px;
  margin: 0 auto;
}

/* ── LISTA DE PARTIDOS (una sola columna en mobile) ── */
.matches-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── TARJETA DE PARTIDO ── */
.match-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(11,31,58,.08), 0 4px 16px rgba(11,31,58,.06);
  border: 1px solid rgba(11,31,58,.06);
  animation: slideIn .3s var(--ease) both;
  -webkit-tap-highlight-color: transparent;
}
.match-card:nth-child(1)  { animation-delay: .03s; }
.match-card:nth-child(2)  { animation-delay: .07s; }
.match-card:nth-child(3)  { animation-delay: .11s; }
.match-card:nth-child(4)  { animation-delay: .15s; }
.match-card:nth-child(5)  { animation-delay: .19s; }
.match-card:nth-child(6)  { animation-delay: .23s; }
.match-card:nth-child(7)  { animation-delay: .27s; }
.match-card:nth-child(8)  { animation-delay: .31s; }
.match-card:nth-child(9)  { animation-delay: .35s; }

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

/* Franja de color superior por estado */
.match-card[data-estado="en curso"]   { border-top: 3px solid var(--red); }
.match-card[data-estado="finalizado"] { border-top: 3px solid var(--navy); }
.match-card[data-estado="pendiente"]  { border-top: 3px solid var(--gold); }

/* ── CABECERA DE TARJETA ── */
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 0;
}

.card-cat {
  font-family: 'Barlow', sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.status-chip {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 99px;
  line-height: 1.4;
}
.status-chip.en-curso   { 
  background: var(--red-bg);  
  color: var(--red-text); 
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.status-chip.en-curso .pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--red);
}
.status-chip.finalizado { background: var(--slate-bg);  color: var(--slate-text); }
.status-chip.pendiente  { background: var(--amber-bg);  color: var(--amber-text); }

/* ── MARCADOR — el corazón de la tarjeta ── */
.card-score {
  display: grid;
  /* columnas: equipo | marcador | equipo */
  grid-template-columns: 1fr 90px 1fr;
  align-items: center;
  gap: 4px;
  padding: 14px 14px 10px;
}

.team {
  font-family: 'Barlow Condensed', sans-serif;
  line-height: 1.1;
  text-transform: uppercase;
}
.team.local {
  text-align: right;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
}
.team.visitante {
  text-align: left;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
}

/* Resaltar ganador cuando el partido terminó */
.team.winner {
  color: var(--navy);
  font-weight: 800;
  font-size: 1.2rem;
}
.team.loser {
  color: var(--text-muted);
  font-weight: 600;
}

.score-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.score-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  min-width: 32px;
  text-align: center;
  color: var(--navy);
  /* Números más vivos cuando está en curso */
}
.match-card[data-estado="en curso"] .score-num {
  color: var(--red);
}
.match-card[data-estado="finalizado"] .score-num {
  color: var(--navy-mid);
}

.score-sep {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1;
  padding-bottom: 2px;
}

/* ── BOTÓN VER DETALLES ── */
.btn-details {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px;          /* tap target ≥ 44px */
  font-family: 'Barlow', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  border-top: 1px solid rgba(11,31,58,.06);
  transition: background .15s var(--ease), color .15s var(--ease);
  letter-spacing: .02em;
}
.btn-details:hover, .btn-details:active { background: var(--bg); color: var(--navy); }
.btn-details svg {
  transition: transform .25s var(--ease);
  flex-shrink: 0;
}
.btn-details.open svg { transform: rotate(180deg); }

/* ── PANEL DE DETALLES ── */
.details-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s var(--ease);
}
.details-panel.open { max-height: 180px; }

.details-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(11,31,58,.07);
  border-top: 1px solid rgba(11,31,58,.07);
}

.detail-cell {
  background: var(--white);
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-label {
  font-family: 'Barlow', sans-serif;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.detail-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}
.empty-state span {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
  line-height: 1;
}
.empty-state p {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
}

/* ── SKELETONS ── */
.skeleton-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px 14px;
  box-shadow: 0 1px 4px rgba(11,31,58,.06);
}
.skel {
  background: linear-gradient(90deg, #e2e8f0 25%, #cdd5e0 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: shimmer 1.5s ease-in-out infinite;
}
.skel + .skel { margin-top: 10px; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── FOOTER ── */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
  background: var(--white);
  border-top: 1px solid rgba(11,31,58,.07);
  margin-top: 8px;
}

.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 340px;
  height: 54px;             /* tap target grande */
  background: var(--gold);
  color: var(--gold-text);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: 99px;
  box-shadow: 0 4px 16px rgba(245,197,24,.35);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), filter .18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn-download:active { transform: scale(.97); }
.btn-download:hover  { box-shadow: 0 6px 24px rgba(245,197,24,.5); }
.btn-download.loading { filter: saturate(.4); pointer-events: none; }

.footer-note {
  font-size: .75rem;
  color: var(--text-muted);
  letter-spacing: .03em;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--navy);
  color: var(--white);
  font-family: 'Barlow', sans-serif;
  font-size: .88rem;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 99px;
  box-shadow: 0 6px 24px rgba(0,0,0,.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s var(--ease), transform .28s var(--ease);
  white-space: nowrap;
  z-index: 100;
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── TABLET / DESKTOP: dos columnas solo si hay espacio ── */
@media (min-width: 560px) {
  .main-content { padding: 16px 16px 24px; max-width: 720px; }
  .matches-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
  }
  .header-title { font-size: 2.4rem; }
}

@media (min-width: 900px) {
  .matches-list { grid-template-columns: repeat(3, 1fr); }
}

/* ── CAPTURA / SCREENSHOT ── */
body.capturing .filters-container,
body.capturing .site-footer,
body.capturing .refresh-bar { display: none !important; }
body.capturing .site-header { position: static !important; }

/* ── MODAL FORMATO ── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(11,31,58,.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(11,31,58,.15);
}

.modal-content h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.modal-content p {
  font-size: .95rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.btn-format {
  flex: 1;
  background: var(--navy);
  color: var(--gold);
  border: none;
  padding: 14px 0;
  border-radius: var(--radius-sm);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-format:active { opacity: .8; transform: scale(.98); }

.btn-cancel {
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: .95rem;
  padding: 8px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

/* ── BOTTOM NAV — 5 ítems (compartido por vivo y posiciones) ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--navy);
  display: flex;
  border-top: 1px solid rgba(255,255,255,.08);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 300;
  box-shadow: 0 -4px 20px rgba(0,0,0,.25);
}
.bnav-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 9px 2px 7px; gap: 3px;
  color: rgba(255,255,255,.30);
  text-decoration: none;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .58rem; font-weight: 800;
  letter-spacing: .05em; text-transform: uppercase;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.bnav-item svg { flex-shrink: 0; }
.bnav-item:active { opacity: .7; }
.bnav-active { color: var(--gold) !important; }
.bnav-active::after {
  content: '';
  position: absolute; top: 0; left: 15%; right: 15%; height: 2px;
  background: var(--gold); border-radius: 0 0 3px 3px;
}
.bnav-live { color: rgba(220,38,38,.5); }
.bnav-live:hover, .bnav-live.bnav-active { color: var(--red) !important; }
.bnav-live.bnav-active::after { background: var(--red); }
.bnav-live-wrap { position: relative; display: inline-flex; }
.bnav-live-dot {
  position: absolute; top: -1px; right: -3px;
  width: 7px; height: 7px;
  background: var(--red); border-radius: 50%;
  border: 1.5px solid var(--navy);
  animation: copa-pulse 1.3s ease-in-out infinite;
}