/* =========================
   VARIABLES DE MARCA
   Centralizar aqui los colores evita inconsistencias cuando se añaden
   nuevos componentes (antes #ff4d6d y #111 se repetian sueltos en más
   de 10 reglas distintas).
========================= */
:root {
  /* Tema Claro (Por defecto) */
  --color-bg: #ecf2f7;
  --color-text: #1e293b;
  --color-text-soft: #475569;
  --color-accent: #2563eb;
  --color-gold: rgba(13, 148, 136, 0.15);
  --color-whatsapp: #25d366;
  --color-border: #cbd5e1;
  --color-danger-bg: #fee2e2;
  --color-danger-text: #ef4444;
  --color-delete: #64748b;
  --color-delete-bg: #f1f5f9;
  --color-card: #ffffff;
  --color-input: #ffffff;
  --color-header-bg: linear-gradient(90deg, #1e3a8a 0%, #0d9488 100%);
  --color-sub-bg: #f8fafc;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;

  /* Botones y Footer */
  --color-btn-primary-bg: #1e293b;
  --color-btn-primary-text: #ffffff;
  --color-btn-primary-hover: #0f172a;
  --color-footer-bg: #0f172a;
  --color-cat-active-bg: var(--color-accent);
  --color-pagination-active-bg: var(--color-accent);
}

[data-theme="dark"] {
  /* Tema Oscuro (De Lujo) */
  --color-bg: #0f172a;
  --color-text: #f8fafc;
  --color-text-soft: #94a3b8;
  --color-accent: #60a5fa;
  --color-gold: rgba(13, 148, 136, 0.3);
  --color-border: #1e293b;
  --color-danger-bg: #450a0a;
  --color-danger-text: #fecaca;
  --color-delete: #94a3b8;
  --color-delete-bg: #334155;
  --color-card: #1e293b;
  --color-input: #334155;
  --color-header-bg: #0f172a;
  --color-sub-bg: #0b0f19;

  /* Botones y Footer en Modo Oscuro */
  --color-btn-primary-bg: #ffffff;
  --color-btn-primary-text: #0f172a;
  --color-btn-primary-hover: #e2e8f0;
  --color-footer-bg: #0b0f19;
  --color-cat-active-bg: var(--color-accent);
  --color-pagination-active-bg: var(--color-accent);
}

@font-face {
  font-family: "ChocolateDropsNF";
  src: url("../fonts/ChocolateDropsNF.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', Arial, sans-serif;
}

body {
  background-color: var(--color-bg);
  background-image:
    linear-gradient(125deg, transparent 38%, var(--color-gold) 50%, transparent 62%),
    linear-gradient(100deg, transparent 68%, rgba(212, 175, 55, 0.32) 80%, transparent 92%),
    linear-gradient(115deg, transparent 4%, var(--color-gold) 16%, transparent 28%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  color: var(--color-text);
  line-height: 1.6;
}

/* =========================
   TOPBAR (franja de beneficios)
========================= */
.topbar {
  background: #111111;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.topbar span {
  white-space: nowrap;
  opacity: .9;
}

/* =========================
   HEADER
========================= */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--color-header-bg);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  transition: background 0.3s ease;
}

.header-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 24px;
  gap: 1rem;
}

.logo-img {
  height: 80px;
  width: auto;
  display: block;
  transition: transform 0.2s ease, filter 0.2s ease;
  filter: drop-shadow(0 2px 8px rgba(255, 255, 255, 0.35));
}
.logo-img:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.5));
}

.logo-text {
  font-family: "ChocolateDropsNF", cursive;
  font-size: 30px;
  color: #fff;
  text-decoration: none;
  letter-spacing: 1px;
}

.logo {
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.menu-toggle-btn {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1100;
}

.menu-toggle-btn .hamburger-bar {
  width: 100%;
  height: 2.5px;
  background-color: #ffffff;
  border-radius: 4px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.header-nav {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
}

.header-nav a {
  font-size: 13.5px;
  color: #fff;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background .15s;
  white-space: nowrap;
  font-weight: 500;
}

.header-nav a:hover {
  background: rgba(255,255,255,.18);
}

.header-nav a.nav-active {
  background: rgba(255,255,255,.15);
  font-weight: 700;
}

.cart-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.2) !important;
  border-radius: 20px !important;
  padding: 6px 14px !important;
  font-weight: 700 !important;
}

.cart-icon span {
  background: var(--color-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* =========================
   HERO
========================= */
/* =========================
   HERO SLIDER
========================= */
.hero-slider {
  position: relative;
  width: 100%;
  min-height: 380px;
  overflow: hidden;
}

.slides-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 380px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease-in-out, visibility 0.8s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 20px;
}

.slide.active {
  opacity: 1;
  visibility: visible;
  z-index: 2;
}

/* Diapositivas temáticas */
.slide-general {
  background-image: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.55)), url('../img/banner_general.webp');
  background-size: cover;
  background-position: center;
}
[data-theme="dark"] .slide-general {
  background-image: linear-gradient(rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.75)), url('../img/banner_general.webp');
}

.slide-ofertas {
  background-image: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.55)), url('../img/banner_ofertas.webp');
  background-size: cover;
  background-position: center;
}
[data-theme="dark"] .slide-ofertas {
  background-image: linear-gradient(rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.75)), url('../img/banner_ofertas.webp');
}

.slide-infantil {
  background-image: linear-gradient(rgba(15, 31, 18, 0.5), rgba(0, 0, 0, 0.7)), url('../img/banner_infantil.webp');
  background-size: cover;
  background-position: center;
  color: #ffffff;
}

.slide-content {
  max-width: 700px;
  margin: 0 auto;
  transform: translateY(20px);
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide.active .slide-content {
  transform: translateY(0);
}

.slide-logo {
  font-family: "ChocolateDropsNF", cursive;
  font-size: 52px;
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: 1px;
  color: #ffffff;
}

.slide-title {
  font-size: 40px;
  font-weight: 800;
  margin-bottom: 10px;
  color: #ffffff;
}

.slide-content p {
  font-size: 18px;
  color: #e5e7eb;
  margin-top: 10px;
}

.slide-buttons {
  margin-top: 25px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

/* Flechas del Slider */
.slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.15);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background 0.25s, transform 0.25s;
}
.slider-arrow:hover {
  background: rgba(0, 0, 0, 0.35);
  transform: translateY(-50%) scale(1.05);
}
.prev-arrow {
  left: 20px;
}
.next-arrow {
  right: 20px;
}

/* Puntos indicadores */
.slider-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
}
.slider-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.25s ease;
}
.slider-dots .dot.active {
  background: var(--color-accent);
  transform: scale(1.2);
}
[data-theme="dark"] .slider-dots .dot {
  background: rgba(255, 255, 255, 0.2);
}
[data-theme="dark"] .slider-dots .dot.active {
  background: var(--color-accent);
}

@media (max-width: 768px) {
  .hero-slider, .slide {
    min-height: 320px;
  }
  .slide-logo {
    font-size: 40px;
  }
  .slide-title {
    font-size: 30px;
  }
  .slide-content p {
    font-size: 15px;
  }
  .slider-arrow {
    display: none;
  }
}

.btn-primary {
  background: var(--color-btn-primary-bg);
  color: var(--color-btn-primary-text);
  padding: 12px 22px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 500;
  transition: 0.2s;
}

.btn-primary:hover {
  background: var(--color-btn-primary-hover);
}

.btn-secondary {
  background: var(--color-accent);
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 500;
}

/* =========================
   BENEFICIOS
========================= */
.beneficios {
  display: flex;
  justify-content: center;
  gap: 30px;
  padding: 20px;
  background: var(--color-card);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

/* =========================
   CATEGORIAS
========================= */
.categorias {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 30px 40px 50px;
}

.cat {
  background: var(--color-card);
  padding: 8px 20px;
  text-align: center;
  border-radius: 30px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all 0.25s ease;
  font-weight: 500;
  text-decoration: none;
  color: var(--color-text);
  display: inline-block;
  font-size: 14px;
}

.cat:hover {
  transform: translateY(-2px);
  border-color: var(--color-accent);
  color: var(--color-accent);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.cat-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 77, 109, 0.3);
}

.cat-active:hover {
  color: #fff;
}

/* =========================
   PAGINA TIENDA
========================= */
.tienda-header {
  text-align: center;
  padding: 40px 20px 10px;
}

.tienda-header h1 {
  font-size: 32px;
}

.tienda-header p {
  color: var(--color-text-soft);
  margin-top: 6px;
}

.tienda-categorias {
  position: sticky;
  top: 72px;
  z-index: 500;
  background: var(--color-card);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.tienda-cat-link {
  background: var(--color-sub-bg);
  padding: 7px 18px;
  border-radius: 30px;
  border: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--color-text);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tienda-cat-link:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.tienda-cat-active {
  background: var(--color-cat-active-bg);
  border-color: var(--color-cat-active-bg);
  color: #fff;
}

.tienda-cat-active:hover {
  color: #fff;
}

.tienda-result-count {
  text-align: center;
  color: var(--color-text-soft);
  font-size: 14px;
  margin-bottom: 20px;
}

.tienda-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-soft);
}

@media (max-width: 768px) {
  .tienda-categorias {
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }

  .tienda-categorias::-webkit-scrollbar {
    display: none;
  }
}

/* =========================
   PRODUCTOS
========================= */
.productos {
  padding: 50px 40px;
}

.productos h1,
.productos h2 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 28px;
}

.grid-productos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.producto {
  background: var(--color-card);
  border-radius: 12px;
  padding: 14px;
  text-align: left;
  border: 1px solid var(--color-border);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.producto:hover {
  transform: translateY(-6px);
  border-color: #e5e7eb;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.05);
}

.producto h3 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  margin-top: 4px;
  margin-bottom: 4px;
  line-height: 1.35;
  height: 2.7rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.producto p {
  margin-bottom: 8px;
}

.btn {
  display: inline-block;
  background: var(--color-btn-primary-bg);
  color: var(--color-btn-primary-text);
  padding: 10px 20px;
  border-radius: 30px;
  text-decoration: none;
  font-size: 13px;
  font-weight: bold;
  text-align: center;
  border: 0;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  opacity: 1;
}

.btn:active {
  transform: translateY(0);
}

/* =========================
   CONFIANZA
========================= */
.confianza {
  display: flex;
  justify-content: space-around;
  padding: 40px;
  background: var(--color-card);
  font-size: 14px;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: 10px;
  text-align: center;
  color: var(--color-text);
}

/* =========================
   RINCONCITO
========================= */
.rinconcito {
  text-align: center;
  padding: 50px 20px;
  background: var(--color-card);
  color: var(--color-text);
}

.rinconcito h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

/* =========================
   FOOTER
========================= */
.site-footer {
  background: var(--color-footer-bg);
  color: #fff;
  padding: 50px 40px 0;
  font-size: 14px;
}

.footer-columns {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
  max-width: 1100px;
  margin: 0 auto;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.footer-col-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #fff;
}

.footer-logo {
  font-family: "ChocolateDropsNF", cursive;
  font-size: 24px;
  margin-bottom: 10px;
}

.footer-tagline {
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 18px;
  line-height: 1.6;
}

.footer-contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.footer-contact-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
}

.footer-contact-list a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

.footer-contact-list a:hover {
  color: var(--color-accent);
}

.footer-icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--color-accent);
}

.footer-social {
  display: flex;
  gap: 10px;
}

.footer-social-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 0.2s ease, color 0.2s ease;
}

.footer-social-icon:hover {
  background: var(--color-accent);
  color: #fff;
}

.footer-link-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-link-list a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

.footer-link-list a:hover {
  color: var(--color-accent);
}

.footer-placeholder-link {
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

.footer-bottom {
  text-align: center;
  padding: 20px 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 768px) {
  .footer-columns {
    grid-template-columns: 1fr;
    gap: 30px;
    text-align: left;
  }

  .site-footer {
    padding: 40px 24px 0;
  }
}

/* LOGO HERO */
.hero-logo {
  font-family: "ChocolateDropsNF", cursive;
}

.producto-img {
  width: 100%;
  height: 250px;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 12px;
  background: #f9fafb;
  position: relative;
}

.producto-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.producto:hover img {
  transform: scale(1.05);
}

.precio {
  color: var(--color-text);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 4px 0 8px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.stock-label {
  color: #6b7280;
  font-size: 0.8rem;
  margin-bottom: 6px;
}
.stock-urgente { color:#ef4444; font-size:.8rem; font-weight:700; margin-bottom:6px; }
.stock-bajo    { color:#f59e0b; font-size:.8rem; font-weight:700; margin-bottom:6px; }
.stock-agotado { color:#9ca3af; font-size:.8rem; margin-bottom:6px; }
.fav-btn {
    position:absolute; top:12px; right:12px; z-index:3;
    background:rgba(255,255,255,0.9); border:none; border-radius:50%;
    width:32px; height:32px; font-size:1rem; cursor:pointer;
    display:flex; align-items:center; justify-content:center;
    box-shadow:0 2px 8px rgba(0,0,0,0.08); transition:all 0.2s ease;
}
.fav-btn:hover { transform:scale(1.1); background:#fff; }

.botones-producto {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.inline-form {
  margin: 0;
}

.inline-form .btn {
  width: 100%;
  font: inherit;
}

/* boton carrito */
.btn-carrito {
  background: var(--color-btn-primary-bg);
  color: var(--color-btn-primary-text);
}

/* boton WhatsApp */
.btn-whatsapp {
  background: var(--color-whatsapp);
  color: #fff;
}

.btn-disabled {
  background: #bbb;
  color: #fff;
  cursor: not-allowed;
}

/* boton eliminar: gris neutro con icono, NO el mismo rojo de los mensajes
   de error de formulario, para que "eliminar" no se confunda visualmente
   con un fallo del sistema. */
.btn-eliminar {
  background: var(--color-delete-bg);
  color: var(--color-delete);
  border: 1px solid var(--color-border);
}

.btn-eliminar:hover {
  background: #e9e9e9;
}

.alerta-carrito {
  background: #4CAF50;
  color: white;
  padding: 14px 16px;
  margin: 10px auto;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  max-width: 500px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  animation: fade 0.3s ease-in-out;
  transition: opacity 0.35s ease, transform 0.35s ease, max-height 0.35s ease, margin 0.35s ease, padding 0.35s ease;
}

.alerta-carrito span.alerta-carrito-text {
  flex: 1;
  text-align: left;
}

.alerta-carrito.is-hiding {
  opacity: 0;
  transform: translateY(-10px);
  max-height: 0;
  margin: 0 auto;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}

.alerta-carrito-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.22);
  border: 0;
  border-radius: 50%;
  color: white;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease;
}

.alerta-carrito-close:hover {
  background: rgba(255, 255, 255, 0.38);
}

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

/* =========================
   CARRITO LATERAL
========================= */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: min(380px, 92vw);
  height: 100%;
  background: var(--color-card);
  box-shadow: -8px 0 25px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 99999;
  padding: 22px;
  display: flex;
  flex-direction: column;
  color: var(--color-text);
}

.cart-sidebar.is-open {
  transform: translateX(0);
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 12px;
}

.close-btn {
  cursor: pointer;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f3f3f3;
  color: var(--color-text);
  font-size: 18px;
  font-weight: bold;
}

.cart-body {
  margin-top: 14px;
  overflow-y: auto;
  flex: 1;
}

.cart-item {
  border-bottom: 1px solid var(--color-border);
  padding: 14px 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  opacity: 1;
  overflow: hidden;
  transform: translateX(0);
  transition: opacity 0.25s ease, transform 0.25s ease, max-height 0.25s ease, padding 0.25s ease;
}

.cart-item.is-removing {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  transform: translateX(24px);
}

.cart-item p {
  color: var(--color-text);
  font-weight: 700;
  margin-bottom: 6px;
}

.cart-item small {
  color: #666;
}

.qty-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: #fafafa;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}

.qty-btn:hover {
  background: #f0f0f0;
}

.qty-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.qty-value {
  min-width: 18px;
  text-align: center;
  font-weight: 700;
}

.cart-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.cart-item-actions strong {
  color: var(--color-accent);
}

.remove-cart-item {
  color: var(--color-delete);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.remove-cart-item.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  font-size: 18px;
  font-weight: 800;
}

.cart-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

/* boton WhatsApp dentro del carrito lateral */
.btn-whatsapp-cart {
  background: var(--color-whatsapp);
  color: #fff;
}

.cart-empty {
  color: #555;
  text-align: center;
  padding: 35px 10px;
}

.cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 99998;
}

.cart-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

body.cart-open {
  overflow: hidden;
}

/* =========================
   AUTH / FORMULARIOS
========================= */
.auth-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
}

.auth-card {
  width: min(430px, 100%);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 auto;
  color: var(--color-text);
}

.auth-card h1,
.auth-card h2,
.auth-card h3 {
  text-align: center;
}

.auth-card input,
.auth-card textarea,
.auth-card select {
  width: 100%;
  border: 1px solid var(--color-border);
  background-color: var(--color-input);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  padding: 12px;
  font: inherit;
}

.auth-card textarea {
  min-height: 100px;
  resize: vertical;
}

.checkout-form {
  margin-top: 24px;
}

.form-error {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.checkbox-row input {
  width: auto;
}

.categories-fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.categories-fieldset legend {
  font-weight: 700;
  padding: 0 6px;
}

.delete-product-form {
  max-width: min(430px, 100%);
  margin: 16px auto 0;
  text-align: center;
}

.image-upload-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.image-upload-label {
  font-weight: 700;
  font-size: 13px;
}

.image-current-preview {
  display: flex;
  align-items: center;
  gap: 12px;
}

.image-current-preview img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.image-current-preview span {
  font-size: 12px;
  color: #888;
}

.image-file-input {
  font-size: 13px;
}

.image-upload-hint {
  color: #888;
  font-size: 12px;
}

.image-url-fallback {
  margin-top: 4px;
}

.image-url-fallback summary {
  font-size: 12px;
  color: var(--color-text-soft);
  cursor: pointer;
}

.image-url-fallback input {
  margin-top: 8px;
  width: 100%;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  padding: 10px;
  font: inherit;
}

.gallery-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.gallery-item-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-delete);
  color: #fff;
  border: 2px solid #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item-remove:hover {
  background: var(--color-danger-text);
}

/* =========================
   PANEL ADMIN
========================= */
.admin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.admin-page h2 {
  margin: 24px 0 12px;
  text-align: left;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  font-size: 14px;
  color: var(--color-text);
}

.admin-table th {
  background: var(--color-sub-bg);
  font-weight: 800;
}

.status-select {
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
}

.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0 30px;
  flex-wrap: wrap;
}

.page-link {
  display: inline-block;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: #fff;
  text-decoration: none;
  color: var(--color-text);
  font-size: 14px;
}

.page-link-active {
  background: var(--color-pagination-active-bg);
  color: #fff;
  border-color: var(--color-pagination-active-bg);
}

/* =========================
   PEDIDOS (orders.php)
========================= */
.order-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 20px;
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.order-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #eee;
  color: #333;
}

.order-status-pendiente_pago { background: #fef0d9; color: #b54708; }
.order-status-pago_rechazado { background: #fbe7e5; color: #b42318; }
.order-status-confirmado { background: #e8f1fd; color: #175cd3; }
.order-status-enviado { background: #e8f1fd; color: #175cd3; }
.order-status-entregado { background: #e6f4ea; color: #067647; }
.order-status-cancelado { background: #fbe7e5; color: #b42318; }

.order-items-table {
  margin-bottom: 12px;
}

.order-card-footer p {
  margin: 4px 0;
  font-size: 14px;
}

.order-date {
  color: #888;
  font-size: 12px;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 768px) {

  .topbar {
    position: static;
    gap: 6px 10px;
    font-size: 11px;
    padding: 6px 10px;
  }

  .header-inner {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 16px !important;
  }

  .menu-toggle-btn {
    display: flex;
  }

  /* Animación del menú hamburguesa */
  .menu-toggle-btn.active .hamburger-bar:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
  }
  .menu-toggle-btn.active .hamburger-bar:nth-child(2) {
    opacity: 0;
  }
  .menu-toggle-btn.active .hamburger-bar:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
  }

  .header-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-header-bg);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.15);
    padding: 1rem 0;
    gap: 0;
    z-index: 999;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .header-nav.active {
    display: flex;
  }

  .header-nav a {
    display: block;
    width: 100%;
    padding: 12px 24px;
    border-radius: 0;
    text-align: left;
    font-size: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  .header-nav form {
    display: block;
    width: 100%;
  }

  .header-nav .logout-btn {
    display: block;
    width: 100%;
    padding: 12px 24px;
    text-align: left;
    background: none;
    border: none;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    font-weight: 500;
  }

  .header-nav a:hover,
  .header-nav .logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  .hero h1 {
    font-size: 32px;
  }

  .categorias {
    padding: 20px 15px;
    gap: 8px;
  }

  .confianza {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .admin-table thead {
    display: none;
  }

  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td {
    display: block;
    width: 100%;
  }

  .admin-table tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin: 10px;
    padding: 8px 12px;
  }

  .admin-table td {
    border-bottom: 0;
    padding: 6px 0;
  }

  .admin-table td::before {
    content: attr(data-label);
    font-weight: 700;
    display: block;
    font-size: 12px;
    color: #888;
  }

  .admin-table td[data-label=""]::before {
    content: none;
  }
}

/* =========================
   FICHA DE PRODUCTO (PRODUCTO.PHP)
========================= */
.product-detail-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 40px;
  padding: 40px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  margin: 20px 40px;
}

.product-detail-media {
  width: 100%;
}

.product-detail-media > img {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  background: #f7f7f7;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.product-thumbnails {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.product-thumbnail {
  width: 64px;
  height: 64px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: none;
  transition: border-color 0.2s ease;
}

.product-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-thumbnail:hover {
  border-color: var(--color-gold);
}

.product-thumbnail-active {
  border-color: var(--color-accent);
}

.product-detail-info {
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.product-breadcrumbs {
  font-size: 13px;
  color: var(--color-text-soft);
  margin-bottom: 20px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.product-breadcrumbs a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
}

.product-breadcrumbs a:hover {
  color: var(--color-accent);
}

.product-breadcrumbs span {
  color: #ccc;
}

.product-detail-info h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.2;
}

.product-detail-info .category-badge {
  display: inline-block;
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 15px;
  width: max-content;
}

.product-detail-info .precio-detalle {
  font-size: 28px;
  color: var(--color-accent);
  font-weight: 800;
  margin-bottom: 10px;
}

.product-detail-info .stock-detalle {
  font-size: 14px;
  color: var(--color-text-soft);
  margin-bottom: 20px;
}

.product-detail-info .stock-detalle strong {
  color: #067647;
}

.product-detail-info .stock-detalle.out-of-stock strong {
  color: var(--color-danger-text);
}

.product-detail-info .descripcion-detalle {
  font-size: 15px;
  color: #333;
  line-height: 1.7;
  margin-bottom: 25px;
  white-space: pre-line;
}

.detail-form {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  margin-bottom: 20px;
}

.detail-qty-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-qty-wrapper label {
  font-size: 14px;
  font-weight: 500;
}

.detail-qty-select {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  font-weight: bold;
  background: #fff;
  cursor: pointer;
  outline: none;
}

.product-detail-info .botones-compra {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.product-detail-info .btn-whatsapp-detail {
  background: var(--color-whatsapp);
  color: #fff;
}

/* =========================
   PRODUCTOS RELACIONADOS
========================= */
.related-section {
  padding: 50px 40px;
  text-align: center;
}

.related-section h2 {
  font-size: 24px;
  margin-bottom: 30px;
}

@media (max-width: 768px) {
  .product-detail-layout {
    margin: 20px 15px;
    padding: 20px;
    grid-template-columns: 1fr;
  }
}

/* =========================
   ASISTENTE VIRTUAL DE IA (LUNA)
========================= */
#ai-chat-widget {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  z-index: 9999;
  position: relative;
}

/* Burbuja Flotante */
#ai-chat-bubble {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff4d6d, #6366f1);
  border: none;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 9999;
}

#ai-chat-bubble:hover {
  transform: scale(1.08) rotate(5deg);
  box-shadow: 0 10px 30px rgba(255, 77, 109, 0.5);
}

.bubble-icon {
  font-size: 26px;
  color: #fff;
}

/* Ocultar burbuja al abrir chat */
.bubble-hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.5);
  pointer-events: none;
}

.bubble-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  opacity: 0.6;
  z-index: -1;
  animation: bubble-pulsing 2s infinite;
}

@keyframes bubble-pulsing {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

/* Drawer del Chat */
#ai-chat-drawer {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 380px;
  height: 520px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.chat-closed {
  opacity: 0;
  visibility: hidden;
  transform: translateY(40px) scale(0.9);
  pointer-events: none;
}

.chat-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Encabezado */
.chat-header {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  color: #ffffff;
  padding: 16px;
  display: flex;
  align-items: center;
  position: relative;
}

.header-avatar {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}

.avatar-emoji {
  font-size: 20px;
}

.header-info h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.header-info p {
  font-size: 11px;
  margin: 3px 0 0 0;
  color: #a5f3fc;
}

.status-online::before {
  content: "●";
  color: #4ade80;
  margin-right: 4px;
}

#ai-chat-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  transition: color 0.2s;
}

#ai-chat-close:hover {
  color: #ffffff;
}

/* Mensajes */
.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-bot, .msg-user {
  display: flex;
  max-width: 85%;
}

.msg-bot {
  align-self: flex-start;
}

.msg-user {
  align-self: flex-end;
}

.msg-content {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.msg-bot .msg-content {
  background: #ffffff;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.msg-user .msg-content {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-link {
  color: #ff4d6d;
  font-weight: 600;
  text-decoration: underline;
  transition: opacity 0.2s;
}

.chat-link:hover {
  opacity: 0.8;
}

.msg-user .chat-link {
  color: #a5f3fc;
}

/* Formulario */
.chat-footer {
  padding: 12px;
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

#ai-chat-form {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  border-radius: 24px;
  padding: 4px 6px 4px 14px;
}

#ai-chat-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 13.5px;
  color: #1e293b;
  padding: 8px 0;
}

#ai-chat-input::placeholder {
  color: #94a3b8;
}

#ai-chat-send {
  background: linear-gradient(135deg, #ff4d6d, #6366f1);
  color: #ffffff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
}

#ai-chat-send:hover {
  transform: scale(1.05);
}

/* Indicador escribiendo */
.msg-typing .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: wave 1.3s linear infinite;
  margin: 0 1px;
}

.msg-typing .dot:nth-child(2) {
  animation-delay: -1.1s;
}

.msg-typing .dot:nth-child(3) {
  animation-delay: -0.9s;
}

@keyframes wave {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-6px);
  }
}

/* Responsive Móvil (Pantalla completa) */
@media (max-width: 480px) {
  #ai-chat-drawer {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
  
  #ai-chat-bubble {
    bottom: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
  }
  
  .chat-closed {
    transform: translateY(100%);
  }
}

