/* ============================================================
   Polla Mundial 2026 ? Custom CSS (Tabler + Bootstrap 5 base)
   ============================================================ */

/* ?? Tipograf?a global ?????????????????????????????????????? */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  background-color: #f1f5f9;
}

/* ?? Bottom Navigation ?????????????????????????????????????? */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  z-index: 1030;
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 600;
  transition: color .15s;
  padding: 10px 6px;
  min-height: 72px;
}

.bottom-nav-item.active {
  color: #1a56db;
}

.bottom-nav-item svg {
  stroke: currentColor;
  transition: stroke .15s;
  width: 26px;
  height: 26px;
}

/* Padding para que el contenido no quede bajo el bottom nav */
.pb-bottom-nav {
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0));
}

/* ?? Input Stepper (para pron?sticos) ??????????????????????? */
.input-stepper {
  display: flex;
  align-items: center;
  border: 1.5px solid #cbd5e1;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #fff;
}

.btn-step {
  background: #f8fafc;
  border: none;
  color: #374151;
  font-size: 1.2rem;
  font-weight: 700;
  width: 40px;
  min-height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .12s;
  line-height: 1;
  padding: 0;
}

.btn-step:hover:not(:disabled) {
  background: #e2e8f0;
}

.btn-step:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.step-input {
  flex: 1;
  border: none;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  min-width: 0;
  background: transparent;
  color: #1e3a8a;
  padding: 0;
  -moz-appearance: textfield;
  appearance: textfield;
  min-height: 44px;
}

.step-input::-webkit-inner-spin-button,
.step-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.input-stepper-sm .btn-step {
  width: 28px;
  min-height: 32px;
  font-size: 1rem;
}

.input-stepper-sm .step-input {
  font-size: 0.85rem;
  min-height: 32px;
}

/* Formulario pronóstico dashboard (responsive) */
.pronostico-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.pronostico-score-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1 1 12rem;
  min-width: 0;
}

.pronostico-score-group .input-stepper {
  flex: 1 1 0;
  min-width: 0;
}

.pronostico-sep {
  flex-shrink: 0;
  font-weight: 700;
  color: #64748b;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.1rem;
}

.pronostico-controls .btn-guardar-pron {
  flex: 0 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
  white-space: nowrap;
}

.partido-card .card-body {
  overflow-x: clip;
}

.partido-equipos-row .partido-flag {
  font-size: 2rem;
}

.partido-equipos-row .partido-team-name {
  font-size: 0.85rem;
  line-height: 1.2;
  word-break: break-word;
  hyphens: auto;
}

@media (max-width: 575.98px) {
  .pronostico-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .pronostico-score-group {
    width: 100%;
    flex: 1 1 auto;
    gap: 0.35rem;
  }

  .pronostico-controls .btn-guardar-pron {
    width: 100%;
    min-height: 44px;
  }

  .pronostico-form-dashboard .btn-step {
    width: 38px;
    min-width: 38px;
  }

  .pronostico-form-dashboard .step-input {
    font-size: 1.05rem;
  }

  .partido-equipos-row .partido-flag {
    font-size: 1.65rem;
  }

  .partido-equipos-row .partido-team-name {
    font-size: 0.78rem;
  }

  .partido-equipos-row > [class*="col-"] {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }
}

@media (max-width: 380px) {
  .pronostico-form-dashboard .btn-step {
    width: 34px;
    min-width: 34px;
    font-size: 1.05rem;
  }

  .pronostico-form-dashboard .step-input {
    font-size: 1rem;
  }

  .pronostico-sep {
    font-size: 0.9rem;
  }
}

/* Marcador en listas de partidos (grupos, admin) */
.badge.bg-dark,
.badge-marcador {
  color: #fff !important;
}

.badge-marcador {
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  min-width: 2.5rem;
}
.score-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: #1e3a8a;
  border-radius: 0.4rem;
  padding: 4px 6px;
}

/* Marcador en vivo en dashboard: fondo claro + n?meros rojos visibles */
.score-display.score-live {
  background: linear-gradient(180deg, #fff1f2 0%, #fee2e2 100%);
  border: 2px solid #f87171;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.22);
  padding: 6px 10px;
  min-width: 4.5rem;
}

.score-num {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  min-width: 20px;
  text-align: center;
}

.score-display.score-live .score-num {
  color: #dc2626;
  font-size: 1.25rem;
  font-weight: 900;
}

.score-sep {
  color: rgba(255,255,255,.6);
  font-weight: 700;
  font-size: .9rem;
}

.score-display.score-live .score-sep {
  color: #ef4444;
  font-weight: 800;
}

/* ?? Tarjetas partido ??????????????????????????????????????? */
.partido-card {
  transition: box-shadow .15s, transform .1s;
}
.partido-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,.1) !important;
}

/* ?? Hover card (admin links) ??????????????????????????????? */
.hover-card {
  transition: box-shadow .15s, transform .1s;
}
.hover-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,.12) !important;
}

/* ?? Navbar ????????????????????????????????????????????????? */
.navbar .nav-link.active {
  position: relative;
}
.navbar .nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}

/* ?? Flag icons sizing ?????????????????????????????????????? */
.fi {
  display: inline-block;
  border-radius: 2px;
}

/* ?? Grupos table (responsive) ?????????????????????????????? */
@media (max-width: 400px) {
  .table th, .table td {
    padding: 0.3rem 0.2rem;
    font-size: .75rem;
  }
}

/* ?? Utilidades ????????????????????????????????????????????? */
.text-white-75 { color: rgba(255,255,255,.75); }
.opacity-60 { opacity: .6; }
.rounded-4 { border-radius: 0.75rem !important; }
.rounded-5 { border-radius: 1rem !important; }

/* Tabla de grupos subtle highlight */
.table-success-subtle { background-color: rgba(5,150,105,.06) !important; }

/* ?? Spinner en bot?n guardar ??????????????????????????????? */
.btn-guardar-pron.loading .spinner-border,
.btn-guardar-resultado.loading .spinner-border {
  display: inline-block !important;
}
.btn-guardar-pron.loading,
.btn-guardar-resultado.loading {
  pointer-events: none;
  opacity: .75;
}

/* ?? Flash message animaci?n ???????????????????????????????? */
#global-flash.fade {
  animation: fadeOut .5s forwards;
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* -- Page title override ----------------------------------------- */
.page-title {
  letter-spacing: -0.02em;
}

/* -- Filtros sticky (fecha + proximos/jugados) ------------------- */
.filtros-sticky {
  margin-left: -0.75rem;
  margin-right: -0.75rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* Fila de fechas con scroll horizontal */
.date-scroll-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.date-scroll-row::-webkit-scrollbar { display: none; }

.date-btn {
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 500;
  text-decoration: none;
  color: #64748b;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  white-space: nowrap;
  transition: all .12s;
}
.date-btn:hover {
  border-color: #1a56db;
  color: #1a56db;
}
.date-btn.active {
  background: #1a56db;
  border-color: #1a56db;
  color: #fff;
  font-weight: 600;
}
.date-btn.today-btn {
  border-color: #f59e0b;
  color: #d97706;
}
.date-btn.today-btn.active {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}

/* -- Partido bloqueado ------------------------------------------- */
.partido-bloqueado {
  border-left: 3px solid #fbbf24 !important;
}

/* -- Reveal panel ----------------------------------------------- */
.btn-reveal {
  transition: all .15s;
}
.btn-reveal.open {
  background: #eff6ff;
  border-color: #1a56db;
  color: #1a56db;
}
.reveal-chevron {
  transition: transform .2s;
  flex-shrink: 0;
}
.btn-reveal.open .reveal-chevron {
  transform: rotate(90deg);
}
.reveal-list {
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.reveal-list::-webkit-scrollbar { width: 4px; }
.reveal-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* -- Avatares borde Ecuador (amarillo ? azul ? rojo) ------------ */
.avatar-ecuador {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(
    180deg,
    #fcdc00 0%,
    #fcdc00 33.33%,
    #003da5 33.33%,
    #003da5 66.66%,
    #ce1126 66.66%,
    #ce1126 100%
  );
  line-height: 0;
  flex-shrink: 0;
  vertical-align: middle;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
}

.avatar-ecuador-inner {
  border-radius: 50%;
  border: 2px solid #fff;
  box-sizing: border-box;
}

.avatar-ecuador-inner:not(.avatar-ecuador-initial) {
  display: block;
  object-fit: cover;
}

.avatar-ecuador-inner.avatar-ecuador-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  text-align: center;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-ecuador-initial {
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #1a56db, #1e3a8a);
  box-sizing: border-box;
}

/* Selector de avatar en perfil: borde selecci?n sobre el ring Ecuador */
.avatar-btn.selected .avatar-ecuador {
  box-shadow: 0 0 0 2px #1a56db;
}

.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0.65rem;
  justify-content: center;
  max-height: 320px;
  overflow-y: auto;
  padding: 0.25rem;
  scrollbar-width: thin;
}

.avatar-picker-grid::-webkit-scrollbar {
  width: 5px;
}

.avatar-picker-grid::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.avatar-picker-item .avatar-ecuador-inner {
  width: 56px;
  height: 56px;
}

.avatar-btn:hover .avatar-img {
  transform: scale(1.06);
}

/* -- Ranking ---------------------------------------------------- */
.ranking-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.ranking-my-card {
  background: linear-gradient(135deg, #1a56db 0%, #1e3a8a 100%);
  border-radius: 1rem;
  padding: 1rem 1.15rem;
  box-shadow: 0 4px 20px rgba(26, 86, 219, 0.25);
}

.ranking-my-stat {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
}

/* Podio */
.ranking-podium-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.85rem 0.5rem 0.75rem;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  transition: transform .15s;
}

.ranking-podium-card.is-me {
  box-shadow: 0 0 0 2px #1a56db, 0 4px 16px rgba(26,86,219,.15);
}

.podium-gold {
  background: linear-gradient(180deg, #fffbeb 0%, #fff 40%);
  border-color: #fcd34d;
}

.podium-silver {
  background: linear-gradient(180deg, #f8fafc 0%, #fff 40%);
  border-color: #cbd5e1;
}

.podium-bronze {
  background: linear-gradient(180deg, #fff7ed 0%, #fff 40%);
  border-color: #fdba74;
}

.podium-rank {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.podium-gold .podium-rank { color: #d97706; }
.podium-silver .podium-rank { color: #64748b; }
.podium-bronze .podium-rank { color: #c2410c; }

.podium-avatar {
  margin-bottom: 0.4rem;
}

.podium-avatar .avatar-ecuador-inner:not(.avatar-ecuador-initial) {
  display: block;
}

.podium-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #1e293b;
  max-width: 100%;
  line-height: 1.2;
}

.podium-pts {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1a56db;
  line-height: 1.1;
  margin-top: 0.15rem;
}

.podium-pts small {
  font-size: 0.65rem;
  font-weight: 600;
  color: #94a3b8;
}

.podium-mini-stats {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
}

.podium-mini-stats .stat-me {
  background: #059669;
  color: #fff;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.podium-mini-stats .stat-rc {
  background: #fbbf24;
  color: #1e293b;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.ranking-on-fire {
  display: inline-flex;
  align-items: center;
  color: #f97316;
  line-height: 1;
  animation: ranking-fire-pulse 1.4s ease-in-out infinite;
}

@keyframes ranking-fire-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.88; }
}

/* Tabla lista */
.ranking-table-card {
  box-shadow: 0 1px 8px rgba(0,0,0,.07);
}

.ranking-table-header {
  display: none;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ranking-row {
  display: grid;
  grid-template-columns: 40px 1fr 42px 42px 60px;
  gap: 0.5rem 0.65rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  background: #fff;
}

.ranking-row.has-border {
  border-top: 1px solid #f1f5f9;
}

.ranking-row.is-me {
  background: linear-gradient(90deg, #eff6ff 0%, #fff 100%);
  border-left: 3px solid #1a56db;
  padding-left: calc(0.85rem - 3px);
}

.ranking-row.rank-gold { background: linear-gradient(90deg, #fffbeb40 0%, #fff 60%); }
.ranking-row.rank-silver { background: linear-gradient(90deg, #f8fafc80 0%, #fff 60%); }
.ranking-row.rank-bronze { background: linear-gradient(90deg, #fff7ed50 0%, #fff 60%); }

.ranking-row.rank-gold.is-me,
.ranking-row.rank-silver.is-me,
.ranking-row.rank-bronze.is-me {
  background: linear-gradient(90deg, #eff6ff 0%, #fff 100%);
}

.col-rank {
  display: flex;
  align-items: center;
  justify-content: center;
}

.rank-medal-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.rank-medal-gold {
  background: linear-gradient(145deg, #fde047 0%, #f59e0b 100%);
  color: #78350f;
  border: 2px solid #fef3c7;
}

.rank-medal-silver {
  background: linear-gradient(145deg, #f1f5f9 0%, #94a3b8 100%);
  color: #1e293b;
  border: 2px solid #e2e8f0;
}

.rank-medal-bronze {
  background: linear-gradient(145deg, #fdba74 0%, #c2410c 100%);
  color: #fff;
  border: 2px solid #fed7aa;
}

.rank-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: #94a3b8;
}

.avatar-ecuador.ranking-avatar .avatar-ecuador-inner {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
}

.avatar-ecuador.ranking-avatar .avatar-ecuador-initial {
  font-size: 0.85rem;
}

.ranking-player-name {
  font-size: 0.88rem;
  line-height: 1.25;
}

.ranking-username {
  font-size: 0.72rem;
  line-height: 1.2;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.stat-pill-me {
  background: #059669;
  color: #fff;
}

.stat-pill-rc {
  background: #fbbf24;
  color: #1e293b;
}

.col-stat {
  justify-content: center;
  display: flex;
}

.col-pts {
  display: flex;
  justify-content: center;
  align-items: center;
}

.pts-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 0.35rem 0.45rem;
  border-radius: 0.65rem;
  line-height: 1;
}

.pts-badge-num {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.05;
}

.pts-badge-label {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.12rem;
  opacity: 0.92;
}

.pts-badge-gold {
  background: linear-gradient(145deg, #fbbf24 0%, #d97706 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.35);
}

.pts-badge-me {
  background: linear-gradient(145deg, #1a56db 0%, #1e3a8a 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(26, 86, 219, 0.3);
}

.pts-badge-default {
  background: #f8fafc;
  color: #1e293b;
  border: 1px solid #e2e8f0;
}

.pts-badge-default .pts-badge-label {
  color: #64748b;
}

.ranking-mobile-stats {
  display: flex;
  gap: 0.35rem;
}

.mini-stat {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.mini-me {
  background: #059669;
  color: #fff;
}

.mini-rc {
  background: #fbbf24;
  color: #1e293b;
}

.ranking-legend {
  background: #f8fafc;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* M?vil: grid simplificado */
@media (max-width: 575.98px) {
  .ranking-row {
    grid-template-columns: 38px 1fr 58px;
    gap: 0.4rem 0.5rem;
    padding: 0.65rem 0.75rem;
  }

  .rank-medal-circle {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
  }

  .pts-badge {
    min-width: 50px;
    padding: 0.3rem 0.4rem;
  }

  .pts-badge-num {
    font-size: 1.05rem;
  }

  .avatar-ecuador.ranking-avatar .avatar-ecuador-inner {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .avatar-ecuador.ranking-avatar .avatar-ecuador-initial {
    font-size: 0.8rem;
  }

  .ranking-player-name {
    font-size: 0.82rem;
  }

  .ranking-podium-card {
    padding: 0.65rem 0.35rem 0.55rem;
  }

  .podium-pts {
    font-size: 1.15rem;
  }

  .podium-name {
    font-size: 0.7rem;
  }
}

@media (min-width: 576px) {
  .ranking-table-header {
    display: grid;
    grid-template-columns: 40px 1fr 42px 42px 60px;
    gap: 0.5rem 0.65rem;
  }

  .ranking-table-header .col-rank,
  .ranking-table-header .col-stat,
  .ranking-table-header .col-pts {
    text-align: center;
  }
}

/* Marcador en vivo */
.badge-live-pulse {
  animation: live-pulse 1.4s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

.partido-en-vivo {
  border: 1px solid rgba(239, 68, 68, 0.45);
  box-shadow: 0 2px 14px rgba(239, 68, 68, 0.12);
}

.card-en-vivo-admin {
  background: linear-gradient(180deg, #fff5f5 0%, #fff 40%);
}

/* Flechas tendencia ranking */
.ranking-rank-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 40px;
}

.ranking-trend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.ranking-trend-up {
  color: #059669;
}

.ranking-trend-down {
  color: #dc2626;
}

.ranking-podium-card .ranking-trend {
  margin-bottom: 0.15rem;
}
