:root {
  --primary: #4A2C59; /* dominant color in this page — see note about the 3 purples in use across the site */
  --sidebar-width: 240px; /* matches style.css */
  --z-sidebar: 1500;
  --z-header: 1400;
  --z-lang: 1500;
}

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

/* ========================================
   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 .header, floating separately */
  padding: 0 30px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

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

/* Desktop logo: injected by default into the sidebar by the worker,
   using the shared .logo class below — no separate box needed here. */

.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; /* guards against an icon font (e.g. Font Awesome) leaking in */
  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 {
  position: fixed;
  top: 0 !important;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: #f8f8f8;
  padding: 20px;
  overflow-y: auto;
  border-right: 1px solid #e0e0e0;
  z-index: 1700 !important;           /* ← Más alto que todo */
  transition: transform 0.3s ease;
  transform: translateX(-100%);
  box-shadow: 4px 0 15px rgba(0,0,0,0.2);
}

/* Cuando está abierto */
#sidebar.open {
  transform: translateX(0);
}

#sidebar > *:first-child { margin-top: 0; }


@media (max-width: 767px) {
  #sidebar .logo-container { display: none; }
}

#sidebar h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 15px;
  text-transform: uppercase;
}

#sidebar details { margin-bottom: 15px; }
#sidebar details:first-of-type { margin-bottom: 25px; }

#sidebar summary {
  font-size: 16px;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  padding: 5px 0;
  display: flex;
  align-items: center;
}

#sidebar summary i { margin-right: 10px; color: var(--primary); }
#sidebar ul { list-style: none; padding: 0 0 0 20px; margin: 10px 0; }
#sidebar li { margin: 5px 0; }

.nav-link {
  font-size: 14px;
  color: var(--primary);
  text-decoration: none;
  display: block;
  padding: 5px 10px;
  border-radius: 3px;
  transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active { background-color: var(--primary); color: #FFFFFF; }

/* ========================================
   MAIN CONTENT
   ======================================== */
main {
  margin-left: calc(var(--sidebar-width) + 40px);
  width: calc(100% - (var(--sidebar-width) + 40px));
  padding: 20px;
  flex: 1;
}

main h1 { font-size: 24px; color: var(--primary); margin-bottom: 20px; }

/* ========================================
   BANNER CAROUSEL
   ======================================== */
.banner-carousel {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 50px auto 40px;
  overflow: hidden;
}

.banner-container { display: flex; transition: transform 0.5s ease; width: 100%; min-height: 300px; }
.banner-item { flex: 0 0 100%; width: 100%; height: 300px; background-color: #f8f8f8; }
.banner-item img { width: 100%; height: 100%; object-fit: contain; border-radius: 5px; display: block; }

.banner-nav {
  position: absolute;
  top: 50%;
  width: 100%;
  display: flex;
  justify-content: space-between;
  transform: translateY(-50%);
}

.banner-nav button {
  background: rgba(74, 44, 89, 0.7);
  color: #FFFFFF;
  border: none;
  padding: 10px;
  cursor: pointer;
  font-size: 18px;
  border-radius: 5px;
}

.banner-nav button:hover { background: var(--primary); }

/* ========================================
   SEARCH
   ======================================== */
.search-container { position: relative; max-width: 600px; margin: 20px auto; }

.search-input {
  width: 100%;
  padding: 10px 40px 10px 15px;
  font-size: 16px;
  font-family: 'Montserrat', sans-serif;
  border: 1px solid #E0E0E0;
  border-radius: 5px;
  outline: none;
  color: var(--primary);
  box-sizing: border-box;
}

.search-input::placeholder { color: #7B4F8C; }

.search-icon {
  position: absolute;
  top: 50%; right: 10px;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--primary);
}

.search-suggestions {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: #FFFFFF;
  border: 1px solid #E0E0E0;
  border-radius: 5px;
  list-style: none;
  padding: 0; margin: 0;
  max-height: 200px;
  overflow-y: auto;
  z-index: 150;
  display: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.search-suggestions li {
  padding: 10px 15px;
  font-size: 14px;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-suggestions li:hover,
.search-suggestions li.focused { background: var(--primary); color: #FFFFFF; }

/* ========================================
   SECTION TITLES / PROVINCE & WINERY GRIDS
   ======================================== */
.section-title {
  font-size: 22px;
  color: var(--primary);
  margin: 20px 0 10px;
  text-align: center;
  text-transform: uppercase;
}

.province-grid, .winery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 40px;
  position: relative;
}

.province-card, .winery-card {
  position: relative;
  width: 200px; height: 200px;
  overflow: hidden;
  border-radius: 5px;
  display: block;
}

.province-card img, .winery-card img { width: 100%; height: 100%; object-fit: cover; }

.province-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(74, 44, 89, 0.7);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.province-card:hover .province-overlay { opacity: 1; }
.province-card .province-name { display: none; }

.winery-card img.logo {
  width: 100%; height: 100%;
  object-fit: contain;
  background: #FFFFFF;
  padding: 10px;
  box-sizing: border-box;
}

.winery-nav {
  position: absolute;
  top: 50%; width: 100%;
  display: flex;
  justify-content: space-between;
  transform: translateY(-50%);
  z-index: 10;
}

.winery-nav button {
  background: rgba(74, 44, 89, 0.7);
  color: #FFFFFF;
  border: none;
  padding: 8px;
  cursor: pointer;
  font-size: 16px;
  border-radius: 5px;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.winery-nav button:hover { background: var(--primary); opacity: 1; }
.winery-nav button.hidden { display: none; }

/* ========================================
   RECENTLY ADDED CAROUSEL
   ======================================== */
.recently-added-carousel { position: relative; max-width: 1200px; margin: 20px auto; overflow: hidden; }
.recent-container { display: flex; flex-wrap: nowrap; transition: transform 0.5s ease; width: calc(100% * 3); }

.recent-item {
  flex: 0 0 16.66%;
  max-width: 250px;
  margin-right: 30px;
  box-sizing: border-box;
  background-color: #FFFFFF;
  border: 1px solid #E0E0E0;
  border-radius: 5px;
  padding: 15px;
  padding-bottom: 20px;
  position: relative;
  overflow: visible;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.recent-item img { width: 200px; height: 200px; object-fit: contain; margin: 0 auto; }

.recent-item h3 {
  font-size: 16px;
  margin: 10px 0;
  color: var(--primary);
  min-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  text-align: center;
  width: 100%;
}

.recent-item .price {
  font-size: 16px;
  color: var(--primary);
  margin: 10px 0;
  position: relative;
  z-index: 7;
  text-align: center;
  width: 100%;
}

.recent-item .buy-button {
  padding: 8px 16px;
  font-size: 14px;
  margin-top: 10px;
  margin-bottom: 15px;
  position: relative;
  z-index: 7;
  text-align: center;
  background-color: var(--primary);
  color: #f5e6ff;
  text-decoration: none;
  border-radius: 5px;
  pointer-events: auto;
  width: 100%;
  max-width: 180px;
  display: block;
}

.recent-item .buy-button:hover { background-color: #5A1D39; }

.recent-nav {
  position: absolute;
  top: 50%; width: 100%;
  display: flex;
  justify-content: space-between;
  transform: translateY(-50%);
}

.recent-nav button {
  background: rgba(74, 44, 89, 0.7);
  color: #FFFFFF;
  border: none;
  padding: 10px;
  cursor: pointer;
  font-size: 18px;
  border-radius: 5px;
}

.recent-nav button:hover { background: var(--primary); }

/* ========================================
   INFO ICON / OVERLAY (shared by recent-item and product-card)
   ======================================== */
.info-icon {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  display: none;
  color: var(--primary);
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  width: 40px; height: 40px;
  line-height: 40px;
  text-align: center;
  touch-action: manipulation;
  pointer-events: auto;
}

.overlay {
  display: none;
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  max-height: 150px;
  background-color: rgba(74, 44, 89, 0.8);
  color: #FFFFFF;
  padding: 40px 10px 10px 10px;
  box-sizing: border-box;
  font-size: 12px;
  overflow-y: auto;
  z-index: 6;
  pointer-events: none;
}

.overlay p { margin: 2px 0; color: #FFFFFF; text-align: left; }

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

.overlay.active { display: block !important; }

/* ========================================
   PRODUCT GRID
   ======================================== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
  max-width: 1200px;
  margin-bottom: 30px;
  width: 100%;
  justify-content: start;
}

.product-card {
  background-color: #FFFFFF;
  border: 1px solid #E0E0E0;
  border-radius: 5px;
  padding: 15px;
  padding-bottom: 20px;
  position: relative;
  overflow: visible;
  max-width: 250px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  width: 100%;
  pointer-events: auto;
}

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

.product-card h3 {
  font-size: 16px;
  margin: 10px 0;
  color: var(--primary);
  min-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  text-align: center;
  width: 100%;
}

.product-card .price,
.product-card .price-per-liter,
.product-card .shipping-note { text-align: center; width: 100%; margin: 4px 0; line-height: 1.3; }

.product-card .price { font-size: 1em; font-weight: bold; color: #6B2D8F; }
.product-card .price-per-liter { font-size: 0.9em; color: #666; }
.product-card .shipping-note { font-size: 0.8em; color: #999; font-style: italic; }

.product-card .buy-button {
  padding: 8px 16px;
  font-size: 14px;
  margin-top: 10px;
  margin-bottom: 15px;
  position: relative;
  z-index: 7;
  text-align: center;
  background-color: var(--primary);
  color: #f5e6ff;
  text-decoration: none;
  border-radius: 5px;
  pointer-events: auto;
  width: 100%;
  max-width: 180px;
  display: block;
}

.product-card .buy-button:hover { background-color: #5A1D39; }

/* ========================================
   TWITTER / TWEET CAROUSEL
   ======================================== */
.twitter-box {
  max-width: 600px;
  margin: 20px auto;
  padding: 20px;
  border: 1px solid #E0E0E0;
  border-radius: 5px;
  font-family: 'Montserrat', sans-serif;
  text-align: center;
}

.twitter-box .section-title { font-size: 22px; color: var(--primary); margin: 0 0 10px; text-transform: uppercase; }

.tweet-carousel { position: relative; width: 100%; overflow: hidden; }
.tweet-container { display: flex; transition: transform 0.5s ease; width: 100%; min-height: 150px; }
.tweet-item { flex: 0 0 100%; width: 100%; padding: 10px; box-sizing: border-box; border-bottom: 1px solid #E0E0E0; }
.tweet-item p { margin: 5px 0; color: var(--primary); font-size: 14px; }
.tweet-item a { color: #1DA1F2; text-decoration: none; font-size: 14px; }
.tweet-item a:hover { text-decoration: underline; }
.tweet-item .fallback { font-size: 14px; color: var(--primary); margin: 10px 0; }

.tweet-nav {
  position: absolute;
  top: 50%; width: 100%;
  display: flex;
  justify-content: space-between;
  transform: translateY(-50%);
}

.tweet-nav button {
  background: rgba(74, 44, 89, 0.7);
  color: #FFFFFF;
  border: none;
  padding: 8px;
  cursor: pointer;
  font-size: 16px;
  border-radius: 5px;
}

.tweet-nav button:hover { background: var(--primary); }

/* ========================================
   RESPONSIVE: DESKTOP (>=768px) — single breakpoint, matches style.css
   ======================================== */
@media (min-width: 768px) {
  .banner-carousel { margin-top: 50px; }

  .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; }

  .info-icon { display: none; }
  .winery-nav { display: none; }
  .recent-nav { display: flex; }
  .winery-grid.has-left, .winery-grid.has-right { box-shadow: none; }
}

/* ========================================
   RESPONSIVE: MOBILE (<=767px)
   ======================================== */
@media (max-width: 767px) {
  body { display: block; }

  #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; margin-top: 60px; padding: 10px; width: 100%; }
  main h1 { font-size: 20px; line-height: 1.4; margin-bottom: 15px; }

  .banner-carousel { margin: -15px auto 20px; }
  .banner-container { min-height: 200px; }
  .banner-item { height: 200px; }

  .search-container { max-width: 100%; padding: 0 10px; }
  .search-input { font-size: 14px; padding: 8px 35px 8px 12px; }
  .search-icon { font-size: 16px; right: 12px; }
  .search-suggestions { font-size: 12px; }
  .search-suggestions li { padding: 8px 12px; }

  .province-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; }

  .winery-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 15px;
    padding: 0 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .winery-grid::-webkit-scrollbar { display: none; }
  .winery-grid.has-right { box-shadow: 8px 0 8px -8px rgba(0, 0, 0, 0.3); }
  .winery-grid.has-left { box-shadow: -8px 0 8px -8px rgba(0, 0, 0, 0.3); }

  .province-card, .winery-card { width: 100%; height: 150px; }
  .winery-card { flex: 0 0 150px; height: 150px; }

  .province-card .province-overlay { display: none; }
  .province-card .province-name {
    display: block;
    position: absolute;
    top: 10px; left: 10px;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 600;
    background: rgba(74, 44, 89, 0.7);
    padding: 5px 10px;
    border-radius: 3px;
    z-index: 10;
  }

  .winery-card img.logo { padding: 5px; max-width: 100%; }

  .recently-added-carousel { margin: 10px auto; }
  .recent-container { width: calc(100% * 3); }
  .recent-item { flex: 0 0 140px; max-width: 140px; margin-right: 15px; min-height: 260px; padding: 10px; }
  .recent-item img { width: 140px; height: 140px; }
  .recent-item h3 { font-size: 14px; min-height: 36px; margin: 5px 0; }
  .recent-item .price { font-size: 14px; margin: 5px 0; }
  .recent-item .buy-button { padding: 6px 12px; font-size: 12px; margin-top: 5px; margin-bottom: 5px; max-width: 140px; }
  .recent-item:hover .overlay { display: none; } /* no hover on mobile, use info-icon tap instead */

  .recent-nav button { padding: 6px; font-size: 14px; }

  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; }

  .twitter-box { max-width: 100%; padding: 10px; }
  .twitter-box .section-title { font-size: 18px; }
  .tweet-item p, .tweet-item .fallback { font-size: 12px; }
  .tweet-item a { font-size: 12px; }
  .tweet-container { min-height: 120px; }
  .tweet-nav button { padding: 6px; font-size: 14px; }
}
