/* =========================
   DESIGN TOKENS
   ========================= */

:root {
  --primary: #007adb;
  --primary-light: #bfe8fc;
  --secondary: #222;
  --accent: #ff9800;
  --text-main: #333;
  --text-muted: #666;
  --bg-body: #f8f9fa;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
  --radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================
   RESET / BASE
   ========================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-y: scroll;
  /* Force scrollbar to prevent layout shift */
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-top: 40px;
  background-color: var(--bg-body);
  color: var(--text-main);
  min-width: 320px;
  overflow-x: hidden;
  line-height: 1.6;
}



/* =========================
   TOP INFO BAR
   ========================= */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 35px;
  background-color: var(--secondary);
  color: white;
  font-size: 13px;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.top-bar-content {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-bar a {
  color: #ccc;
  text-decoration: none;
  margin-left: 20px;
  transition: var(--transition);
}

.top-bar a:hover {
  color: white;
}


/* =========================
   HEADER / LOGO
   ========================= */

header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px 40px;
  background: white;
  border-bottom: 1px solid #eee;
}

.logo-icon {
  max-width: 200px;
  width: 100%;
  height: auto;
  transition: var(--transition);
}

.logo-icon:hover {
  transform: scale(1.05);
}


/* =========================
   CATALOG BANNER (Navigation)
   ========================= */

.catalog-banner {
  display: flex;
  justify-content: center;
  gap: 15px;
  padding: 5px 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--glass-border);

  position: relative;
  /* Added to make z-index work */
  top: 0;
  z-index: 1100;
  box-shadow: var(--shadow-sm);
}

@media screen and (max-width: 768px) {
  .catalog-banner {
    position: sticky;
    top: 0;
    z-index: 1200;
  }
}

/* =========================
   DROPDOWN BASE
   ========================= */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropbtn {
  text-decoration: none;
  font-weight: 600;
  color: var(--text-main);
  padding: 12px 20px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  /* Ensure 44px touch target */
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  border-radius: var(--radius);
}

.dropbtn:hover {
  background: rgba(0, 122, 219, 0.05);
  color: var(--primary);
}

/* =========================
   DROPDOWN CONTENT
   ========================= */

.dropdown-content {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background-color: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1500;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  padding: 8px;
  transition: var(--transition);
}

.dropdown-content a {
  display: block;
  padding: 12px 16px;
  min-height: 44px;
  /* Ensure 44px touch target */
  text-decoration: none;
  color: var(--text-main);
  white-space: nowrap;
  border-radius: 8px;
  transition: var(--transition);
  font-size: 14.5px;
}

.dropdown-content a:hover {
  background-color: rgba(0, 122, 219, 0.1);
  color: var(--primary);
  transform: translateX(5px);
}

/* =========================
   NESTED DROPDOWN STYLES
   ========================= */

.nested-dropdown {
  position: relative;
  display: block;
}

.nested-dropbtn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  color: var(--text-main);
  border-radius: 8px;
  transition: var(--transition);
}

.nested-dropbtn:hover {
  background-color: rgba(0, 122, 219, 0.1);
  color: var(--primary);
}

.nested-dropbtn::after {
  content: "→";
  font-size: 12px;
  margin-left: 10px;
  transition: var(--transition);
}

.nested-dropdown-content {
  position: absolute;
  top: 0;
  left: 100%;
  margin-left: 5px;
  min-width: 200px;
  background-color: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1600;
  opacity: 0;
  visibility: hidden;
  transform: translateX(10px);
  padding: 8px;
  transition: var(--transition);
}

/* =========================
   HOVER STATES
   ========================= */

/* Desktop hover */
@media (hover: hover) and (pointer: fine) {
  .dropdown:hover>.dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nested-dropdown:hover>.nested-dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
  }
}

/* Mobile active styles (from script) */
.dropdown.open>.dropdown-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nested-dropdown.open>.nested-dropdown-content {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}





/* =========================
   CATEGORY HERO (Subpages)
   ========================= */

.category-hero {
  background-size: cover;
  background-position: center;
  height: 350px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  text-align: center;
  padding: 40px 20px;
  margin-top: 35px;
  width: 100%;
}

.category-hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 15px;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  letter-spacing: -1px;
}

.category-hero p {
  max-width: 800px;
  font-size: 1.25rem;
  margin: 0 auto;
  line-height: 1.5;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

@media screen and (max-width: 768px) {
  .category-hero {
    height: 300px;
    padding: 30px 20px;
  }

  .category-hero h1 {
    font-size: 2.5rem;
  }

  .category-hero p {
    font-size: 1.1rem;
  }
}

@media screen and (max-width: 480px) {
  .category-hero {
    height: 250px;
    padding: 20px 15px;
  }

  .category-hero h1 {
    font-size: 2rem;
  }

  .category-hero p {
    font-size: 0.95rem;
  }
}


@media screen and (min-width: 1441px) {
  .category-hero {
    height: 450px;
  }

  .category-hero h1 {
    font-size: 4.5rem;
  }
}

/* =========================
   SUBCATEGORIES GRID
   ========================= */

.sub-categories {
  max-width: 1200px;
  margin: 0 auto 80px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
  gap: 32px;
}

.sub-card {
  background: white;
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  border: 1px solid #f0f0f0;
  scroll-margin-top: 100px;
  height: 100%;
}

.sub-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.sub-card h3 {
  color: var(--primary);
  font-size: 1.5rem;
  margin-bottom: 15px;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 10px;
}

.sub-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
}

.sub-card p {
  color: var(--text-muted);
  line-height: 1.8;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

  *,
  ::before,
  ::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
    transition-delay: -1ms !important;
  }
}


/* =========================
   HERO SLIDER
   ========================= */

.hero-slider {
  position: relative;
  width: 100%;
  height: 500px;
  overflow: hidden;
  z-index: 1;
}

.slides {
  width: 100%;
  height: 100%;
}

.slide {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.slide.active {
  opacity: 1;
}

/* Botones */
.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  color: white;
  border: none;
  font-size: 30px;
  padding: 10px 15px;
  cursor: pointer;
  z-index: 5;
}

.nav.prev {
  left: 10px;
}

.nav.next {
  right: 10px;
}

.nav:hover {
  background: rgba(0, 0, 0, 0.6);
}



/* =========================
   CONTENT SECTIONS
   ========================= */

.content {
  display: flex;
  gap: 40px;
  padding: 60px;
}


/* =========================
   FOOTER
   ========================= */

footer {
  background: #f1f1f1;
  padding: 20px;
  text-align: center;
}

.social-icon {
  width: 24px;
  margin-top: 10px;
}


/* =========================
   MOBILE RESPONSIVE STYLES
   ========================= */

@media screen and (max-width: 768px) {

  /* Body adjustment */
  body {
    padding-top: 70px;
    font-size: 16px;
  }

  /* Top bar mobile */
  .top-bar {
    height: auto;
    min-height: 65px;
  }

  .top-bar-content {
    flex-direction: column;
    padding: 10px 15px;
    gap: 8px;
    align-items: flex-start;
    width: 100%;
  }

  .top-bar-content span {
    display: block;
    font-size: 13px;
    line-height: 1.4;
  }

  .top-bar-icons {
    display: flex;
    gap: 15px;
    width: 100%;
  }

  .top-bar-icons a {
    margin-left: 0;
    font-size: 13px;
    padding: 5px 0;
  }

  /* Header/Logo mobile */
  header {
    padding: 15px 20px;
  }

  .logo-icon {
    max-width: 180px;
  }

  /* Catalog banner mobile - horizontal scroll */
  .catalog-banner {
    overflow-x: auto;
    overflow-y: visible;
    /* Changed from hidden to allow dropdowns */
    justify-content: flex-start;
    gap: 5px;
    padding: 10px 15px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .catalog-banner::-webkit-scrollbar {
    height: 6px;
  }

  .catalog-banner::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
  }

  .catalog-banner::-webkit-scrollbar-thumb {
    background: #007adb;
    border-radius: 3px;
  }

  /* Dropdown buttons mobile */
  .dropdown {
    flex-shrink: 0;
  }

  .dropbtn {
    padding: 10px 15px;
    font-size: 15px;
    display: block;
  }

  /* Dropdown content mobile */
  .dropdown-content {
    min-width: 200px;
    max-width: 90vw;
  }

  .dropdown-content a {
    padding: 14px 18px;
    font-size: 15px;
    border-bottom: 1px solid #f0f0f0;
  }

  /* Nested dropdown mobile - show below instead of to the side */
  .nested-dropdown-content {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    box-shadow: none;
    background-color: #f9f9f9;
    margin-left: 0;
    padding-left: 20px;
    border-left: 3px solid #007adb;
  }

  .nested-dropdown.open .nested-dropdown-content {
    opacity: 1;
    transform: none;
    pointer-events: auto;
    display: block;
  }

  .nested-dropdown-content a {
    background-color: #f9f9f9;
  }

  .nested-dropbtn {
    padding: 14px 18px;
    font-size: 15px;
  }

  .nested-dropbtn::after {
    content: "▼";
  }

  .nested-dropdown.open .nested-dropbtn::after {
    content: "▲";
  }

  /* Hero slider mobile */
  .hero-slider {
    height: 320px;
    width: 100%;
  }

  .nav {
    font-size: 24px;
    padding: 10px 15px;
  }

  .nav.prev {
    left: 8px;
  }

  .nav.next {
    right: 8px;
  }

  /* Content sections mobile */
  .content {
    flex-direction: column;
    gap: 30px;
    padding: 40px 20px;
  }

  .content h2 {
    font-size: 1.4em;
  }

  .content p {
    font-size: 1em;
    line-height: 1.6;
  }

  /* Footer mobile */
  footer {
    padding: 20px 15px;
    font-size: 0.95em;
  }
}

/* Extra small phones */
@media screen and (max-width: 480px) {
  body {
    padding-top: 35px !important;
    /* Space for fixed top bar */
  }

  /* Ultra-compact Top Bar - Everything on one line */
  .top-bar {
    height: 34px !important;
    min-height: 34px !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 10000 !important;
    background: #222 !important;
  }

  .top-bar-content {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
    align-items: center !important;
    padding: 0 10px !important;
    height: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .top-bar-content span,
  .top-bar-icons a {
    font-size: 9px !important;
    /* Very small to fit everything */
    white-space: nowrap !important;
    color: white !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
  }

  /* Abbreviate labels if needed, but here we just fit them */
  .top-bar-content span:nth-child(1) {
    justify-self: start !important;
    display: flex !important;
    align-items: center !important;
  }

  .top-bar-content span:nth-child(2) {
    justify-self: center !important;
    display: flex !important;
    align-items: center !important;
  }

  .top-bar-icons {
    justify-self: end !important;
    display: flex !important;
    gap: 8px !important;
  }

  .top-bar-content span,
  .top-bar-icons a {
    font-size: 9px !important;
    color: white !important;
    text-decoration: none !important;
  }

  /* Body padding for fixed bar */
  body {
    padding-top: 34px !important;
  }

  /* Category Hero Fix for tiny screens */
  .category-hero {
    margin-top: 0 !important;
  }

  /* Header - Centered Logo */
  header {
    margin: 0 !important;
    width: 100% !important;
    padding: 12px 15px !important;
    z-index: 1000 !important;
    background: white !important;
    display: flex !important;
    justify-content: center !important;
    position: relative !important;
  }

  .logo-icon {
    max-width: 150px !important;
    height: auto !important;
  }

  /* Navigation Banner - Grid Layout (No scrolling) */
  .catalog-banner {
    position: relative !important;
    z-index: 1500 !important;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    padding: 10px !important;
    margin-bottom: -105px !important;
    /* Adjusted for 2-row height */
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    overflow-x: visible !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
  }

  /* Ensure hero slider doesn't have its own relative/absolute conflicts */
  .hero-slider,
  .category-hero {
    position: relative !important;
    z-index: 1 !important;
    margin-top: 0 !important;
  }

  .dropbtn {
    padding: 10px 5px !important;
    font-size: 11px !important;
    background: white !important;
    color: var(--text-main) !important;
    border-radius: 12px !important;
    margin: 0 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    text-align: center !important;
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: 40px !important;
  }

  .dropdown-content {
    z-index: 2000 !important;
    /* Above everything */
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    background: white !important;
  }

  .dropdown.open>.dropdown-content {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  /* Force Hero to fit width */
  .hero-slider {
    height: 300px;
    z-index: 1;
    position: relative;
    width: 100%;
    margin-top: 0;
    transform: none;
  }

  .slide {
    object-fit: cover;
    /* Back to cover for better premium feel */
    width: 100%;
    height: 100%;
  }

  .nav {
    display: flex;
    /* Restore buttons */
    font-size: 18px;
    padding: 8px 12px;
  }

  .content {
    padding: 20px 10px;
  }

  .logo-icon {
    max-width: 130px;
  }
}

/* Tablet Landscape and medium screens */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .category-hero h1 {
    font-size: 3rem;
  }

  .catalog-banner {
    gap: 10px;
    padding: 5px 10px;
  }

  .dropbtn {
    padding: 10px 15px;
    font-size: 14px;
  }
}

/* Landscape mode on phones */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .hero-slider {
    height: 200px;
  }

  .top-bar {
    position: relative;
  }

  body {
    padding-top: 0;
  }
}

/* Product Card Images */
.sub-card .card-img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  border-radius: var(--radius);
  margin-bottom: 20px;
  background-color: #f8f9fa;
  padding: 10px;
  transition: transform 0.3s ease;
}

.sub-card:hover .card-img {
  transform: scale(1.02);
}

@media (max-width: 768px) {
  .sub-card .card-img {
    height: 180px;
  }
}

/* =========================
   PRODUCT LIST (Vertical)
   ========================= */

.product-list {
  max-width: 900px;
  margin: 40px auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0 20px;
}

.product-item {
  display: flex;
  align-items: center;
  gap: 30px;
  background: white;
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  border: 1px solid #f0f0f0;
}

.product-item:hover {
  transform: translateX(10px);
  box-shadow: var(--shadow-md);
}

.product-item img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8f9fa;
  padding: 10px;
  flex-shrink: 0;
}

.product-info {
  text-align: left;
}

.product-info h3 {
  color: var(--primary);
  margin-bottom: 8px;
  font-size: 1.3rem;
}

.product-info p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

@media screen and (max-width: 600px) {
  .product-item {
    flex-direction: column;
    text-align: center;
  }

  .product-info {
    text-align: center;
  }
}

/* Back Button Styles */
.back-nav {
  max-width: 900px;
  margin: 20px auto 0;
  padding: 0 20px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: white;
  color: var(--primary);
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 600;
  border: 1px solid var(--primary-light);
  transition: var(--transition);
  font-size: 0.9rem;
}

.btn-back:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateX(-5px);
}

/* WhatsApp Floating Bubble */
.whatsapp-bubble {
  position: fixed;
  bottom: 25px;
  right: 30px;
  width: 65px;
  height: 65px;
  background-color: #25d366;
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  z-index: 9999;
  transition: transform 0.3s ease, background-color 0.3s ease;
  text-decoration: none;

}

@media screen and (max-width: 480px) {
  .whatsapp-bubble {
    width: 55px;
    height: 55px;
    bottom: 15px;
    right: 15px;
  }

  .whatsapp-bubble svg {
    width: 30px;
    height: 30px;
  }
}

.whatsapp-bubble:hover {
  transform: scale(1.1);
  background-color: #128c7e;
}

.whatsapp-bubble svg {
  width: 35px;
  height: 35px;
  fill: white;
}

/* UI Refinements */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}