/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f5f5f7;
  --surface:   #ffffff;
  --surface2:  #f0f2f5;
  --border:    #d1d5db;
  --accent:    #111827;
  --accent2:   #374151;
  --muted:     #9ca3af;
  --disabled:  #e5e7eb;
  --disabled-t:#a0aec0;
  --green:     #16a34a;
  --blue:      #2563eb;
  --text:      #111827;
  --text2:     #6b7280;
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.10);
  --transition: 0.18s ease;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 56px;
}

/* ── Screens ──────────────────────────────────────────────────── */
.screen {
  display: none;
  width: 100%;
  max-width: 600px;
  animation: fadeIn 0.22s ease;
}
.screen.active { display: block; }

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

/* ── Header ───────────────────────────────────────────────────── */
.header {
  width: 100%;
  max-width: 600px;
  padding: 20px 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-back {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 50%;
  min-width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: var(--transition);
  font-size: 20px;
  box-shadow: var(--shadow);
}
.btn-back:hover { background: var(--surface2); color: var(--text); }
.progress-bar {
  flex: 1; height: 4px;
  background: var(--surface2); border-radius: 99px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 99px; transition: width 0.35s ease;
}
.step-label { font-size: 12px; color: var(--text2); white-space: nowrap; font-weight: 500; }

/* ── Landing ──────────────────────────────────────────────────── */
.landing { padding-top: 64px; text-align: center; }
.landing-logo-wrap { margin-bottom: 28px; display: flex; justify-content: center; }
.landing-logo-img { height: 56px; object-fit: contain; }
.landing-tagline {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--green); font-weight: 600;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 99px; padding: 5px 14px; margin-bottom: 24px;
}
.landing h1 {
  font-size: clamp(26px, 5vw, 38px); font-weight: 700;
  line-height: 1.2; margin-bottom: 12px; letter-spacing: -0.5px;
}
.landing p { font-size: 16px; color: var(--text2); margin-bottom: 40px; line-height: 1.5; }

/* ── Botones ──────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 600;
  padding: 14px 32px; border-radius: 99px;
  border: none; cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
.btn-primary:hover { background: var(--accent2); transform: scale(1.02); }
.btn-primary:active { transform: scale(0.98); }
.btn-xl { padding: 17px 44px; font-size: 17px; }
.btn-block { width: 100%; justify-content: center; margin-bottom: 4px; }

/* ── Formulario ───────────────────────────────────────────────── */
.screen-title { font-size: 24px; font-weight: 700; margin-bottom: 6px; margin-top: 4px; }
.screen-subtitle { font-size: 14px; color: var(--text2); margin-bottom: 28px; line-height: 1.5; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text2); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px;
}
.form-group input {
  width: 100%; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; color: var(--text); font-size: 16px;
  outline: none; transition: var(--transition);
}
.form-group input:focus { border-color: var(--accent); }
.form-group input::placeholder { color: var(--muted); }
.form-note { font-size: 12px; color: var(--muted); margin-bottom: 24px; line-height: 1.5; }
.skip-link { color: var(--text2); text-decoration: underline; cursor: pointer; font-size: 14px; }

/* ── Marcas ───────────────────────────────────────────────────── */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px; margin-top: 8px;
}
.brand-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  transition: var(--transition); overflow: hidden; text-align: center;
  box-shadow: var(--shadow);
}
.brand-card:hover {
  border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-md);
}
.brand-card:active { transform: scale(0.97); }
.brand-logo-area {
  height: 110px; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: #fafafa; border-bottom: 1px solid var(--border);
}
.brand-icon { height: 44px; width: auto; object-fit: contain; }
.brand-icon-lg { height: 56px; }
.brand-name { padding: 11px 12px 15px; font-size: 15px; font-weight: 600; }

/* ── Series ───────────────────────────────────────────────────── */
.series-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-top: 8px;
}
.series-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  transition: var(--transition); overflow: hidden;
  text-align: center; box-shadow: var(--shadow);
}
.series-card:hover:not(.disabled) {
  border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-md);
}
.series-card:active:not(.disabled) { transform: scale(0.97); }
.series-card.disabled { opacity: 0.42; cursor: not-allowed; }
.series-img-wrap {
  background: #f8f9fa; height: 170px;
  display: flex; align-items: center; justify-content: center;
  padding: 12px; overflow: hidden;
}
.series-img {
  max-height: 148px; max-width: 100%;
  object-fit: contain; display: block;
  transition: transform 0.3s ease;
}
.series-card:hover:not(.disabled) .series-img { transform: scale(1.07); }
.series-img-fallback { width: 52px; opacity: 0.18; }
.series-label {
  padding: 10px 8px 14px; font-size: 13px;
  font-weight: 600; line-height: 1.3;
  border-top: 1px solid var(--border);
}
.tag-sin-stock { display: block; font-size: 10px; color: var(--muted); font-weight: 400; margin-top: 2px; }

/* ══════════════════════════════════════════════════════
   RESULTADOS — Layout 2 columnas (tablet) / 1 columna (mobile)
   ══════════════════════════════════════════════════════ */
.results-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.results-col-left {
  /* mobile: compacto */
}

.results-col-right {
  /* mobile: debajo de la imagen */
}

/* Imagen del producto */
.product-hero {
  width: 100%;
  min-height: 260px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #eef2ff 0%, #f8faff 50%, #fdf2ff 100%);
  border: 1.5px solid var(--border);
  overflow: hidden; margin-top: 8px;
}
.product-hero-img {
  max-height: 240px; max-width: 210px;
  object-fit: contain; display: block;
  filter: drop-shadow(0 16px 40px rgba(0,0,0,0.14));
  animation: floatPhone 4s ease-in-out infinite;
}
.result-phone-svg { width: 80px; opacity: 0.15; }
@keyframes floatPhone {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.product-title-block { padding: 14px 0 4px; text-align: center; }
.product-name { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }

/* Price summary (visible on tablet left column) */
.price-summary { display: none; }

/* ── Selectores ───────────────────────────────────────────────── */
.selector-section {
  padding: 16px 0;
  border-top: 1.5px solid var(--border);
  margin-top: 4px;
}
.selector-label {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text2); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}

/* Capacidad pills */
.cap-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.cap-btn {
  position: relative;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 18px;
  font-size: 15px; font-weight: 600; color: var(--text);
  cursor: pointer; transition: var(--transition);
  min-width: 80px; text-align: center;
  box-shadow: var(--shadow);
}
.cap-btn:hover:not(.no-stock) { border-color: var(--accent); box-shadow: var(--shadow-md); }
.cap-btn.selected {
  background: var(--accent); color: #fff;
  border-color: var(--accent); box-shadow: var(--shadow-md);
}
.cap-btn.no-stock {
  color: var(--disabled-t);
  background: var(--disabled); border-color: var(--disabled);
  cursor: not-allowed; text-decoration: line-through;
  box-shadow: none; opacity: 0.55;
}

/* Grado cards */
.grado-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.grado-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 12px 14px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: var(--transition); min-width: 80px;
  box-shadow: var(--shadow); text-align: center;
}
.grado-btn:hover:not(.no-stock) { border-color: var(--accent); box-shadow: var(--shadow-md); }
.grado-btn.selected {
  background: var(--accent); color: #fff;
  border-color: var(--accent); box-shadow: var(--shadow-md);
}
.grado-btn.no-stock {
  color: var(--disabled-t); background: var(--disabled);
  border-color: var(--disabled); cursor: not-allowed; opacity: 0.5;
  box-shadow: none;
}
.grado-icon { font-size: 20px; line-height: 1; }
.grado-label { font-size: 12px; font-weight: 600; white-space: nowrap; }

/* Color picker */
.color-picker-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.color-name-badge {
  color: var(--text); text-transform: none;
  font-weight: 500; font-size: 13px;
  letter-spacing: 0; text-transform: none;
}
.color-dot {
  width: 38px; height: 38px; border-radius: 50%;
  cursor: pointer; border: 2.5px solid transparent;
  transition: var(--transition); flex-shrink: 0;
  position: relative; box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.color-dot:hover:not(.no-stock) { transform: scale(1.12); }
.color-dot.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(17,24,39,0.18);
}
.color-dot.no-stock { opacity: 0.28; cursor: not-allowed; }
.color-dot[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 8px);
  left: 50%; transform: translateX(-50%);
  background: #1a1a1a; color: #fff;
  font-size: 11px; padding: 4px 10px;
  border-radius: 6px; white-space: nowrap;
  pointer-events: none; z-index: 20;
}
.color-chip {
  height: 38px; padding: 0 16px; border-radius: 99px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 13px;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center;
}
.color-chip:hover:not(.no-stock) { border-color: var(--accent); }
.color-chip.selected { border-color: var(--accent); background: var(--accent); color: #fff; }
.color-chip.no-stock { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }

/* ── Precio ───────────────────────────────────────────────────── */
.price-block {
  text-align: center; padding: 20px 0 12px;
  border-top: 1.5px solid var(--border);
}
.price-main {
  font-size: 58px; font-weight: 800;
  letter-spacing: -2px; line-height: 1; color: var(--text);
}
.price-currency {
  font-size: 26px; font-weight: 400; color: var(--text2);
  vertical-align: super; margin-right: 2px;
}
.price-installments { font-size: 14px; color: var(--text2); margin-top: 6px; }
.price-installments span { color: var(--green); font-weight: 600; }

/* ── Métodos de pago ──────────────────────────────────────────── */
.payment-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  margin-bottom: 20px; box-shadow: var(--shadow);
}
.payment-card-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text2);
  padding: 13px 18px 11px; border-bottom: 1.5px solid var(--border);
  background: var(--surface2);
}
.pay-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; }
.pay-left { display: flex; align-items: center; gap: 14px; }
.pay-icon { font-size: 22px; width: 32px; text-align: center; flex-shrink: 0; }
.pay-label { font-size: 14px; font-weight: 500; color: var(--text); }
.pay-sublabel { font-size: 11px; color: var(--text2); margin-top: 2px; }
.pay-price { font-size: 16px; font-weight: 700; white-space: nowrap; }
.pay-consultar { font-size: 13px; font-weight: 500; color: var(--blue); }
.pay-divider { height: 1px; background: var(--border); margin: 0 18px; }

/* ── Misc ─────────────────────────────────────────────────────── */
.result-empty { text-align: center; padding: 48px 16px; color: var(--text2); }
.result-empty .empty-icon { font-size: 40px; margin-bottom: 12px; }
.result-empty p { font-size: 14px; line-height: 1.6; }

.loading-wrap {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 64px 0; color: var(--text2); font-size: 14px;
}
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--border);
  border-top-color: var(--text2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg {
  background: #fef2f2; border: 1px solid #fecaca;
  border-radius: var(--radius-sm); padding: 12px 16px;
  font-size: 13px; color: #dc2626;
}

.btn-restart {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1.5px solid var(--border);
  color: var(--text2); font-size: 14px; font-weight: 500;
  padding: 12px 24px; border-radius: 99px;
  cursor: pointer; transition: var(--transition); margin-top: 4px;
}
.btn-restart:hover { border-color: var(--accent); color: var(--text); }

#bottom-nav {
  width: 100%; max-width: 600px;
  padding: 16px 0 0; border-top: 1.5px solid var(--border); margin-top: 16px;
}
.btn-volver {
  background: none; border: none; color: var(--text2);
  font-size: 15px; font-weight: 500; cursor: pointer;
  padding: 8px 0; display: flex; align-items: center; gap: 6px;
  transition: var(--transition);
}
.btn-volver:hover { color: var(--text); }

/* ════════════════════════════════════════════════════
   TABLET / iPAD (≥ 768px) — Pantalla completa
   ════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  #app { padding: 0 32px 64px; }

  /* Sin límite de ancho en tablet */
  .screen,
  .header,
  #bottom-nav { max-width: 100%; }

  /* Grids de 3 columnas en tablet */
  .brand-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .series-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .brand-logo-area { height: 120px; }
  .series-img-wrap { height: 190px; }

  /* Resultados: 2 columnas */
  .results-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 32px;
    align-items: start;
  }
  .results-col-left {
    position: sticky;
    top: 24px;
  }
  .product-hero { min-height: 320px; }
  .product-hero-img { max-height: 290px; }
  .product-title-block { text-align: center; padding-bottom: 12px; }
  .product-name { font-size: 20px; }
  /* Mostrar precio en columna izquierda en desktop */
  .price-summary {
    display: block;
    text-align: center;
    margin-top: 8px;
  }
  .price-summary-val {
    font-size: 32px; font-weight: 800; letter-spacing: -1px;
  }
  /* Precio principal en columna derecha más compacto en tablet */
  .price-block { padding: 14px 0 10px; }
  .price-main { font-size: 48px; }

  /* Tap targets más grandes en tablet */
  .cap-btn { padding: 16px 22px; font-size: 16px; min-width: 90px; }
  .grado-btn { padding: 14px 18px; min-width: 90px; }
  .color-dot { width: 44px; height: 44px; }
  .btn-back { min-width: 48px; height: 48px; font-size: 22px; }
}

/* ════════════════════════════════════════════════════
   DESKTOP (≥ 1024px)
   ════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  #app { padding: 0 48px 80px; max-width: 1200px; margin: 0 auto; }
  .brand-grid { grid-template-columns: repeat(4, 1fr); }
  .series-grid { grid-template-columns: repeat(4, 1fr); }
  .results-layout { grid-template-columns: 380px 1fr; gap: 48px; }
  .product-hero { min-height: 360px; }
  .product-hero-img { max-height: 330px; }
  .price-main { font-size: 52px; }
  .landing h1 { font-size: 44px; }
}
