/* =========================================================
   Predicciones Mundial By Nodria — Dark Premium UI
   Mobile-First · Neon Accents · Dixon-Coles v2
   ========================================================= */

/* ── Variables ── */
:root {
  --bg:       #07070f;
  --surface:  #0d0d1a;
  --card:     #111122;
  --card-h:   #14142a;
  --border:   #1c1c38;
  --border-g: rgba(0,255,136,.28);

  --green:    #00ff88;
  --cyan:     #00d4ff;
  --orange:   #ff6b35;
  --purple:   #9b59ff;
  --yellow:   #ffd700;

  --text:     #e8e8f5;
  --text-2:   #8888aa;
  --text-3:   #44446a;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;

  --shadow: 0 4px 28px rgba(0,0,0,.5);
  --glow-g: 0 0 22px rgba(0,255,136,.22);
  --glow-c: 0 0 22px rgba(0,212,255,.22);

  --t: .18s ease;
  --tm: .28s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Fondo ambiental */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 15% 8%,  rgba(0,255,136,.05) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 85% 92%, rgba(0,212,255,.04) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

#app {
  position: relative; z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

/* ── Header ── */
.header {
  position: sticky; top: 0; z-index: 100;
  padding: 16px 0;
  background: rgba(7,7,15,.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.hdr-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 11px;
}

.logo-ball {
  font-size: 1.9rem;
  animation: glow-ball 2.4s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(0,255,136,.6));
  line-height: 1;
}

@keyframes glow-ball {
  0%,100% { filter: drop-shadow(0 0 8px rgba(0,255,136,.6)); }
  50%      { filter: drop-shadow(0 0 18px rgba(0,255,136,.95)); }
}

.logo-words h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.15;
  background: linear-gradient(125deg, #fff 10%, var(--green) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-words small {
  display: block;
  font-size: .68rem;
  color: var(--text-2);
  letter-spacing: .07em;
  text-transform: uppercase;
}

.logo-words small strong { color: var(--green); }

.hdr-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  background: rgba(0,255,136,.07);
  border: 1px solid rgba(0,255,136,.18);
  border-radius: 100px;
  font-size: .72rem;
  color: var(--green);
  font-weight: 600;
  letter-spacing: .04em;
  white-space: nowrap;
}

.pulse-dot {
  width: 7px; height: 7px;
  background: var(--green);
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse-ring 1.6s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0   rgba(0,255,136,.8); }
  70%  { box-shadow: 0 0 0 9px rgba(0,255,136,0); }
  100% { box-shadow: 0 0 0 0   rgba(0,255,136,0); }
}

/* ── Sección título ── */
.sec-header { margin-bottom: 22px; }

.sec-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.sec-sub {
  display: block;
  font-size: .74rem;
  color: var(--text-3);
  font-family: 'Courier New', monospace;
  margin-top: 3px;
}

/* ── Grid de partidos ── */
.matches-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 32px;
}

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

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

/* ── Tarjeta de partido ── */
.match-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--tm), border-color var(--tm), box-shadow var(--tm);
  animation: slide-in .4s ease both;
}

.match-card::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  opacity: 0;
  transition: opacity var(--tm);
}

.match-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0,255,136,.3);
  box-shadow: var(--shadow), var(--glow-g);
  background: var(--card-h);
}

.match-card:hover::after { opacity: 1; }

.match-card.selected {
  border-color: var(--green) !important;
  box-shadow: var(--shadow), var(--glow-g) !important;
}

.match-card.selected::after { opacity: 1 !important; }

@keyframes slide-in {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.match-card:nth-child(1) { animation-delay: .04s; }
.match-card:nth-child(2) { animation-delay: .09s; }
.match-card:nth-child(3) { animation-delay: .14s; }
.match-card:nth-child(4) { animation-delay: .19s; }

/* Encabezado de la tarjeta */
.mc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.mc-stage {
  font-size: .68rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 500;
}

.mc-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.mc-kickoff {
  font-size: .88rem;
  font-weight: 700;
}

.mc-countdown {
  font-size: .68rem;
  color: var(--text-2);
  font-weight: 600;
}

.mc-countdown.urgent {
  color: var(--orange);
  animation: blink-orange 1s step-end infinite;
}

@keyframes blink-orange {
  50% { opacity: .45; }
}

/* Equipos */
.mc-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.mc-team {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mc-team-home { align-items: flex-start; }
.mc-team-away { align-items: flex-end; text-align: right; }

.mc-flag  { font-size: 1.9rem; line-height: 1; }
.mc-name  { font-size: .95rem; font-weight: 700; line-height: 1.2; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }

.badge-confirmed {
  background: rgba(0,255,136,.1);
  border: 1px solid rgba(0,255,136,.32);
  color: var(--green);
}
.badge-confirmed .badge-dot {
  background: var(--green);
  animation: pulse-ring .9s ease-in-out infinite;
}

.badge-probable {
  background: rgba(255,215,0,.07);
  border: 1px solid rgba(255,215,0,.22);
  color: var(--yellow);
}
.badge-probable .badge-dot { background: var(--yellow); }

.badge-live {
  background: rgba(255,107,53,.12);
  border: 1px solid rgba(255,107,53,.35);
  color: var(--orange);
}
.badge-live .badge-dot {
  background: var(--orange);
  animation: pulse-ring .7s ease-in-out infinite;
}

/* Centro: lambda + resultado top */
.mc-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.mc-lambda {
  display: flex;
  align-items: center;
  gap: 5px;
}

.lv {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: 'Space Grotesk', monospace;
  letter-spacing: -.04em;
}

.lv-home {
  color: var(--green);
  text-shadow: 0 0 14px rgba(0,255,136,.5);
}

.lv-away {
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(0,212,255,.5);
}

.lv-sep {
  font-size: 1.1rem;
  color: var(--text-3);
  font-style: italic;
  font-family: Georgia, serif;
}

.mc-top-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.mc-ts-label { font-size: .58rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.mc-ts-val   { font-size: 1.05rem; font-weight: 800; }
.mc-ts-prob  { font-size: .72rem; color: var(--orange); font-weight: 700; }

/* Métricas */
.mc-metrics {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.metric {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 7px;
}

.ml { font-size: .68rem; color: var(--text-2); }

.metric-bar {
  height: 4px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
  min-width: 48px;
}

.metric-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 1s ease;
}

.mv {
  font-size: .68rem;
  color: var(--text-2);
  font-weight: 700;
  min-width: 28px;
  text-align: right;
}

/* Barra W/D/L */
.wdl-bar {
  display: flex;
  height: 26px;
  border-radius: var(--r-sm);
  overflow: hidden;
  gap: 2px;
  margin-bottom: 5px;
}

.wdl-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
  font-weight: 800;
  min-width: 28px;
  transition: width .8s ease;
}

.wdl-home { background: rgba(0,255,136,.22); color: var(--green); border-radius: var(--r-sm) 0 0 var(--r-sm); }
.wdl-draw { background: rgba(255,215,0,.18); color: var(--yellow); }
.wdl-away { background: rgba(0,212,255,.22); color: var(--cyan); border-radius: 0 var(--r-sm) var(--r-sm) 0; }

.wdl-labels {
  display: flex;
  justify-content: space-between;
  font-size: .65rem;
  color: var(--text-3);
  margin-bottom: 14px;
}

/* Botones de la tarjeta */
.mc-footer {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.btn-heatmap, .btn-ia {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: var(--r-md);
  font-size: .74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t);
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: .02em;
}

.btn-heatmap {
  background: rgba(0,255,136,.09);
  color: var(--green);
  border: 1px solid rgba(0,255,136,.22);
}
.btn-heatmap:hover {
  background: rgba(0,255,136,.17);
  box-shadow: var(--glow-g);
}

.btn-ia {
  background: rgba(155,89,255,.09);
  color: var(--purple);
  border: 1px solid rgba(155,89,255,.22);
}
.btn-ia:hover {
  background: rgba(155,89,255,.17);
  box-shadow: 0 0 20px rgba(155,89,255,.25);
}

.mc-venue {
  font-size: .64rem;
  color: var(--text-3);
}

/* ── Lead Magnet ── */
.lead-magnet {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg,
    rgba(0,255,136,.07)  0%,
    rgba(0,212,255,.05) 50%,
    rgba(155,89,255,.05) 100%
  );
  border: 1px solid rgba(0,255,136,.22);
  border-radius: var(--r-xl);
  padding: 28px 22px 20px;
  margin: 8px 0 36px;
}

.lead-magnet::before {
  content: '';
  position: absolute; top: -1px; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--green), var(--cyan), transparent);
}

.lm-glow {
  position: absolute;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(0,255,136,.08), transparent 70%);
  top: -80px; right: -60px;
  pointer-events: none;
}

.lm-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
  position: relative;
}

@media (min-width: 600px) {
  .lm-body { flex-direction: row; align-items: center; }
}

.lm-icon {
  font-size: 2.6rem;
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px rgba(0,255,136,.55));
}

.lm-text { flex: 1; }

.lm-text h3 {
  font-size: 1.12rem;
  font-weight: 800;
  margin-bottom: 6px;
  background: linear-gradient(130deg, #fff 0%, var(--green) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.25;
}

.lm-text p {
  font-size: .86rem;
  color: var(--text-2);
  line-height: 1.55;
}

.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  background: linear-gradient(135deg, var(--green), #00cc66);
  color: #000;
  font-weight: 800;
  font-size: .88rem;
  text-decoration: none;
  border-radius: var(--r-md);
  white-space: nowrap;
  flex-shrink: 0;
  font-family: 'Space Grotesk', sans-serif;
  transition: transform var(--tm), box-shadow var(--tm);
  box-shadow: 0 4px 18px rgba(0,255,136,.35);
}

.btn-cta:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 28px rgba(0,255,136,.55);
}

.cta-arrow { transition: transform var(--t); }
.btn-cta:hover .cta-arrow { transform: translateX(4px); }

.lm-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
  position: relative;
}

.pill {
  padding: 4px 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 100px;
  font-size: .72rem;
  color: var(--text-2);
}

/* ── Heatmap ── */
.hm-section { margin-bottom: 40px; }

.hm-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  overflow: hidden;
}

.hm-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

@media (min-width: 640px) {
  .hm-header { flex-direction: row; align-items: flex-start; justify-content: space-between; }
}

.hm-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.hm-subtitle-match {
  font-size: .85rem;
  color: var(--text-2);
  font-weight: 400;
}

.hm-subtitle {
  font-size: .72rem;
  color: var(--text-3);
  font-family: 'Courier New', monospace;
  margin-top: 5px;
  line-height: 1.7;
}

/* WDL compacto en heatmap */
.hm-wdl-summary {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.hm-wdl-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  min-width: 58px;
}

.hm-wdl-home { background: rgba(0,255,136,.1);  border: 1px solid rgba(0,255,136,.2);  }
.hm-wdl-draw { background: rgba(255,215,0,.08); border: 1px solid rgba(255,215,0,.18); }
.hm-wdl-away { background: rgba(0,212,255,.1);  border: 1px solid rgba(0,212,255,.2);  }

.hm-wdl-pct  {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
}
.hm-wdl-home .hm-wdl-pct { color: var(--green); }
.hm-wdl-draw .hm-wdl-pct { color: var(--yellow); }
.hm-wdl-away .hm-wdl-pct { color: var(--cyan); }

.hm-wdl-label {
  font-size: .6rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 2px;
}

/* Grilla */
.hm-wrapper {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.hm-y-label {
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  font-size: .65rem;
  color: var(--text-3);
  text-align: center;
  align-self: center;
  flex-shrink: 0;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.hm-inner { flex: 1; min-width: 0; }

.hm-grid {
  display: grid;
  gap: 3px;
}

.hm-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .64rem;
  font-weight: 700;
  position: relative;
  min-width: 42px;
  min-height: 42px;
  transition: transform .1s, box-shadow .1s;
}

.hm-corner   { background: transparent; }
.hm-axis-top { background: var(--surface); color: var(--text-2); font-size: .72rem; }
.hm-axis-left{ background: var(--surface); color: var(--text-2); font-size: .72rem; }

.hm-data { cursor: crosshair; user-select: none; }

.hm-top {
  border: 2px solid var(--green) !important;
  box-shadow: 0 0 14px rgba(0,255,136,.5) !important;
  z-index: 2;
}

.hm-pct  { font-size: .58rem; }

.hm-star {
  position: absolute;
  top: 2px; right: 3px;
  font-size: .55rem;
  color: var(--green);
  line-height: 1;
}

.hm-x-label {
  font-size: .65rem;
  color: var(--text-3);
  text-align: center;
  margin-top: 7px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.hm-legend { margin-top: 16px; }

.hm-legend-bar {
  height: 7px;
  border-radius: 100px;
  background: linear-gradient(90deg,
    #0d1117, #1a0a2e, #0d2442, #0a3020, #00e872, #00ff88
  );
  margin-bottom: 5px;
}

.hm-legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: .64rem;
  color: var(--text-3);
}

.hm-note {
  font-size: .64rem;
  color: var(--text-3);
  text-align: center;
  margin-top: 12px;
  font-style: italic;
}

/* ── Modal IA ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade-in .2s ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px 24px;
  width: 100%;
  max-width: 520px;
  position: relative;
  animation: slide-up .24s ease;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes slide-up {
  from { transform: translateY(22px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 50%;
  cursor: pointer;
  font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t);
}

.modal-close:hover { color: var(--text); border-color: var(--green); }

.modal-head {
  text-align: center;
  margin-bottom: 22px;
}

.modal-icon { font-size: 2.4rem; display: block; margin-bottom: 8px; }

.modal-head h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.modal-head p { font-size: .85rem; color: var(--text-2); }

/* Loading spinner */
.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 0;
}

.ai-spin {
  width: 38px; height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

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

.ai-loading p { font-size: .82rem; color: var(--text-2); text-align: center; }

/* Análisis IA */
.ai-section { margin-bottom: 16px; }

.ai-section h4 {
  font-size: .85rem;
  color: var(--green);
  margin-bottom: 6px;
  font-weight: 700;
}

.ai-section p, .ai-section li {
  font-size: .83rem;
  color: var(--text-2);
  line-height: 1.6;
}

.ai-section ul { padding-left: 18px; }
.ai-section li { margin-bottom: 4px; }

.ai-badge-mock {
  margin-top: 18px;
  padding: 9px 14px;
  background: rgba(255,107,53,.07);
  border: 1px solid rgba(255,107,53,.2);
  border-radius: var(--r-sm);
  font-size: .72rem;
  color: var(--orange);
  text-align: center;
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 22px 0;
  text-align: center;
  font-size: .74rem;
  color: var(--text-3);
  line-height: 1.9;
}

.footer strong { color: var(--green); }

/* ── Placeholder heatmap vacío ── */
.hm-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 52px 20px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
  color: var(--text-3);
  font-size: .85rem;
  text-align: center;
}

.hm-placeholder span { font-size: 2.2rem; }

/* ── Mobile ajustes ── */
@media (max-width: 420px) {
  .logo-words h1 { font-size: 1.05rem; }
  .hdr-badge span:not(.pulse-dot) { display: none; }
  .lv { font-size: 1.15rem; }
  .mc-flag { font-size: 1.5rem; }
  .mc-name { font-size: .82rem; }
  .hm-cell { min-width: 34px; min-height: 34px; }
  .hm-pct { font-size: .5rem; }
}
