/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1a1d24;
  --text-muted: #5a6170;
  --border: #e3e6ec;
  --accent: #2f6feb;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fe;
  --oferta: #e0663e;
  --exito: #22a06b;
  --radio: 12px;
  --sombra: 0 1px 2px rgba(20,20,40,.04), 0 8px 24px rgba(20,20,40,.06);
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --display: 'Manrope', var(--sans);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141a;
    --surface: #191c24;
    --text: #eef0f4;
    --text-muted: #9aa2b1;
    --border: #2a2e38;
    --accent: #6d97f5;
    --accent-ink: #0d1220;
    --accent-soft: #1c2740;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { font-family: var(--display); text-wrap: balance; line-height: 1.15; font-weight: 800; }
ul, ol { list-style: none; padding: 0; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* =============================================================
   3. Utilities
   ============================================================= */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem;
  background: var(--accent); color: var(--accent-ink); z-index: 9999;
  border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.container { max-width: 1180px; margin-inline: auto; padding-inline: 1.25rem; }
.seccion { padding-block: 2.5rem; }
.nota { color: var(--text-muted); font-size: .875rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .75rem 1.4rem; border-radius: 999px; font-weight: 700;
  transition: transform .15s var(--ease-out), background .15s var(--ease-out);
}
.btn:hover { transform: translateY(-1px); }
.btn-primario { background: var(--accent); color: var(--accent-ink); }
.btn-secundario { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-pequeno { padding: .45rem .9rem; font-size: .8rem; }

/* =============================================================
   4. Header / nav
   ============================================================= */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 100; }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; padding-block: .9rem; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-family: var(--display); font-weight: 800; font-size: 1.15rem; }
.nav-principal { display: none; align-items: center; gap: 1.4rem; }
.nav-principal a { font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.nav-principal a:hover { color: var(--text); }
.nav-principal a.nav-cta, .nav-principal a.nav-cta:hover {
  background: var(--accent); color: var(--accent-ink); padding: .55rem 1.1rem; border-radius: 999px;
}
.nav-toggle { display: flex; flex-direction: column; gap: 4px; padding: .5rem; }
.nav-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; }

@media (min-width: 960px) {
  .nav-toggle { display: none; }
  .nav-principal { display: flex; }
}
.nav-principal.is-open {
  display: flex; position: absolute; top: 100%; left: 0; right: 0;
  flex-direction: column; align-items: flex-start; background: var(--surface);
  border-bottom: 1px solid var(--border); padding: 1rem 1.25rem; gap: 1rem;
}

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding-block: 3.5rem 2.5rem; background: linear-gradient(180deg, var(--accent-soft), transparent); }
.hero-inner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1.1rem; }
.hero-title { font-size: clamp(2.1rem, 5vw, 3.2rem); max-width: 16ch; }
.hero-sub { color: var(--text-muted); max-width: 46ch; }
.hero-buscador { display: flex; gap: .5rem; width: 100%; max-width: 480px; }
.hero-buscador input { flex: 1; padding: .8rem 1rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.hero-links { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.hero-links a { font-size: .85rem; padding: .4rem .9rem; border: 1px solid var(--border); border-radius: 999px; color: var(--text-muted); }
.hero-links a:hover { color: var(--text); border-color: var(--accent); }

/* =============================================================
   6. Secciones comunes
   ============================================================= */
.seccion-cabecera { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.ver-todos { color: var(--accent); font-weight: 600; }
.como-elegimos { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio); padding: 1.75rem; }

.grid-productos { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1.1rem; }
.grid-productos-ad-wrap { grid-column: 1 / -1; }

.grid-categorias { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.card-categoria {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio);
  padding: 1.4rem 1rem; text-align: center; font-weight: 700; transition: border-color .15s;
}
.card-categoria:hover { border-color: var(--accent); }

/* =============================================================
   7. Tarjeta de producto
   ============================================================= */
.card-producto {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radio); overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--sombra);
}
.card-producto-img-wrap { aspect-ratio: 4/3; background: var(--accent-soft); display: block; }
.card-producto-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.card-producto-body { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card-producto-marca { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.card-producto-nombre { font-size: 1rem; line-height: 1.3; }
.card-producto-precio { margin-top: auto; display: flex; align-items: baseline; gap: .5rem; }
.precio-actual { font-weight: 800; font-size: 1.1rem; }
.precio-antes { text-decoration: line-through; color: var(--text-muted); font-size: .85rem; }
.card-producto-acciones { display: flex; gap: .5rem; margin-top: .5rem; }
.card-producto-acciones .btn { flex: 1; padding: .55rem .6rem; font-size: .82rem; }
.btn-comparar-toggle { border: 1px solid var(--border); border-radius: 999px; }
.btn-comparar-toggle.is-activo { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.chip-ejemplo, .chip-oferta {
  position: absolute; top: .6rem; left: .6rem; z-index: 2;
  font-size: .68rem; font-weight: 700; padding: .25rem .55rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
}
.chip-oferta { left: auto; right: .6rem; background: var(--oferta); color: #fff; border: none; }
.chip-ejemplo-mini { font-size: .68rem; background: var(--accent-soft); color: var(--accent); padding: .1rem .4rem; border-radius: 6px; margin-left: .4rem; }

.estrellas { color: #f5a623; letter-spacing: 1px; }
.valoracion-num, .valoracion-cantidad { color: var(--text-muted); font-size: .85rem; }

/* =============================================================
   8. Espacios de anuncio
   ============================================================= */
.ad-slot { margin-block: 1.5rem; display: flex; justify-content: center; }
.ad-slot-placeholder {
  width: 100%; max-width: 728px; min-height: 90px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .2rem;
  border: 1px dashed var(--border); border-radius: var(--radio);
  color: var(--text-muted); font-size: .8rem; background: var(--surface);
}
.ad-slot-placeholder-tag { font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: .68rem; }

.banner-propio {
  position: relative; display: block; border: 1px solid var(--border); border-radius: var(--radio);
  overflow: hidden; background: var(--accent-soft);
}
.banner-propio-link { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6rem; padding: 1.4rem; }
.banner-propio-img { max-height: 140px; object-fit: contain; border-radius: 8px; }
.banner-propio-texto { color: var(--text); font-weight: 600; max-width: 60ch; }
.banner-propio-tag {
  position: absolute; top: .6rem; right: .6rem; font-size: .65rem; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border); padding: .2rem .5rem; border-radius: 999px;
  color: var(--text-muted);
}

/* =============================================================
   9. Ficha de producto
   ============================================================= */
.migas { font-size: .82rem; color: var(--text-muted); margin-block: 1rem; }
.migas a { color: var(--text-muted); }
.aviso-ejemplo { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radio); padding: .8rem 1rem; margin-bottom: 1.25rem; font-size: .9rem; }

.ficha-top { display: grid; gap: 1.75rem; grid-template-columns: 1fr; margin-bottom: 1.5rem; }
@media (min-width: 720px) { .ficha-top { grid-template-columns: 1fr 1fr; } }

.ficha-galeria { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio); overflow: hidden; }
.ficha-img-main { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.ficha-thumbs { display: flex; gap: .5rem; padding: .6rem; overflow-x: auto; overflow-y: visible; }
.ficha-thumb-btn img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

.ficha-head { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.ficha-marca { color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: .8rem; }
.ficha-nombre { font-size: clamp(1.5rem, 3vw, 2rem); }
.ficha-precio { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem; margin-top: .3rem; }
.ficha-precio .precio-actual { font-size: 1.8rem; }
.precio-nota { width: 100%; color: var(--text-muted); font-size: .82rem; }
.btn-comprar { margin-top: .5rem; }
.ficha-destacado { font-style: italic; color: var(--text-muted); }

.radar-chart { width: 100%; max-width: 320px; margin-inline: auto; display: block; }
.radar-anillo { fill: none; stroke: var(--border); }
.radar-eje { stroke: var(--border); }
.radar-label { font-size: 10px; fill: var(--text-muted); font-family: var(--sans); }
.ficha-radar { text-align: center; }

.tabla-specs { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio); overflow: hidden; }
.tabla-specs tr:not(:last-child) th, .tabla-specs tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
.tabla-specs th, .tabla-specs td { text-align: left; padding: .6rem .9rem; font-size: .92rem; }
.tabla-specs th { color: var(--text-muted); font-weight: 600; width: 45%; }
.specs-extra { margin-top: .8rem; }
.specs-extra summary { cursor: pointer; font-weight: 600; color: var(--accent); }

.editorial-cuerpo { max-width: 70ch; }
.editorial-cuerpo p + p { margin-top: .9rem; }
.pros-contras { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1.25rem; }
.lista-pros li, .lista-contras li { padding-left: 1.4rem; position: relative; margin-bottom: .4rem; }
.lista-pros li::before { content: '✓'; position: absolute; left: 0; color: var(--exito); font-weight: 700; }
.lista-contras li::before { content: '✕'; position: absolute; left: 0; color: var(--oferta); font-weight: 700; }
.ideal-para { margin-top: 1.25rem; background: var(--accent-soft); padding: .9rem 1rem; border-radius: var(--radio); }

.lista-resenas li { border-top: 1px solid var(--border); padding-block: .9rem; }
.resena-autor { font-weight: 700; font-size: .85rem; margin-top: .3rem; }
.resena-texto { color: var(--text-muted); }

.btn-comprar-final { display: flex; width: fit-content; margin-inline: auto; margin-block: 2rem; }
.aviso-afiliados { color: var(--text-muted); font-size: .8rem; max-width: 70ch; margin-inline: auto; text-align: center; }

/* =============================================================
   10. Comparador
   ============================================================= */
.form-seleccion-comparador { display: flex; flex-direction: column; gap: 1rem; }
.input-filtro { padding: .7rem 1rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.lista-seleccion-comparador { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: .6rem; max-height: 60vh; overflow-y: auto; padding: .3rem; }
.opcion-comparador {
  display: flex; align-items: center; gap: .6rem; padding: .6rem; border: 1px solid var(--border);
  border-radius: var(--radio); background: var(--surface); cursor: pointer;
}
.opcion-comparador:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opcion-comparador img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.opcion-comparador small { display: block; color: var(--text-muted); }

.comparador-radar-overlay { text-align: center; margin-bottom: 2rem; }
.leyenda-radar { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; margin-top: .8rem; }
.leyenda-radar li { display: flex; align-items: center; gap: .4rem; font-size: .85rem; }
.leyenda-color { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.tabla-comparador-wrap { overflow-x: auto; }
.tabla-comparador { min-width: 560px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio); overflow: hidden; }
.tabla-comparador th, .tabla-comparador td { padding: .7rem .9rem; border-bottom: 1px solid var(--border); text-align: left; font-size: .9rem; }
.tabla-comparador thead th { vertical-align: top; }
.tabla-comparador thead img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; margin-bottom: .4rem; }
.tabla-comparador tbody th { color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.mejor-valor { background: var(--accent-soft); font-weight: 700; }

/* =============================================================
   11. Guías
   ============================================================= */
.guia-intro { max-width: 70ch; color: var(--text-muted); margin-bottom: 1.5rem; }
.guia-item { border-top: 1px solid var(--border); padding-block: 1.5rem; }
.guia-item-cuerpo { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .guia-item-cuerpo { grid-template-columns: 180px 1fr; } }
.guia-item-cuerpo img { border-radius: var(--radio); }
.guia-faq details { border-top: 1px solid var(--border); padding-block: .9rem; }
.guia-faq summary { cursor: pointer; font-weight: 700; }
.guia-faq p { margin-top: .5rem; color: var(--text-muted); }

/* =============================================================
   12. Footer
   ============================================================= */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 3rem; padding-block: 2.5rem 1.5rem; }
.site-footer-inner { display: grid; gap: 1.5rem; grid-template-columns: 1fr; margin-bottom: 1.5rem; }
@media (min-width: 720px) { .site-footer-inner { grid-template-columns: 2fr 1fr 1fr; } }
.footer-col h3 { font-size: .85rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: .6rem; }
.footer-col a { display: block; color: var(--text-muted); padding-block: .2rem; }
.footer-tagline { color: var(--text-muted); }
.footer-copy { color: var(--text-muted); font-size: .8rem; margin-top: 1rem; }

/* =============================================================
   13. Admin
   ============================================================= */
.admin-body { background: var(--bg); }
.admin-login-wrap { min-height: 100svh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.admin-login-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio); padding: 2rem; display: flex; flex-direction: column; gap: .8rem; width: 100%; max-width: 340px; }
.admin-login-form input { padding: .7rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.admin-error { color: var(--oferta); font-size: .85rem; }
.admin-aviso-ok { color: var(--exito); background: color-mix(in srgb, var(--exito) 12%, transparent); padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; }

.admin-nav { background: var(--surface); border-bottom: 1px solid var(--border); }
.admin-nav-inner { max-width: 1180px; margin-inline: auto; padding: .9rem 1.25rem; display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.admin-nav-brand { font-weight: 800; margin-right: auto; }
.admin-nav a { color: var(--text-muted); font-weight: 600; }
.admin-nav-salir { color: var(--oferta) !important; }

.admin-contenido { max-width: 1180px; margin-inline: auto; padding: 1.75rem 1.25rem 3rem; }
.admin-cabecera { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .8rem; }
.admin-contador { color: var(--text-muted); font-weight: 500; }

.admin-tabla { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio); overflow: hidden; font-size: .9rem; }
.admin-tabla th, .admin-tabla td { padding: .6rem .8rem; border-bottom: 1px solid var(--border); text-align: left; }
.admin-tabla-acciones { display: flex; gap: .7rem; white-space: nowrap; }
.admin-tabla-acciones a { color: var(--accent); }
.link-peligro { color: var(--oferta); font-weight: 600; }

.admin-form fieldset { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio); padding: 1.25rem; margin-bottom: 1.25rem; display: grid; gap: .9rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .admin-form fieldset { grid-template-columns: 1fr 1fr; } }
.admin-form legend { font-weight: 800; padding-inline: .4rem; }
.admin-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--text-muted); font-weight: 600; }
.admin-form label.check { flex-direction: row; align-items: center; grid-column: 1 / -1; }
.admin-form input, .admin-form select, .admin-form textarea {
  font: inherit; padding: .6rem .8rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
}
.admin-form textarea { grid-column: 1 / -1; resize: vertical; }
.admin-ayuda { grid-column: 1 / -1; color: var(--text-muted); font-size: .82rem; }
.admin-ad-slot-box { grid-column: 1 / -1; border: 1px dashed var(--border); border-radius: var(--radio); padding: .9rem; display: grid; gap: .6rem; }

/* =============================================================
   14. Responsive extra
   ============================================================= */
@media (min-width: 1280px) {
  .grid-productos { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
}
