/* ============================================================
   ANIMALPLANET · Tienda online (catalogo.html)
   Estructura tipo Animal Brothers (WooCommerce)
   Mantiene la paleta de colores del sitio (verde + dorado)
   ============================================================ */

/* ---------- Cabecera de tienda + breadcrumb ---------- */
.shop-head {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #14532d 0%, #166534 55%, #15803d 100%);
  padding: 2px 20px 10px; /* texto arriba + 2 líneas extra del subtítulo; se resta abajo para que las imágenes queden como estaban */
  color: #fff;
}
/* Perro + gato pegados como una sola imagen, detrás del texto */
.shop-head-bg {
  position: absolute; inset: 0; z-index: 0;
  display: flex; justify-content: flex-end; align-items: flex-end;
  pointer-events: none;
}
.shop-head-bg img {
  display: block; height: 100%; width: auto; object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .18));
}
/* Móvil: la imagen del perro corre 1 cm hacia la izquierda */
.shop-head-bg img:first-child {
  transform: translateX(-37px);
}
/* El perro inline del título no se muestra: en escritorio se usa la foto
   grande del perro (mismo tamaño que el gato) como imagen de fondo. */
.shop-head-dog {
  display: none;
}
/* PC/escritorio: banner con el perro a la izquierda y el gato a la derecha,
   ambos del mismo tamaño. El texto se corre hacia la derecha (queda centrado
   entre las dos fotos) y no las tapa. */
@media (min-width: 769px) {
  .shop-head-bg {
    justify-content: space-between;
    align-items: flex-end;
  }
  .shop-head-bg img {
    height: 100%;
    max-height: clamp(100px, 17vw, 220px);
  }
  .shop-head-bg img:first-child {
    display: block;
    transform: none;
  }
  .shop-head-inner {
    padding-right: 0;
    text-align: center;
  }
  .crumb { justify-content: center; }
  .shop-sub { max-width: min(470px, 40vw); }
}
.shop-head-inner { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; }
.crumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: rgba(255, 255, 255, .72); margin-bottom: 10px;
}
.crumb a { color: rgba(255, 255, 255, .72); text-decoration: none; }
.crumb a:hover { color: #fff; text-decoration: underline; }
.crumb-sep { opacity: .5; }
.shop-head h1 {
  font-family: var(--font-head, "Sora", sans-serif);
  font-size: clamp(26px, 4vw, 38px); margin: 0; line-height: 1.1;
}
.shop-head .gold { color: #ffd166; }
.shop-sub {
  margin: 10px auto 0;
  opacity: .88; font-size: 14px;
  max-width: 470px; /* el texto ya corta en 3 líneas con <br> en el HTML y queda centrado */
  text-align: center;
  line-height: 1.6;
}

/* ---------- WhatsApp flotante (mismo ícono que el inicio) ---------- */
.wa-float svg { width: 32px; height: 32px; }
.wa-float-count {
  position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px;
  border-radius: 100px; background: #ef4444; color: #fff;
  font-size: 10.5px; font-weight: 800; display: grid; place-items: center;
  font-family: var(--font-head); padding: 0 4px; border: 2px solid #fff;
}

/* ---------- Layout: sidebar + grilla ---------- */
.shop-layout {
  max-width: 1200px; margin: 0 auto; padding: 26px 20px 44px;
  display: grid; grid-template-columns: 250px 1fr; gap: 28px;
  align-items: start;
}

/* ---------- Sidebar de filtros ---------- */
.shop-sidebar {
  position: sticky; top: 84px;
  background: var(--panel, #fff);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 16px;
  padding: 18px 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}
.filter-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding-bottom: 12px; margin-bottom: 8px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}
.filter-head h2 {
  margin: 0; font-family: var(--font-head, "Sora", sans-serif);
  font-size: 16px; color: var(--text, #1f2937);
}
.filter-clear {
  border: 0; background: none; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--muted, #6b7280);
  padding: 4px 8px; border-radius: 8px; transition: all .15s;
}
.filter-clear:hover { color: var(--red, #ef4444); background: rgba(239, 68, 68, .08); }

.filter-group { padding: 12px 0; border-bottom: 1px dashed var(--line, #e5e7eb); }
.filter-group:last-of-type { border-bottom: 0; }
.filter-group h3 {
  margin: 0 0 8px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted, #6b7280);
}
.filter-options { display: flex; flex-direction: column; gap: 3px; max-height: 240px; overflow-y: auto; }

.fcheck {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 8px; cursor: pointer;
  font-size: 13px; color: var(--text, #1f2937); transition: background .15s;
}
.fcheck:hover { background: var(--green-soft, rgba(22, 163, 74, .08)); }
.fcheck input { accent-color: var(--green, #16a34a); cursor: pointer; flex-shrink: 0; }
.fcheck span { flex: 1; }
.fcheck em {
  font-style: normal; font-size: 11px; color: var(--muted, #6b7280);
  background: var(--panel-2, #f8fafc); border: 1px solid var(--line, #e5e7eb);
  padding: 1px 7px; border-radius: 100px;
}
.fcheck.on { background: var(--green-soft, rgba(22, 163, 74, .08)); }
/* Ícono de categoría con imagen real en los filtros */
.fcat-ico {
  width: 22px; height: 22px; object-fit: contain; flex-shrink: 0;
  border-radius: 6px; background: var(--panel-2, #f8fafc);
  border: 1px solid var(--line, #e5e7eb); padding: 1px;
  vertical-align: middle; display: inline-block;
}

#filterOpenMobile { display: none; }
#filterToggleMobile { display: none; }

/* ---------- Barra de resultados ---------- */
.results-bar {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center;
  margin-bottom: 22px;
}
.shop-search { flex: 1 1 100%; grid-column: 1 / -1; }
.results-count {
  font-size: 13.5px; color: var(--muted, #6b7280); font-weight: 500;
}
.results-tools { display: flex; gap: 10px; align-items: center; }

.cols-toggle { display: inline-flex; border: 1px solid var(--line-2, #d1d5db); border-radius: 10px; overflow: hidden; }
.cols-toggle button {
  border: 0; background: var(--panel, #fff); width: 34px; height: 36px;
  font-size: 13px; cursor: pointer; color: var(--muted, #6b7280); transition: all .15s;
}
.cols-toggle button + button { border-left: 1px solid var(--line-2, #d1d5db); }
.cols-toggle button.active { background: var(--green, #16a34a); color: #fff; }
.cols-toggle button:hover:not(.active) { background: var(--green-soft, rgba(22, 163, 74, .08)); }

.sort-select {
  border: 1px solid var(--line-2, #d1d5db); border-radius: 10px;
  padding: 0 12px; height: 38px; font-size: 13.5px; font-weight: 600;
  color: var(--text, #1f2937); background: var(--panel, #fff); cursor: pointer;
}

/* ---------- Grilla con columnas configurables ---------- */
.product-grid { display: grid; gap: 20px; }
.product-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.product-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Tarjetas estilo WooCommerce ---------- */
.product-grid .card {
  position: relative; display: flex; flex-direction: column;
  background: var(--panel, #fff); border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 16px); overflow: hidden;
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.product-grid .card:hover {
  transform: translateY(-6px); border-color: rgba(22, 163, 74, .45); box-shadow: var(--shadow);
}
.product-grid .card-media {
  position: relative; aspect-ratio: 1 / 1; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #ffffff 0%, #f0fdf4 100%);
}
.product-grid .card-media img { width: 84%; height: 84%; object-fit: contain; transition: transform .45s; }
.product-grid .card:hover .card-media img { transform: scale(1.06); }
.product-grid .card-ph { font-size: 56px; opacity: .35; }

/* Badges superiores (Nuevo / Oferta / -% / Sin stock) */
.product-grid .card .badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  padding: 4px 9px; border-radius: 100px; text-transform: uppercase;
}
.product-grid .badge-nuevo { background: var(--green, #16a34a); color: #fff; }
.product-grid .badge-oferta { background: var(--accent, #f97316); color: #fff; }
.product-grid .badge-dto { background: var(--red, #ef4444); color: #fff; }
.product-grid .badge-sin { background: #6b7280; color: #fff; }

.product-grid .card-body {
  display: flex; flex-direction: column; flex: 1;
  padding: 14px 16px 16px;
}
.card-breadcrumb {
  font-size: 10.5px; color: var(--green, #16a34a);
  text-transform: uppercase; letter-spacing: .09em; font-weight: 700;
  margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.product-grid .card-title {
  font-size: 13.5px; font-weight: 600; margin: 0 0 6px; line-height: 1.35;
  min-height: 2.7em; font-family: var(--font-head, "Sora", sans-serif); color: var(--text, #1f2937);
}
.product-grid .card-code { font-size: 11px; color: var(--muted, #6b7280); font-family: monospace; }
.product-grid .card-price {
  display: flex; align-items: baseline; gap: 8px; margin-top: 8px;
}
.product-grid .price { font-family: var(--font-head, "Sora", sans-serif); font-weight: 800; font-size: 17px; color: var(--text, #1f2937); }
.product-grid .price-lista { font-size: 12px; color: var(--muted, #6b7280); text-decoration: line-through; }

/* Botones (contrato tienda.js: .card-buy + data-qty-id + data-add) */
.product-grid .card-cta { margin-top: 10px; }

/* ---------- Secciones SEO por categoría ---------- */
.cat-seo-wrap { max-width: 1200px; margin: 0 auto; padding: 10px 20px 40px; }
.cat-seo {
  scroll-margin-top: 84px;
  margin: 8px 0 18px; padding: 20px 22px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid rgba(22, 101, 52, .15);
  border-radius: 14px;
}
.cat-seo h2 {
  margin: 0 0 6px; font-family: var(--font-head, "Sora", sans-serif);
  font-size: 19px; color: #14532d;
}
.cat-seo p { margin: 0; font-size: 13.5px; color: #3f6212; max-width: 760px; line-height: 1.55; }
.cat-seo a { color: #15803d; font-weight: 700; }

/* ---------- Estado vacío + cargar más ---------- */
.cat-empty { text-align: center; color: var(--muted, #78716c); padding: 60px 10px; font-size: 16px; }
.cat-empty .btn { margin-top: 14px; }
.cat-load { text-align: center; margin-top: 26px; }
.cat-load .btn { min-width: 220px; }

/* ---------- Footer de la tienda ---------- */
.footer-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px;
  margin-bottom: 10px;
}
.footer-links a { color: var(--muted, #6b7280); font-size: 12.5px; text-decoration: none; }
.footer-links a:hover { color: var(--green, #16a34a); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .product-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .product-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .shop-layout { grid-template-columns: 1fr; }
  .shop-sidebar {
    position: fixed; inset: 0; z-index: 200;
    border-radius: 0; overflow-y: auto; padding: 24px 20px;
    transform: translateX(-105%); transition: transform .28s ease;
    background: var(--panel, #fff);
  }
  .shop-sidebar.open { transform: translateX(0); }
  #filterOpenMobile { display: inline-flex; grid-column: 1 / -1; }
  #filterToggleMobile { display: block; width: 100%; margin-top: 8px; }
  .results-bar { grid-template-columns: 1fr; }
  .results-tools { justify-content: space-between; }
}
@media (max-width: 640px) {
  .shop-head-bg { align-items: flex-end; }
  .shop-head-bg img { height: 72%; opacity: .9; }
  .shop-head h1, .shop-head .shop-sub { text-shadow: 0 2px 10px rgba(0, 0, 0, .38); }
}
@media (max-width: 480px) {
  .product-grid.cols-3, .product-grid.cols-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .product-grid .card-title { font-size: 12.5px; min-height: 0; }
}
