/* ==========================================================================
   AUDI PERÚ SIM CHALLENGE 2026 — COMPOSICIÓN DE PANTALLAS (APP)
   Capa 3: layout y patrones que combinan los componentes del design system.
   Usa 100% los tokens. Requiere: fonts.css, tokens.css, components.css.
   Mobile-first: el piloto usa el móvil en todo el flujo previo y en sede.
   ========================================================================== */

/* --------------------------------------------------------------------
   SHELL — contenedor móvil centrado
   -------------------------------------------------------------------- */
.app {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  margin: 0 auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
}

/* Fondo con textura sutil de pista (líneas diagonales muy tenues) */
body.app-bg {
  background:
    radial-gradient(circle at 50% -10%, rgba(245, 5, 55, 0.10), transparent 55%),
    var(--color-bg);
}

/* --------------------------------------------------------------------
   HEADER — logo + navegación de retroceso
   -------------------------------------------------------------------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  min-height: 32px;
}

.brand-logo {
  font-family: var(--font-display);
  font-weight: var(--font-weight-bold);
  font-size: var(--text-sm);
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-transform: none;
}
.brand-logo b { color: var(--color-heading); display: block; }
.brand-logo span { color: var(--color-text); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}
.back-link:hover { color: var(--color-text); text-decoration: none; }

/* --------------------------------------------------------------------
   SCREEN — bloque principal de contenido
   -------------------------------------------------------------------- */
.screen { flex: 1; display: flex; flex-direction: column; }

.screen__title {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2);
}

.screen__lead {
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-6);
}

/* Espaciador que empuja el pie/CTA hacia abajo */
.screen__spacer { flex: 1; min-height: var(--space-5); }

/* Pie de pantalla, normalmente el CTA principal */
.screen__footer {
  margin-top: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Utilidad de apilado vertical */
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--sm { gap: var(--space-2); }
.stack--lg { gap: var(--space-6); }

.text-center { text-align: center; }
.text-muted  { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }

/* --------------------------------------------------------------------
   STEPPER — indicador de fase del flujo
   -------------------------------------------------------------------- */
.stepper {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}
.stepper__dot {
  flex: 1;
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--color-border);
}
.stepper__dot--done   { background: var(--color-brand-red); }
.stepper__dot--active { background: var(--color-brand-red); box-shadow: var(--shadow-glow-red); }

/* --------------------------------------------------------------------
   FORMULARIO — .form/.form-row viven en components.css (compartidos)
   -------------------------------------------------------------------- */

/* .select vive en components.css (compartido) */

/* --------------------------------------------------------------------
   OAUTH — botón de proveedor (Google)
   -------------------------------------------------------------------- */
.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-5);
  background: var(--color-brand-white);
  color: #1A1A1D;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: var(--font-weight-bold);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease-standard);
}
.oauth-btn:hover { opacity: 0.9; }
.oauth-btn:active { transform: translateY(1px); }

/* --------------------------------------------------------------------
   DIVIDER — separador con etiqueta ("o")
   -------------------------------------------------------------------- */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* --------------------------------------------------------------------
   OTP — .otp/.otp__digit viven en components.css (compartidos)
   -------------------------------------------------------------------- */

/* .brevete*, .datalist*, .segmented*, .time-display viven en components.css (compartidos) */

/* --------------------------------------------------------------------
   LEADERBOARD — tabla de tiempos
   -------------------------------------------------------------------- */
.leaderboard { display: flex; flex-direction: column; }
.leaderboard__row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-bottom: var(--border-width) solid var(--color-border);
}
.leaderboard__row--head {
  padding-top: 0;
  padding-bottom: var(--space-2);
  border-bottom: var(--border-width-strong) solid var(--color-border-strong);
}
.leaderboard__row--me {
  background: rgba(245, 5, 55, 0.08);
  border-left: 3px solid var(--color-brand-red);
  border-radius: var(--radius-sm);
}
.leaderboard__rank {
  font-family: var(--font-display);
  font-weight: var(--font-weight-bold);
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  text-align: center;
}
.leaderboard__rank--medal { color: var(--color-brand-red); }
.leaderboard__pilot {
  font-family: var(--font-body);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  line-height: 1.2;
}
.leaderboard__meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.leaderboard__time {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

/* --------------------------------------------------------------------
   BANNER — CTA destacado (Gran Final)
   -------------------------------------------------------------------- */
.banner {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-brand-red), var(--color-brand-red-active));
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5);
  box-shadow: var(--shadow-glow-red);
}
.banner__title {
  font-family: var(--font-display);
  font-weight: var(--font-weight-bold);
  font-size: var(--text-xl);
  color: var(--color-brand-white);
  margin: 0 0 var(--space-2);
}
.banner__text {
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--text-sm);
  margin: 0;
}

/* --------------------------------------------------------------------
   HERO — sección de portada (landing)
   -------------------------------------------------------------------- */
.hero__kicker {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-brand-red);
  margin-bottom: var(--space-3);
}
.hero__title {
  font-size: var(--text-3xl);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-3);
}
.hero__title span { color: var(--color-text); }
.hero__sedes {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-5);
}

/* --------------------------------------------------------------------
   ICON CIRCLE — círculo de estado (éxito / error)
   -------------------------------------------------------------------- */
.status-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-5);
  font-size: var(--text-2xl);
}
.status-icon--success { background: rgba(46, 204, 113, 0.15); color: var(--color-success); }
.status-icon--error   { background: rgba(255, 59, 78, 0.15);  color: var(--color-error); }
.status-icon--pending { background: rgba(245, 166, 35, 0.15); color: var(--color-warning); }

/* --------------------------------------------------------------------
   PROTOTYPE NAV — índice de maqueta (solo para revisión, no producción)
   -------------------------------------------------------------------- */
.proto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-4);
}
.proto-frame {
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-elevated);
  transition: border-color var(--duration-base), transform var(--duration-base);
  display: block;
}
.proto-frame:hover { border-color: var(--color-brand-red); transform: translateY(-2px); text-decoration: none; }
.proto-frame iframe {
  width: 390px;
  height: 720px;
  border: none;
  transform: scale(0.385);
  transform-origin: top left;
  pointer-events: none;
  background: var(--color-bg);
}
.proto-frame__viewport { width: 100%; height: 277px; overflow: hidden; }
.proto-frame__label {
  padding: var(--space-3);
  border-top: var(--border-width) solid var(--color-border);
}
.proto-frame__label b { display: block; color: var(--color-text); font-family: var(--font-body); }
.proto-frame__label span { font-size: var(--text-xs); color: var(--color-text-muted); }
