/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f172a;
  --surface:  #1e293b;
  --surface2: #334155;
  --green:    #16a34a;
  --green-l:  #22c55e;
  --gold:     #f59e0b;
  --text:     #f8fafc;
  --text-dim: #94a3b8;
  --danger:   #ef4444;
  --wa:       #25D366;
  --radius:   12px;
  --nav-h:    64px;
  --header-h: 52px;
}

html { font-size: 16px; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
/* Prevenir desbordamiento horizontal en todos los contextos */
body { overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  min-height: 100dvh;
  overscroll-behavior: none;
  /* Evitar que bottom nav tape contenido */
  padding-bottom: 80px;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, .bebas { font-family: 'Bebas Neue', sans-serif; letter-spacing: 0.02em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

/* ===== LAYOUT ===== */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  border-bottom: 1px solid var(--surface2);
}

.app-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  color: var(--green-l);
  text-decoration: none;
  letter-spacing: 0.05em;
}

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

.main-content {
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}

.main-content.with-nav {
  padding-top: calc(var(--header-h) + 16px);
  padding-bottom: calc(var(--nav-h) + 16px);
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  display: flex;
  border-top: 1px solid var(--surface2);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  transition: color 0.15s;
  position: relative;
}

.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--green-l); }
.nav-item:active { opacity: 0.7; }

.nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  background: var(--danger);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.15s;
}
.card-link:active { transform: scale(0.98); }

/* ===== PERSONA CARD ===== */
.persona-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.persona-card:active { background: var(--surface2); }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: white;
  flex-shrink: 0;
  text-transform: uppercase;
}

.persona-info { flex: 1; min-width: 0; }
.persona-nombre { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.persona-sub { font-size: 0.75rem; color: var(--text-dim); margin-top: 2px; }

.match-dots { display: flex; align-items: center; gap: 4px; }
.match-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green-l);
  flex-shrink: 0;
}
.match-badge {
  background: var(--green);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ===== CHIPS DE FIGURITAS ===== */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: 'DM Sans', monospace;
}
.chip-blue { background: #1e3a5f; color: #60a5fa; }
.chip-green { background: #14532d; color: #4ade80; }

/* ===== BOTONES ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  /* Mínimo 44px tap target para mobile */
  min-height: 44px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  width: 100%;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-l); }
.btn-secondary { background: var(--surface2); color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-wa { background: var(--wa); color: white; }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; width: auto; }
.btn-google {
  background: white;
  color: #1f1f1f;
  font-size: 1rem;
  padding: 14px 24px;
  gap: 10px;
}

/* ===== FORMULARIOS ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  /* 16px mínimo para evitar zoom automático en iOS */
  font-size: 1rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--green);
}
.form-textarea { min-height: 120px; resize: vertical; }
.form-hint { font-size: 0.75rem; color: var(--text-dim); margin-top: 4px; }
.form-error { color: var(--danger); font-size: 0.85rem; margin-top: 8px; }

/* ===== BARRA DE PROGRESO ===== */
.progress-bar {
  background: var(--surface2);
  border-radius: 8px;
  height: 8px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-l));
  border-radius: 8px;
  transition: width 0.5s ease;
}
.progress-label { font-size: 0.8rem; color: var(--text-dim); display: flex; justify-content: space-between; }

/* ===== SECCIÓN SEPARADOR ===== */
.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 20px 0 10px;
}

/* ===== ALERTAS ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.alert-success { background: #14532d; color: #4ade80; }
.alert-error { background: #450a0a; color: #fca5a5; }
.alert-info { background: #1e3a5f; color: #93c5fd; }

/* ===== LANDING PAGE ===== */
.landing {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  background: linear-gradient(180deg, #0f172a 0%, #0d2618 100%);
}

.landing-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 4rem;
  color: var(--green-l);
  letter-spacing: 0.05em;
  line-height: 1;
  margin-bottom: 8px;
}

.landing-sub {
  color: var(--text-dim);
  font-size: 1rem;
  margin-bottom: 48px;
  line-height: 1.5;
}

.landing-ball {
  font-size: 5rem;
  margin-bottom: 16px;
}

/* ===== SELECTOR FIGURITAS ===== */
.seccion-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tab-btn {
  background: var(--surface2);
  color: var(--text-dim);
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s, color 0.15s;
}
.tab-btn.active { background: var(--green); color: white; }

.numeros-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.num-btn {
  aspect-ratio: 1;
  border: 2px solid var(--surface2);
  background: var(--surface);
  color: var(--text-dim);
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.1s;
}
.num-btn.faltante { border-color: var(--danger); color: var(--danger); background: #450a0a22; }
.num-btn.repetida { border-color: var(--green); color: var(--green-l); background: #14532d44; }
.num-btn:active { transform: scale(0.92); }

/* ===== ADMIN TABLA ===== */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  padding: 8px 0;
  border-bottom: 1px solid var(--surface2);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.admin-table td { padding: 10px 4px 10px 0; border-bottom: 1px solid var(--surface2)15; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }

/* ===== BADGE ROL ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
}
.badge-admin { background: var(--gold); color: #1c1400; }
.badge-miembro { background: var(--surface2); color: var(--text-dim); }
.badge-pendiente { background: #713f12; color: #fde68a; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
}
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-text { font-size: 0.85rem; line-height: 1.5; }

/* ===== CÓDIGO DE INVITACIÓN ===== */
.codigo-box {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin: 12px 0;
}
.codigo-texto {
  font-family: 'Bebas Neue', monospace;
  font-size: 2.2rem;
  color: var(--green-l);
  letter-spacing: 0.15em;
}
.codigo-link { font-size: 0.75rem; color: var(--text-dim); margin-top: 4px; word-break: break-all; }

/* ===== MATCH DETAIL ===== */
.match-section { margin-bottom: 24px; }
.match-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

/* ===== TAB PILLS ===== */
.tab-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.tab-pills::-webkit-scrollbar { display: none; }

.tab-pill {
  flex-shrink: 0;
  padding: 8px 16px;
  min-height: 36px;
  border: none;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  background: var(--surface2);
  color: var(--text-dim);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}
.tab-pill.active,
.tab-pill:focus { background: var(--green); color: white; }

/* ===== UTILS ===== */
.text-dim { color: var(--text-dim); }
.text-green { color: var(--green-l); }
.text-gold { color: var(--gold); }
.text-danger { color: var(--danger); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.fw-bold { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.between { justify-content: space-between; }
.divider { border: none; border-top: 1px solid var(--surface2); margin: 16px 0; }
