/* Mega Menu Plugin Styles */
.mega-menu-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  position: relative;
  z-index: 9999;
  width: 100%; /* Ensure full width coverage */
}

/* Smooth Marquee Slider Styles */
.smooth-marquee-wrapper {
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

.smooth-marquee-container {
  width: 100%;
  overflow: hidden;
  padding: 12px 0;
  position: relative;
  white-space: nowrap;
  box-sizing: border-box;
  margin: 0;
  border: none;
  background: #4ade80;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.smooth-marquee-content {
  display: inline-block;
  animation: smooth-scroll-left 25s linear infinite;
  will-change: transform;
  backface-visibility: hidden;
  perspective: 1000px;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.smooth-marquee-item {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 500;
  color: #ffffff;
  margin-right: 0;
  display: inline-block;
  font-size: 14px;
  line-height: 1.4;
  padding-right: 40px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.smooth-marquee-separator {
  margin: 0 20px;
  font-weight: bold;
  opacity: 0.8;
}

/* Hover effects - only on non-touch devices */
@media (hover: hover) and (pointer: fine) {
  .smooth-marquee-container:hover .smooth-marquee-content {
    animation-play-state: paused;
  }
}

/* Touch devices - pause on tap */
.smooth-marquee-container.paused .smooth-marquee-content {
  animation-play-state: paused;
}

@keyframes smooth-scroll-left {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* === CC Promo Rotator (self-contained, avoids conflicts) === */
.cc-promo-rotator {
  background: linear-gradient(135deg, #1a4d2e 0%, #2d5016 50%, #4a7c59 100%);
  color: white;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 10px;
  position: relative;
  overflow: hidden;
}

.cc-promo-item {
  display: none;
}

.cc-promo-item:first-child {
  display: block;
}

/* Main Navigation */
.mega-menu-nav {
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 9999;
  width: 100%; /* Full width for navigation */
}

/* Override Astra theme overflow hidden to prevent clipping */
.site-header,
.ast-primary-header-bar,
.main-header-bar,
.ast-above-header,
.ast-below-header,
.ast-mobile-header-wrap,
.main-header-bar,
.site-header,
.ast-container {
  overflow: visible !important;
}

.mega-menu-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 70px;
  width: 100%; /* Ensure inner container takes full width */
}

/* Logo */
.mega-menu-logo {
  flex: 0 0 auto;
}

.mega-menu-logo img {
  height: 40px;
  width: auto;
}

.mega-menu-logo-text {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  text-decoration: none;
}

/* Navigation Items */
.mega-menu-items {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  justify-content: center;
}

.mega-menu-item {
  position: static;
  margin: 0 25px;
}

.mega-menu-link {
  display: flex;
  align-items: center;
  padding: 20px 0;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  transition: color 0.3s ease;
}

.mega-menu-link:hover {
  color: #2d5016;
}

.mega-menu-dropdown-arrow {
  margin-left: 5px;
  font-size: 12px;
  transition: transform 0.3s ease;
}

.mega-menu-item:hover .mega-menu-dropdown-arrow {
  transform: rotate(180deg);
}

/* Right Side Icons */
.mega-menu-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.mega-menu-action {
  color: #333;
  font-size: 20px;
  text-decoration: none;
  transition: color 0.3s ease;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
}

.mega-menu-action:hover {
  color: #2d5016;
  background-color: rgba(45, 80, 22, 0.1);
}

/* Search Modal Styles */
.search-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.search-modal-overlay.active {
  display: flex;
}

.search-modal {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.search-modal-overlay.active .search-modal {
  transform: scale(1);
}

.search-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.search-modal-header h3 {
  margin: 0;
  color: #333;
  font-size: 24px;
  font-weight: 600;
}

.search-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 5px;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.search-modal-close:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.search-modal-form {
  display: flex;
  gap: 10px;
}

.search-modal-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.3s ease;
}

.search-modal-input:focus {
  border-color: #2d5016;
}

.search-modal-submit {
  background: #2d5016;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.search-modal-submit:hover {
  background: #1a3009;
}

/* Cart Badge Styles */
.cart-trigger {
  position: relative;
}

.cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #dc143c;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Mega Menu Dropdown */
.mega-menu-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: auto;
  box-sizing: border-box;
  transform: none;
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  /* Add safe padding with box-sizing */
  padding: 40px 20px;
  z-index: 9998;
  /* Ensure mega menu is never cropped on left side */
  left: 0 !important; /* Always start from left */
  right: 0 !important; /* Stretch full width */
  max-width: none !important; /* Allow full width */
  width: 100% !important; /* Force full width */
  margin: 0 auto !important; /* Center inside viewport */
}

/* Show dropdown on hover */
.mega-menu-item:hover .mega-menu-dropdown {
  opacity: 1;
  visibility: visible;
}

/* Product Categories Grid */
.mega-menu-categories {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* Fixed 4 columns for desktop horizontal layout */
  gap: 20px;
  margin: 0 auto; /* Center the grid container */
  max-width: 1200px; /* Limit max width and center content */
  /* Remove excessive left padding, use balanced padding */
  padding: 0 20px;
  /* Center content inside dropdown */
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.mega-menu-categories .mega-menu-category {
  display: grid !important;
  grid-template-rows: auto 1fr auto !important;
  justify-items: center !important;
  align-items: center !important;
  text-align: center !important;
  min-height: 260px !important;
  padding: 16px !important;
}

/* Flatten wrapper so its children (title + btn) can be placed on the parent grid */
.mega-menu-categories .mega-menu-category-content {
  display: contents !important;
}

/* Title: single centered line at the top (row 1) */
.mega-menu-categories .mega-menu-category-title {
  grid-row: 1 !important;
  justify-self: center !important;
  max-width: 85% !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  margin: 6px 0 2px !important;
}

/* Image: centered block in the middle (row 2) with contain sizing */
.mega-menu-categories .mega-menu-category-image {
  grid-row: 2 !important;
  place-self: center !important;
  position: static !important;
  width: clamp(120px, 42%, 220px) !important;
  height: clamp(120px, 42%, 220px) !important;
  margin: 6px 0 10px !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
  pointer-events: none !important; /* keep card fully clickable */
}

/* CTA: real pill button centered at the bottom (row 3) */
.mega-menu-categories .mega-menu-category .mega-menu-category-btn {
  grid-row: 3 !important;
  justify-self: center !important;
  align-self: end !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 42px !important;
  min-width: 140px !important;
  padding: 0 22px !important;
  white-space: nowrap !important;

  border-radius: 9999px !important;
  background: rgba(255, 255, 255, 0.95) !important;
  border: 2px solid #ffffff !important;
  color: #111827 !important;
  font-weight: 700 !important;
  letter-spacing: .2px !important;
  text-decoration: none !important;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15) !important;
  cursor: pointer !important;
}
.mega-menu-categories .mega-menu-category .mega-menu-category-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.2) !important;
}
.mega-menu-categories .mega-menu-category .mega-menu-category-btn::after {
  content: "→" !important;
  margin-left: 8px !important;
  line-height: 1 !important;
}

/* Responsive tweaks so the stacked layout holds on medium screens too */
@media (max-width: 1024px) {
  .mega-menu-categories .mega-menu-category-content {
    min-height: 240px !important;
    gap: 10px !important;
  }
  .mega-menu-categories .mega-menu-category .mega-menu-category-image {
    width: clamp(110px, 42%, 200px) !important;
    height: clamp(110px, 42%, 200px) !important;
  }
}

/* Category Color Variations */
.mega-menu-category[data-color="brown"] {
  background: linear-gradient(135deg, #8b4513 0%, #a0522d 100%);
}
.mega-menu-category[data-color="red"] {
  background: linear-gradient(135deg, #dc143c 0%, #b22222 100%);
}
.mega-menu-category[data-color="yellow"] {
  background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
}
.mega-menu-category[data-color="teal"] {
  background: linear-gradient(135deg, #20b2aa 0%, #008b8b 100%);
}
.mega-menu-category[data-color="orange"] {
  background: linear-gradient(135deg, #ffa500 0%, #ff8c00 100%);
}
.mega-menu-category[data-color="darkred"] {
  background: linear-gradient(135deg, #8b0000 0%, #a52a2a 100%);
}
.mega-menu-category[data-color="green"] {
  background: linear-gradient(135deg, #228b22 0%, #32cd32 100%);
}

/* ================================================
   Make "Shop Now" a real button (remove over‑scoping)
   Previously these rules were scoped with `.mega-menu ...` so
   they didn’t match. This version targets the CTA wherever it
   appears inside `.mega-menu-category-content`.
   ================================================ */
.mega-menu-category-content .mega-menu-category-btn,
.mega-menu-category-content a.shop-now,
.mega-menu-category-content .shop-now,
.mega-menu-category-content a.cta,
.mega-menu-category-content .cta,
.mega-menu-category-content button,
.mega-menu-category-content .button,
.mega-menu-category-content > a:last-child,
.mega-menu-category-content > button:last-child,
.mega-menu-category-content > .shop-now:last-child,
.mega-menu-category-content > .cta:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  height: 44px;
  padding: 0 20px;
  min-width: 140px;
  white-space: nowrap;

  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
  text-decoration: none;
  cursor: pointer;

  /* High-contrast pill on colorful cards */
  color: #111827;
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid #ffffff;
  border-radius: 9999px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);

  /* Pin CTA to bottom of the column */
  margin-top: auto;
}

/* Force button styling with higher specificity */
.mega-menu-dropdown .mega-menu-category .mega-menu-category-content .mega-menu-category-btn,
.mega-menu-categories .mega-menu-category .mega-menu-category-content .mega-menu-category-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  background: rgba(255, 255, 255, 0.95) !important;
  color: #1f2937 !important;
  border: 2px solid rgba(255, 255, 255, 0.9) !important;
  border-radius: 25px !important;

  height: 42px !important;
  padding: 0 20px !important;
  min-width: 130px !important;

  font-weight: 700 !important;
  font-size: 14px !important;
  letter-spacing: 0.3px !important;
  text-decoration: none !important;
  white-space: nowrap !important;

  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15) !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;

  margin-top: auto !important;
}

/* Force hover effects with higher specificity */
.mega-menu-dropdown .mega-menu-category .mega-menu-category-content .mega-menu-category-btn:hover,
.mega-menu-categories .mega-menu-category .mega-menu-category-content .mega-menu-category-btn:hover {
  background: #ffffff !important;
  color: #111827 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2) !important;
}

/* Add arrow with higher specificity */
.mega-menu-dropdown .mega-menu-category .mega-menu-category-content .mega-menu-category-btn::after,
.mega-menu-categories .mega-menu-category .mega-menu-category-content .mega-menu-category-btn::after {
  content: "→" !important;
  margin-left: 8px !important;
  font-size: 16px !important;
  transition: transform 0.2s ease !important;
}

.mega-menu-dropdown .mega-menu-category .mega-menu-category-content .mega-menu-category-btn:hover::after,
.mega-menu-categories .mega-menu-category .mega-menu-category-content .mega-menu-category-btn:hover::after {
  transform: translateX(2px) !important;
}

/* Hover/active/focus states for better affordance */
@media (hover: hover) and (pointer: fine) {
  .mega-menu-category-content .mega-menu-category-btn:hover,
  .mega-menu-category-content a.shop-now:hover,
  .mega-menu-category-content .shop-now:hover,
  .mega-menu-category-content a.cta:hover,
  .mega-menu-category-content .cta:hover,
  .mega-menu-category-content button:hover,
  .mega-menu-category-content .button:hover,
  .mega-menu-category-content > a:last-child:hover,
  .mega-menu-category-content > button:last-child:hover,
  .mega-menu-category-content > .shop-now:last-child:hover,
  .mega-menu-category-content > .cta:last-child:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.18);
  }
}
.mega-menu-category-content .mega-menu-category-btn:active,
.mega-menu-category-content a.shop-now:active,
.mega-menu-category-content .shop-now:active,
.mega-menu-category-content a.cta:active,
.mega-menu-category-content .cta:active,
.mega-menu-category-content button:active,
.mega-menu-category-content .button:active,
.mega-menu-category-content > a:last-child:active,
.mega-menu-category-content > button:last-child:active,
.mega-menu-category-content > .shop-now:last-child:active,
.mega-menu-category-content > .cta:last-child:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
}
.mega-menu-category-content .mega-menu-category-btn:focus-visible,
.mega-menu-category-content a.shop-now:focus-visible,
.mega-menu-category-content .shop-now:focus-visible,
.mega-menu-category-content a.cta:focus-visible,
.mega-menu-category-content .cta:focus-visible,
.mega-menu-category-content button:focus-visible,
.mega-menu-category-content .button:focus-visible,
.mega-menu-category-content > a:last-child:focus-visible,
.mega-menu-category-content > button:last-child:focus-visible,
.mega-menu-category-content > .shop-now:last-child:focus-visible,
.mega-menu-category-content > .cta:last-child:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35);
}
