@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Onest:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --color-primary: #A9463D;
  --color-primary-hover: #8D352E;
  --color-primary-light: rgba(169, 70, 61, 0.1);
  --color-secondary: #35443A;
  --color-secondary-light: #E5EBE6;
  --color-accent: #D99A42;
  --color-accent-light: #FFF0D8;
  --color-background: #F6F2EC;
  --color-background-light: #FCFAF7;
  --color-surface: #FBFAF8;
  --color-text-primary: #2A2724;
  --color-text-secondary: #6F6963;
  --color-text-muted: #99918A;
  --color-border: #DED7CF;
  --color-footer: #312B29;
  --color-success: #43805A;
  --color-error: #B8413B;

  --font-heading: 'Onest', sans-serif;
  --font-body: 'Manrope', sans-serif;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-background);
  color: var(--color-text-primary);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: var(--font-heading);
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: var(--font-body);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--color-background);
}
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* Utility Classes */
.bg-primary { background-color: var(--color-primary); }
.bg-surface { background-color: var(--color-surface); }
.bg-background { background-color: var(--color-background); }
.bg-footer { background-color: var(--color-footer); }
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-accent { color: var(--color-accent); }
.text-white { color: #ffffff; }

.hover-scale {
  transition: transform 0.2s ease;
}
.hover-scale:hover {
  transform: scale(1.03);
}

.transition-colors {
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.shadow-card {
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background-color: var(--color-primary);
  color: white;
}
.btn-primary:hover {
  background-color: var(--color-primary-hover);
}
.btn-outline {
  background-color: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-text-primary);
}
.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-outline-primary {
  background-color: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}
.btn-outline-primary:hover {
  background-color: var(--color-primary);
  color: white;
}

.badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: white;
}

.input-field {
  width: 100%;
  padding: 14px 20px;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  font-family: var(--font-body);
}
.input-field:focus {
  border-color: var(--color-primary);
}

/* Header & Nav */
.top-bar {
  background-color: var(--color-footer);
  color: white;
  padding: 10px 0;
  font-size: 13px;
}
.main-header {
  background-color: var(--color-surface);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-bar {
  background-color: var(--color-background-light);
  border-bottom: 1px solid var(--color-border);
}
.nav-link {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
  transition: opacity 0.2s;
}
.nav-link:hover {
  opacity: 0.7;
}

/* Home Sidebar */
.catalog-menu-item {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
  transition: background-color 0.2s, color 0.2s;
}
.catalog-menu-item:hover, .catalog-menu-item.active {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}

/* Catalog mega menu (hero sidebar): panel over the hero slider with subcategories */
.catalog-sidebar {
  position: relative;
}
.catalog-mega {
  position: absolute;
  top: 0;
  /* sidebar is col-lg-3, hero col-lg-9 with a 24px gutter (g-4) */
  left: calc(100% + 24px);
  width: calc(300% + 48px);
  height: 100%;
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 28px 32px;
  background: var(--color-surface);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(42, 39, 36, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.catalog-mega.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.catalog-mega__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}
.catalog-mega__title {
  font-size: 24px;
  font-weight: 700;
}
.catalog-mega__all {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
}
.catalog-mega__grid {
  flex: 1;
  overflow-y: auto;
  column-count: 3;
  column-gap: 32px;
}
.catalog-mega__group {
  break-inside: avoid;
  margin-bottom: 18px;
}
.catalog-mega__link {
  display: inline-block;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-primary);
  text-decoration: none;
  transition: color 0.15s;
}
.catalog-mega__link--heading {
  font-weight: 700;
  margin-bottom: 8px;
}
.catalog-mega__sub {
  list-style: none;
  margin: 0;
  padding: 0;
}
.catalog-mega__sub li + li {
  margin-top: 6px;
}
.catalog-mega__sub a {
  font-size: 14px;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}
.catalog-mega__link:hover,
.catalog-mega__sub a:hover,
.catalog-mega__all:hover {
  color: var(--color-primary);
}
.catalog-mega__count {
  margin-left: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
}
.catalog-menu-item.is-mega-open {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}
@media (max-width: 991px) {
  .catalog-mega {
    display: none;
  }
}

/* Cart Badge */
.cart-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background-color: var(--color-primary);
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
}

/* Range Slider */
.range-slider {
  position: relative;
  height: 4px;
  background-color: var(--color-border);
  border-radius: 2px;
  margin: 16px 0 20px;
}
.range-slider .track {
  position: absolute;
  height: 100%;
  background-color: var(--color-primary);
  border-radius: 2px;
}
.range-slider .thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: white;
  border: 2px solid var(--color-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
}

/* Footer */
.footer {
  background-color: var(--color-footer);
  color: white;
  margin-top: 64px;
}
.footer-link {
  color: rgba(255,255,255,0.7);
  font-size: 15px;
  transition: opacity 0.2s;
}
.footer-link:hover {
  opacity: 1;
}

.mobile-only {
  display: none !important;
}
.desktop-only {
  display: block !important;
}

/* Display flex override for specific desktop elements */
.top-bar.desktop-only,
.main-header.desktop-only,
.nav-bar.desktop-only {
  display: block !important; /* Bootstrap resets sometimes, so block is fine as it wraps container */
}

/* Responsive Overrides */
@media (max-width: 991px) {
  .top-bar.desktop-only,
  .main-header.desktop-only,
  .nav-bar.desktop-only {
    display: none !important;
  }

  .hero-layout {
    flex-direction: column;
  }
  .hero-sidebar {
    width: 100% !important;
  }
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: flex !important;
  }

  body {
    overflow-x: hidden;
  }

  .mobile-only {
    min-height: 64px;
  }

  .footer {
    margin-top: 40px;
  }

  .hero-layout .col-12 {
    margin-bottom: 0;
  }
}

/* Mobile navigation injected by the vanilla-JS shell. */
.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(42, 39, 36, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.mobile-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 111;
  width: min(84vw, 340px);
  padding: 24px;
  overflow-y: auto;
  background: var(--color-surface);
  box-shadow: 18px 0 48px rgba(42, 39, 36, 0.18);
  transform: translateX(-105%);
  transition: transform 0.25s ease;
}
body.mobile-drawer-open {
  overflow: hidden;
}
body.mobile-drawer-open .mobile-drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}
body.mobile-drawer-open .mobile-drawer {
  transform: translateX(0);
}
.mobile-drawer__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
  font-weight: 700;
}
.mobile-search {
  position: fixed;
  top: 76px;
  left: 16px;
  right: 16px;
  z-index: 109;
  display: none;
  padding: 12px;
  background: var(--color-surface);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(42, 39, 36, 0.18);
}
.mobile-search.is-open {
  display: block;
}

.mobile-filter-control {
  display: none;
}

@media (max-width: 991px) {
  .mobile-filter-control {
    display: block;
    margin: 0 0 18px;
  }

  .mobile-filter-panel {
    display: none;
    margin: 0 0 18px;
    padding: 18px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(42, 39, 36, 0.08);
  }

  .mobile-filter-panel.is-open {
    display: block;
  }
}

/* Product page: name/characteristics block + purchase box, side by side */
.product-info-panel {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.product-info-panel__main {
  flex: 1;
  min-width: 0;
}
.product-info-panel__buybox {
  width: 320px;
  flex-shrink: 0;
}
@media (max-width: 991px) {
  .product-info-panel {
    flex-direction: column;
  }
  .product-info-panel__buybox {
    width: 100%;
  }
}
