:root {
  --primary: #4A2C59;
  --sidebar-width: 240px;
  --z-sidebar: 1500;
  --z-header: 1400;
}

/* ========================================
   RESET / BASE
   ======================================== */
body {
  font-family: 'Montserrat', sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #FFFFFF;
  overflow-x: hidden;
}

/* ========================================
   DESKTOP TOPBAR (cart + language switch)
   ======================================== */
.topbar {
  display: none; /* enabled below at >=768px */
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 100px;
  background: white;
  z-index: var(--z-header);
  align-items: center;
  justify-content: flex-end; /* only child is .topbar-right; logo lives in the sidebar (injected by the worker) */
  padding: 0 30px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 25px;
}

.logo-link { display: block; }

.logo {
  width: auto;
  display: block;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
  transition: all 0.3s ease;
  height: 42px;       /* mobile default */
  max-height: 42px;
}

/* ========================================
   MOBILE HEADER
   ======================================== */
.mobile-header {
  display: grid; /* hidden at >=768px below */
  grid-template-columns: auto 1fr auto; /* hamburger | logo | cart */
  align-items: center;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 70px;
  background: white;
  z-index: 120;
  padding: 0 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-header .hamburger { justify-self: start; }
.mobile-header .logo-link { justify-self: center; }

.mobile-right {
  display: flex;
  align-items: center;
  gap: 15px;
  justify-self: end;
}

.mobile-header .cart-icon { font-size: 1.7em; }

/* Sits centered directly below the logo, outside the flex row above */
.mobile-header .lang-selector-mobile {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  background: white;
  padding: 6px 10px;
  border-radius: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  gap: 6px;
  font-size: 13px;
}

.lang-selector-mobile a { font-family: 'Montserrat', sans-serif; color: var(--primary); text-decoration: none; }
.lang-selector-mobile a.active { font-weight: 700; }

/* ========================================
   LANGUAGE SELECTOR (desktop pill)
   ======================================== */
.lang-selector-desktop {
  display: none; /* shown only at >=768px, see media query below */
  position: fixed;
  top: 25px;
  right: 130px; /* leaves room for the cart icon in .topbar-right */
  z-index: calc(var(--z-header) + 1);
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.95);
  padding: 6px 12px;
  border-radius: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.lang-selector-desktop a {
  font-family: 'Montserrat', sans-serif;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  transition: all 0.3s;
}

.lang-selector-desktop a.active { background: var(--primary); color: white; }
.lang-selector-desktop a:hover { background: #eee; }

/* ========================================
   HAMBURGER (mobile sidebar toggle)
   ======================================== */
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  width: 50px; height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: calc(var(--z-sidebar) + 1);
}

.hamburger-icon .line {
  fill: var(--primary);
  transition: all 0.3s ease;
}

.hamburger[aria-expanded="true"] .top { transform: translateY(20px) rotate(45deg); }
.hamburger[aria-expanded="true"] .mid { opacity: 0; }
.hamburger[aria-expanded="true"] .bot { transform: translateY(-20px) rotate(-45deg); }

/* ========================================
   CART ICON / COUNT
   ======================================== */
.cart-icon {
  position: relative;
  font-size: 1.85em;
  color: var(--primary);
  text-decoration: none;
}

.cart-count {
  position: absolute;
  top: -8px; right: -8px;
  background: var(--primary);
  color: white;
  font-size: 13px;
  font-weight: 700;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding-top: 1px;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ========================================
   SIDEBAR
   ======================================== */
#sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background-color: #F8F8F8;
  padding: 20px;
  position: fixed;
  top: 0; left: 0;
  overflow-y: auto;
  border-right: 1px solid #E0E0E0;
  z-index: var(--z-sidebar);
  transition: transform 0.3s ease;
  transform: translateX(-100%); /* hidden by default (mobile) */
}

#sidebar.open { transform: translateX(0); }

/* ========================================
   MAIN CONTENT
   ======================================== */
main {
  margin-left: calc(var(--sidebar-width) + 40px);
  width: calc(100% - (var(--sidebar-width) + 40px));
  max-width: 1280px;
  padding: 130px 20px 40px; /* top: topbar (100px) + breathing room */
  flex: 1;
  box-sizing: border-box;
}

.main-content h1 {
  font-size: 28px;
  margin-bottom: 25px;
  text-transform: uppercase;
  text-align: center;
  color: var(--primary);
}

/* ========================================
   HORIZONTAL REEL (related / recent posts)
   ======================================== */
.horizontal-reel-container {
  max-width: 100%;
  margin: 30px 0 40px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.horizontal-reel-container::-webkit-scrollbar { display: none; }

.horizontal-reel {
  display: flex;
  gap: 25px;
  padding-bottom: 20px;
  width: max-content;
}

.product-card {
  position: relative;
  flex-shrink: 0;
  width: 260px;
  min-height: 390px;
  background-color: #FFFFFF;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.product-card img { width: 200px; height: 200px; object-fit: contain; margin-bottom: 12px; }

.info-icon {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 20;
  font-size: 22px;
  cursor: pointer;
  color: var(--primary);
  background: rgba(255, 255, 255, 0.95);
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========================================
   OVERLAY
   ======================================== */
.img-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 12px;
}

.overlay {
  display: none;
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 200px;
  background-color: rgba(74, 44, 89, 0.93);
  color: #FFFFFF;
  padding: 55px 15px 15px;
  box-sizing: border-box;
  font-size: 13.2px;
  line-height: 1.45;
  overflow-y: auto;
  z-index: 10;
  border-radius: 8px 8px 0 0;
}

.overlay p { color: #FFFFFF; margin: 4px 0; }

.product-card:hover .overlay,
.product-card .overlay.active { display: block; }

.card-body {
  position: relative;
  z-index: 15;
  width: 100%;
  text-align: center;
}

.product-card h3 { font-size: 16px; margin: 10px 0 8px; color: var(--primary); min-height: 48px; }
.product-card .price { font-size: 17px; font-weight: bold; color: var(--primary); margin: 8px 0 12px; }

.product-card .buy-button {
  margin-top: auto;
  width: 100%;
  padding: 10px 24px;
  background-color: var(--primary);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
  text-align: center;
}

/* ========================================
   RESPONSIVE: DESKTOP (>=768px)
   ======================================== */
@media (min-width: 768px) {
  .mobile-header { display: none; }
  .topbar { display: flex; }
  .lang-selector-desktop { display: flex; }
  .lang-selector-mobile { display: none; }

  .logo { height: 140px; max-height: none; }

  #sidebar { transform: translateX(0); padding-top: 25px; }
}

/* ========================================
   RESPONSIVE: MOBILE (<=767px)
   ======================================== */
@media (max-width: 767px) {
  #sidebar {
    width: 85%;
    max-width: 320px;
    padding-top: 80px; /* clears the 70px mobile-header */
    padding-bottom: 20px;
    box-sizing: border-box;
  }

  #sidebar.open { transform: translateX(0); }

  main { margin-left: 0; width: 100%; padding: 90px 20px 40px; }

  .horizontal-reel {
    flex-wrap: wrap;
    width: 100%;
    gap: 15px;
    justify-content: center;
  }

  .product-card { width: calc(50% - 8px); min-height: 380px; }
}
/* ===================== PRODUCT GRID ===================== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));   /* ← Más angosto */
  gap: 20px;
  margin: 30px 0;
}

@media (max-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: 1fr;   /* ← Una sola columna en mobile */
    gap: 18px;
  }
}

