/* ============================================================
   CazaOfertas — estilos v5. Mobile-first, sin frameworks.
   ============================================================ */

:root {
  --naranja: #ff9900;
  --naranja-oscuro: #e88b00;
  --marino: #131921;
  --marino-claro: #232f3e;
  --fondo: #f5f6f8;
  --tarjeta: #ffffff;
  --texto: #1a1a1a;
  --texto-suave: #5a5a5a;
  --borde: #e3e6ea;
  --radio: 12px;
  --sombra: 0 2px 10px rgba(0, 0, 0, 0.07);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

.contenedor {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Encabezado ---------- */
.encabezado {
  background: var(--marino);
  color: #fff;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.encabezado .contenedor {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
  text-decoration: none;
}

.logo span { color: var(--naranja); }

.nav a {
  color: #d5d9dd;
  text-decoration: none;
  font-size: 0.92rem;
  margin-left: 18px;
}

.nav a:hover { color: #fff; }

/* ---------- Botón hamburguesa ---------- */
.menu-boton {
  display: none;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 10px;
  min-width: 48px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.menu-boton:hover { background: rgba(255, 255, 255, 0.08); }

@media (max-width: 639px) {
  .menu-boton { display: inline-flex; }

  .encabezado .contenedor { flex-wrap: wrap; }

  .nav {
    flex-basis: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease;
  }

  .nav.abierto { max-height: 260px; }

  .nav a {
    margin: 0;
    padding: 14px 4px;
    font-size: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--marino) 0%, var(--marino-claro) 60%, #2e3d52 100%);
  color: #fff;
  text-align: center;
  padding: 56px 16px 64px;
}

.hero h1 {
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.hero h1 span { color: var(--naranja); }

.hero p {
  color: #c9d1d9;
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto 26px;
}

.boton {
  display: inline-block;
  background: var(--naranja);
  color: #1a1a1a;
  font-weight: 700;
  text-decoration: none;
  padding: 13px 30px;
  border-radius: 999px;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.boton:hover { background: var(--naranja-oscuro); }
.boton:active { transform: scale(0.97); }

/* ---------- Secciones ---------- */
.seccion { padding: 44px 0 8px; }

.seccion h2 {
  font-size: 1.5rem;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}

.subtitulo {
  color: var(--texto-suave);
  margin-bottom: 20px;
  font-size: 0.98rem;
}

/* ---------- Buscador (fijo en el encabezado) ---------- */
.buscador {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 3px 8px 3px 14px;
  flex: 1;
  min-width: 0;
  max-width: 520px;
  margin: 0 22px;
}

.buscador:focus-within {
  border-color: var(--naranja);
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.25);
}

.buscador svg {
  color: rgba(255, 255, 255, 0.65);
  flex-shrink: 0;
}

.buscador input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 9px 8px 9px 0;
  color: #fff;
}

.buscador input::placeholder { color: rgba(255, 255, 255, 0.55); }

/* En móvil el buscador ocupa su propia fila debajo del logo */
@media (max-width: 639px) {
  .buscador {
    flex-basis: 100%;
    max-width: none;
    margin: 10px 0 0;
    order: 3;
  }

  .nav { order: 4; }
}

/* ---------- Botón de tema claro/oscuro ---------- */
.acciones {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.tema-boton {
  display: inline-flex;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 10px;
  min-width: 48px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.tema-boton:hover { background: rgba(255, 255, 255, 0.08); }

.tema-boton .icono-sol { display: none; }
[data-theme="dark"] .tema-boton .icono-sol { display: block; }
[data-theme="dark"] .tema-boton .icono-luna { display: none; }

/* ---------- Modo oscuro ---------- */
[data-theme="dark"] {
  --fondo: #0e1319;
  --tarjeta: #1a2230;
  --texto: #e9edf2;
  --texto-suave: #9aa7b5;
  --borde: #2b3546;
  --sombra: 0 2px 12px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

[data-theme="dark"] .acordeon-boton:hover { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .acordeon-cuenta { background: #2b3546; color: #c9d1d9; }
[data-theme="dark"] .etiqueta { background: #2b3546; color: #c9d1d9; }
[data-theme="dark"] .disclosure { background: #241d10; border-color: #5a4a22; color: #e3d3a3; }
[data-theme="dark"] .disclosure strong { color: #f0dfae; }

.contador {
  color: var(--texto-suave);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

/* ---------- Destacados: carrusel horizontal ---------- */
.destacados { padding: 30px 0 6px; }

.destacados h2 {
  font-size: 1.5rem;
  letter-spacing: -0.3px;
}

.carrusel-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.carrusel-flechas { display: none; gap: 8px; }

@media (min-width: 640px) {
  .carrusel-flechas { display: flex; }
}

.flecha {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--borde);
  background: var(--tarjeta);
  color: var(--texto);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--sombra);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.flecha:hover { border-color: var(--naranja); color: var(--naranja); }

.carrusel {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 16px 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.carrusel .tarjeta {
  flex: 0 0 78%;
  max-width: 340px;
  scroll-snap-align: start;
}

@media (min-width: 640px) {
  .carrusel .tarjeta { flex-basis: 320px; }
}

.puntos {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 2px 0 10px;
}

.punto {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: none;
  padding: 0;
  background: var(--borde);
  cursor: pointer;
  transition: width 0.2s ease, background 0.2s ease;
}

.punto.activo { width: 26px; background: var(--naranja); }

/* Durante la búsqueda se ocultan héroe y categorías: solo resultados */
body.buscando .hero,
body.buscando #categorias { display: none; }

/* Que los anclajes no queden tapados por el header fijo */
section[id] { scroll-margin-top: 150px; }

/* ---------- Acordeón de categorías ---------- */
.acordeon { padding-bottom: 8px; }

.acordeon-categoria {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  margin-bottom: 12px;
  overflow: hidden;
}

.acordeon-boton {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 16px 18px;
  min-height: 62px;
  font-family: inherit;
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--texto);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.acordeon-boton:hover { background: #fafbfc; }

.acordeon-cuenta {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--texto-suave);
  background: #eef1f5;
  border-radius: 999px;
  padding: 3px 10px;
}

.acordeon-boton .chevron {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--texto-suave);
  transition: transform 0.25s ease;
}

.acordeon-categoria.abierto .acordeon-boton .chevron { transform: rotate(180deg); }

.acordeon-cuerpo {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}

.acordeon-categoria.abierto .acordeon-cuerpo { grid-template-rows: 1fr; }

.acordeon-interior {
  overflow: hidden;
  min-height: 0;
}

.acordeon-interior.grid { padding: 2px 18px 20px; }

/* ---------- Grid de ofertas ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding-bottom: 8px;
}

.tarjeta {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tarjeta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}

.etiqueta {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--marino-claro);
  background: #eef1f5;
  border-radius: 6px;
  padding: 4px 10px;
  margin-bottom: 10px;
}

.tarjeta h3 {
  font-size: 1.08rem;
  line-height: 1.35;
  margin-bottom: 8px;
}

.tarjeta p {
  color: var(--texto-suave);
  font-size: 0.93rem;
  flex-grow: 1;
  margin-bottom: 16px;
}

.tarjeta .foto {
  width: 100%;
  height: 160px;
  object-fit: contain;
  background: #ffffff;
  border-radius: calc(var(--radio) - 4px);
  margin-bottom: 12px;
}

.precio-linea {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.precio-linea .precio {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--naranja-oscuro);
}

.precio-linea .verificado {
  font-size: 0.75rem;
  color: var(--texto-suave);
}

.tarjeta .boton {
  text-align: center;
  font-size: 0.95rem;
  padding: 11px 20px;
}

.vacio {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--texto-suave);
  padding: 40px 0;
}

/* ---------- Cómo funciona ---------- */
.pasos {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding-bottom: 8px;
}

.paso {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 22px 20px;
}

.paso-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--naranja);
  color: #1a1a1a;
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.paso h3 { font-size: 1.05rem; margin-bottom: 6px; }
.paso p { color: var(--texto-suave); font-size: 0.93rem; }

/* ---------- Disclosure ---------- */
.disclosure {
  background: #fff8e8;
  border: 1px solid #f0dcae;
  border-radius: var(--radio);
  padding: 22px 20px;
  margin: 40px 0 8px;
  font-size: 0.9rem;
  color: #5c4a1e;
}

.disclosure strong { display: block; margin-bottom: 6px; color: #4a3a14; }

/* ---------- Footer ---------- */
.pie {
  background: var(--marino);
  color: #9aa3ad;
  margin-top: 48px;
  padding: 30px 0;
  font-size: 0.88rem;
}

.pie .contenedor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pie a { color: #c9d1d9; }
.pie .marca { color: #fff; font-weight: 700; }

/* ---------- Tablet y escritorio ---------- */
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .pasos { grid-template-columns: repeat(3, 1fr); }
  .hero h1 { font-size: 2.5rem; }
}

@media (min-width: 960px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .pie .contenedor { flex-direction: row; justify-content: space-between; align-items: center; }
}
