/* ==========================================================================
   DNF Solutions Affiliate Site — Global Styles
   - Estructura ordenada por secciones
   - Compatible (sin CSS vars avanzadas)
   - Dark mode con prefers-color-scheme
   ========================================================================== */

/* ========================================================================== */
/* 1) RESET / BASE                                                            */
/* ========================================================================== */

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: #ffffff;                 /* Fondo claro por defecto */
  color: #0f172a;                      /* Texto principal */
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.muted {
  color: #6b7280;                      /* Texto secundario / ayudas */
}

/* Contenedor genérico centrado (nav, hero, secciones) */
.inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ========================================================================== */
/* 2) NAV SUPERIOR                                                            */
/* ========================================================================== */

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid #e5e7eb;
}

.nav .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
}

.brand {
  font-weight: 800;
  letter-spacing: .2px;
}

.brand:hover {
  opacity: .9;
}

/* Pills de categorías (Laptops / Tablets / Earbuds / etc.) */
.cats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cats a {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #ffffff;
  font-size: 0.9rem;
  white-space: nowrap;
}

.cats a:hover {
  border-color: #111111;
}

.cats a.active {
  background: #111111;
  color: #ffffff;
  border-color: transparent;
}

/* ========================================================================== */
/* 3) HERO (título + descripción bajo la nav)                                */
/* ========================================================================== */

.hero {
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
  border-bottom: 1px solid #e5e7eb;
}

.hero .inner {
  padding: 42px 16px;
  text-align: center;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -.3px;
}

.hero p {
  margin: 0 auto;
  max-width: 720px;
  color: #6b7280;
  line-height: 1.6;
}

/* ========================================================================== */
/* 4) SECCIONES GENERALES (home + categoría)                                  */
/* ========================================================================== */

.section {
  padding: 36px 0 52px;
}

.section .inner {
  padding-top: 0;
  padding-bottom: 0;
}

.section-title {
  font-size: 1.35rem;
  margin: 0 0 16px;
}

/* ========================================================================== */
/* 5) CATEGORY CARDS EN HOME (Technology, Home & Kitchen, etc.)               */
/* ========================================================================== */

/* Grid de categorías en home */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  padding: 20px 0;
}

/* Tarjeta cuadrada (usa las imágenes que ya generaste con texto integrado) */
.category-card {
  position: relative;
  aspect-ratio: 1 / 1;                 /* cuadrado */
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.category-card:hover {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.15);
}

/* Imagen de fondo de la tarjeta */
.category-card .bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.4s ease, filter 0.4s ease;
}

/* Efecto zoom + ligero oscurecido en hover */
.category-card:hover .bg {
  transform: scale(1.08);
  filter: brightness(0.85);
}

/* Hace toda la tarjeta clicable */
.category-card a {
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* ========================================================================== */
/* 6) PRODUCT CARDS EN VISTA DE CATEGORÍA (Laptops, Tablets, etc.)           */
/*      - Imagen arriba (reutiliza .category-card)                           */
/*      - Título y metadatos debajo                                         */
/* ========================================================================== */

.product-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

/* Info textual debajo de la imagen */
.product-info {
  padding: 0 4px;
}

/* Título del producto (como link a product.html) */
.product-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: #0f172a;
  text-decoration: none;
  margin-bottom: 6px;
}

.product-title:hover {
  text-decoration: underline;
}

/* Fila de precio + rating + reviews */
.product-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  opacity: 0.9;
}

.price,
.rating {
  background: rgba(15, 23, 42, 0.06);
  padding: 3px 6px;
  border-radius: 6px;
}

.reviews {
  opacity: 0.8;
}

/* ========================================================================== */
/* 7) FOOTER SIMPLE                                                           */
/* ========================================================================== */

footer {
  border-top: 1px solid #e5e7eb;
  padding: 18px 16px;
  text-align: center;
  color: #6b7280;
}

/* ========================================================================== */
/* 8) SUBNAV (product.html y compare.html)                                    */
/* ========================================================================== */

.subnav {
  max-width: 1000px;
  margin: 12px auto 0;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.subnav .brand {
  font-weight: 800;
  letter-spacing: .2px;
  color: #111111;
}

.subnav .back {
  color: #111111;
  padding: 6px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: background .2s ease, opacity .2s ease;
}

.subnav .back:hover {
  background: rgba(17, 17, 17, .06);
}

/* ========================================================================== */
/* 9) PRODUCT PAGE (product.html)                                             */
/* ========================================================================== */

/* Contenedor principal de la ficha de producto (React/JS monta dentro de #app) */
#app {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 16px;
}

/* Card genérica en product (por si se usa) */
#app .card {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
  padding: 24px;
  text-align: center;
}

#app h1 {
  font-size: 1.35rem;
  margin: 1rem 0 .5rem;
  color: #111111;
}

#app .btn {
  display: inline-block;
  margin-top: 12px;
  background: #111111;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
}

#app .btn:hover {
  opacity: .85;
}

#app ul {
  text-align: left;
  margin: 16px auto;
  max-width: 720px;
  padding-left: 20px;
}

/* --- Galería de producto (imagen + thumbs + texto) --- */

.pd-wrap {
  max-width: 1000px;
  margin: 20px auto 40px;
  padding: 0 16px;
}

.pd-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .06);
  padding: 20px;
}

/* Grid: izquierda imagen, derecha texto */
.pd-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr);
}

@media (max-width: 900px) {
  .pd-grid {
    grid-template-columns: 1fr;
  }
}

/* Imagen principal con soporte de zoom */
.gal-main {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 10px;

  position: relative;
  overflow: hidden;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% auto;
  cursor: zoom-in;                     /* cursor “+” por defecto */
}

.gal-main img {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  display: block;
  transition: opacity .08s ease;
}

/* Miniaturas en filas (todas cuadradas) */
.gal-thumbs {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  max-width: 380px;
}

@media (max-width: 900px) {
  .gal-thumbs {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 600px) {
  .gal-thumbs {
    grid-template-columns: repeat(4, 1fr);
  }
}

.gal-thumbs button {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    border-color .15s ease,
    box-shadow .15s ease,
    transform .05s ease;
}

.gal-thumbs button:hover {
  border-color: #9ca3af;
}

.gal-thumbs button:active {
  transform: scale(.98);
}

.gal-thumbs button.active {
  border-color: #111;
  box-shadow: 0 0 0 2px rgba(17, 17, 17, .08) inset;
}

.gal-thumbs button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Columna derecha (título, rating, features, CTA) */
.pd-title {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 6px 0 6px;
}

.pd-meta {
  color: #6b7280;
  font-size: .92rem;
}

.pd-price {
  font-weight: 800;
  font-size: 1.05rem;
  margin: 10px 0 12px;
}

.pd-btn {
  display: inline-block;
  background: #111;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
}

.pd-btn:hover {
  opacity: .9;
}

.pd-feats {
  margin-top: 16px;
}

.pd-feats h3 {
  margin: 18px 0 8px;
  font-size: 1rem;
}

.pd-feats ul {
  margin: 0;
  padding-left: 18px;
}

.pd-feats li {
  margin: 4px 0;
}

/* ========================================================================== */
/* 10) COMPARE PAGE (compare.html)                                            */
/* ========================================================================== */

.wrap--compare {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.wrap--compare h1 {
  text-align: center;
  font-size: 1.6rem;
  margin: 8px 0 12px;
}

/* Controles (input ASIN / botones) */
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.controls input {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px 10px;
  height: 36px;
}

.controls a.btn {
  background: #111111;
  color: #ffffff;
  border-radius: 8px;
  padding: 8px 16px;
  text-decoration: none;
  font-weight: 600;
}

.controls a.btn:hover {
  opacity: .85;
}

/* Tabla de comparación */
.table-scroll {
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.cmp-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 720px;
}

.cmp-table th,
.cmp-table td {
  border: 1px solid #e5e7eb;
  padding: 12px;
  vertical-align: top;
}

.cmp-table th {
  background: #f9f9f9;
  font-weight: 700;
  text-align: left;
  width: 120px;
}

.cmp-table td {
  text-align: center;
}

.imgcell img {
  max-width: 180px;
  margin: auto;
  border-radius: 10px;
}

/* ========================================================================== */
/* 11) ZOOM DE PRODUCTO (click-to-toggle)                                     */
/* ========================================================================== */

/* Estado normal: cursor con “+”. En zoom activo: “−”.
   (la lógica JS alterna la clase .is-zoom) */
.gal-main { cursor: zoom-in; }

.gal-main.is-zoom {
  cursor: zoom-out;
}

/* Al activar zoom ocultamos la <img> y usamos el background para el desplazamiento */
.gal-main.is-zoom img {
  opacity: 0;
}

/* ========================================================================== */
/* 12) DARK MODE (overrides)                                                  */
/* ========================================================================== */

@media (prefers-color-scheme: dark) {

  body {
    background: #0b1020;
    color: #e6e8ef;
  }

  /* Nav + pills */
  .nav {
    background: rgba(11, 16, 32, .92);
    border-bottom-color: #1e2437;
  }

  .cats a {
    background: #0b1020;
    border-color: #2a324b;
    color: #e6e8ef;
  }

  .cats a:hover {
    border-color: #e6e8ef;
  }

  .cats a.active {
    background: #e6e8ef;
    color: #0b1020;
  }

  /* Hero */
  .hero {
    background: linear-gradient(180deg, #0c1224, #111a33);
    border-bottom-color: #1e2437;
  }

  .hero p,
  .muted {
    color: #9aa0b4;
  }

  /* Category / product cards */
  .category-card {
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  }

  .product-title {
    color: #e6e8ef;
  }

  .price,
  .rating {
    background: rgba(255, 255, 255, 0.08);
  }

  /* Footer */
  footer {
    border-top-color: #1e2437;
    color: #9aa0b4;
  }

  /* Subnav / botones */
  .subnav .brand,
  .subnav .back {
    color: #e6e8ef;
  }

  .subnav .back {
    border-color: #1e2437;
  }

  .subnav .back:hover {
    background: rgba(255, 255, 255, .06);
  }

  /* Product page */
  #app .card {
    background: #0f172a;
  }

  #app h1 {
    color: #e6e8ef;
  }

  #app .btn {
    background: #e6e8ef;
    color: #0b1020;
  }

  .pd-card {
    background: #0f172a;
    border-color: #1e2437;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  }

  .gal-main {
    background: #0b1020;
    border-color: #1e2437;
  }

  .gal-thumbs button {
    background: #0f172a;
    border-color: #1e2437;
  }

  .gal-thumbs button.active {
    border-color: #e6e8ef;
    box-shadow: 0 0 0 2px rgba(230, 232, 239, .12) inset;
  }

  .pd-title {
    color: #e6e8ef;
  }

  .pd-meta {
    color: #9aa0b4;
  }

  .pd-btn {
    background: #e6e8ef;
    color: #0b1020;
  }

  /* Compare page */
  .controls input {
    background: #0f172a;
    color: #e6e8ef;
    border-color: #2a324b;
  }

  .controls a.btn {
    background: #e6e8ef;
    color: #0b1020;
  }

  .table-scroll {
    border-color: #1e2437;
  }

  .cmp-table th,
  .cmp-table td {
    border-color: #1e2437;
  }

  .cmp-table th {
    background: #0f172a;
    color: #e6e8ef;
  }
}

/* 🟦 Ajusta el contenedor principal de media */
.gal-main {
  width: 1024px;
  height: 1024px;
  max-width: 100%;
  max-height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 🟦 Imagen principal (ya la tienes controlada) */
#galMain {
  width: 1024px;
  height: 1024px;
  object-fit: contain;
}

/* 🟦 VIDEO principal del producto */
#galVideo {
  width: 1024px;
  height: 1024px;
  object-fit: contain;
  background: #000;
  border-radius: 8px;
}

