/* ==========================================================================
   SCOUTMX - SISTEMA VISUAL Y TEMAS
   Tokens oficiales de MARCO_TEORICO_Y_ESPECIFICACION_TECNICA_SCOUTMX.md (Tabla 6.3)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400..700;1,9..40,400..700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  /* Tema por defecto: Negro OLED (oled) */
  --base: #080a0a;
  --panel: rgba(15, 18, 18, 0.68);
  --panel-dense: rgba(15, 18, 18, 0.92);
  --panel-solid: #151919;
  --stroke: rgba(255, 255, 255, 0.14);
  --stroke-subtle: rgba(255, 255, 255, 0.07);
  --accent: #c5fa58; /* Lima Neón contenido */
  --accent-ink: #121a00;
  --ink: #f7f8f8;
  --muted: #acb4b1;
  --soft: rgba(255, 255, 255, 0.06);
  --blue-mvp: #2563eb;
  --blue-mvp-glow: rgba(37, 99, 235, 0.45);
  --bg-filter: brightness(0.40) contrast(1.15) saturate(1.1);
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

[data-theme="titanium"] {
  /* Gris Titanio (titanium) */
  --base: #20242a;
  --panel: rgba(39, 45, 53, 0.72);
  --panel-dense: rgba(30, 36, 43, 0.93);
  --panel-solid: #303740;
  --stroke: rgba(255, 255, 255, 0.17);
  --stroke-subtle: rgba(255, 255, 255, 0.09);
  --accent: #8ae2ff; /* Azul Hielo técnico */
  --accent-ink: #041b24;
  --ink: #f4f7fa;
  --muted: #aab3be;
  --soft: rgba(255, 255, 255, 0.08);
  --blue-mvp: #0284c7;
  --blue-mvp-glow: rgba(2, 132, 199, 0.45);
  --bg-filter: brightness(0.50) contrast(1.1) grayscale(0.2);
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

[data-theme="light"] {
  /* Blanco Frosted (light) */
  --base: #eef1ed;
  --panel: rgba(252, 253, 251, 0.74);
  --panel-dense: rgba(255, 255, 255, 0.94);
  --panel-solid: #ffffff;
  --stroke: rgba(17, 31, 24, 0.12);
  --stroke-subtle: rgba(17, 31, 24, 0.06);
  --accent: #4a7f44; /* Verde Bosque sobrio */
  --accent-ink: #f8fff6;
  --ink: #17201d;
  --muted: #5e6f68;
  --soft: rgba(20, 37, 29, 0.06);
  --blue-mvp: #1d4ed8;
  --blue-mvp-glow: rgba(29, 78, 216, 0.3);
  --bg-filter: brightness(0.92) contrast(0.95) opacity(0.35);
  --shadow: 0 10px 24px rgba(20, 30, 24, 0.10);
}

/* ==========================================================================
   RESET Y BASE ERGONÓMICA
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--base);
  color: var(--ink);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
  transition: background-color 0.24s ease, color 0.24s ease;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Tipografía de encabezados */
h1, h2, h3, h4, .manrope {
  font-family: 'Manrope', sans-serif;
  letter-spacing: -0.04em;
}

/* Fondo Estadio Fijo (Sección 6.2 & Rúbrica B1 / V1) */
.bg-stadium {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url('../../public/images/stadium.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: var(--bg-filter);
  transform: scale(1.03);
  pointer-events: none;
}

/* Vignette de protección exacta de 6.2 */
.bg-vignette {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(8,10,10,0.52) 0%, rgba(8,10,10,0.86) 38%, rgba(8,10,10,0.98) 100%);
  pointer-events: none;
}

/* ==========================================================================
   SUPERFICIES FROSTED GLASS (Sección 6.2 & Rúbrica B1)
   ========================================================================== */

.glass-card {
  background: var(--panel);
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  border-radius: 24px;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s;
}

.glass-subcard {
  background: var(--soft);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--stroke-subtle);
  border-radius: 16px;
}

/* Contenedor móvil first */
.app-container {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 20px 100px 20px; /* 18-22px margen lateral */
  position: relative;
}

/* Header superior */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-top: 8px;
}

.brand-mark {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.06em;
}

.brand-mark span {
  color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.round-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.18s, background 0.18s;
}

.round-btn:active {
  transform: scale(0.92);
}

/* ==========================================================================
   BARRA DE NAVEGACIÓN FLOTANTE (Sección 6.5 & Rúbrica B3)
   4 ítems exactos: Mejores, Promesas, Clubes, Táctica. Sin emojis.
   ========================================================================== */

.bottom-nav {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 440px;
  height: 64px;
  background: var(--panel-dense);
  backdrop-filter: blur(28px) saturate(1.3);
  -webkit-backdrop-filter: blur(28px) saturate(1.3);
  border: 1px solid var(--stroke);
  border-radius: 24px;
  display: flex;
  flex-direction: row;
  align-items: center;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 8px;
  gap: 4px;
  z-index: 90;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}

.bottom-nav::-webkit-scrollbar {
  display: none;
}

.nav-item {
  flex: 0 0 auto;
  min-width: 58px;
  height: 52px;
  scroll-snap-align: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 9px;
  font-weight: 700;
  border-radius: 14px;
  cursor: pointer;
  padding: 4px 6px;
  white-space: nowrap;
  transition: color 0.18s, background 0.18s, transform 0.18s;
}

.nav-item.active {
  color: var(--accent);
  background: rgba(197, 250, 88, 0.14);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.active {
  color: var(--ink);
  background: var(--soft);
}

.nav-item.active svg {
  stroke: var(--accent);
}

.nav-item:active {
  transform: scale(0.94);
}

/* ==========================================================================
   BADGES Y MONOGRAMAS
   ========================================================================== */

.badge-mvp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-mvp);
  color: #ffffff;
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 8px var(--blue-mvp-glow);
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--stroke-subtle);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.badge-accent {
  background: rgba(197, 250, 88, 0.14);
  border-color: rgba(197, 250, 88, 0.28);
  color: var(--accent);
}

.club-monogram {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-content: center;
  background: var(--soft);
  border: 1px solid var(--stroke);
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink);
  flex-shrink: 0;
}

/* Calificaciones y círculos */
.rating-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: 10px;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 12px;
  border: 1px solid var(--stroke);
}

.rating-bubble.green {
  background: rgba(16, 185, 129, 0.18);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.35);
}

.rating-bubble.amber {
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.35);
}

.rating-bubble.red {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
}

.rating-bubble.mvp {
  background: var(--blue-mvp);
  color: #ffffff;
  border-color: #93c5fd;
  box-shadow: 0 0 12px var(--blue-mvp-glow);
}

/* ==========================================================================
   MODAL BOTTOM SHEET (Sección 6.6 & Rúbrica B4)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 100%);
  width: 100%;
  max-width: 440px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--panel-solid);
  border-top: 1px solid var(--stroke);
  border-radius: 28px 28px 0 0;
  padding: 16px 22px 40px 22px;
  z-index: 101;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .bottom-sheet {
  transform: translate(-50%, 0);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: var(--stroke);
  margin: 0 auto 16px auto;
}

/* ==========================================================================
   ANIMACIONES Y RESPONSIVIDAD (Rúbrica B5 a 390px)
   ========================================================================== */

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

.view-section {
  display: none;
  animation: fadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-section.active {
  display: block;
}

@media (max-width: 390px) {
  .app-container {
    padding-left: 16px;
    padding-right: 16px;
  }
  .bottom-nav {
    width: calc(100% - 24px);
  }
}
