/* ============================================
   Modern Header Styles - Fully Responsive
   ============================================ */

:root {
  --header-bg: #ffffff;
  --header-text: #000000;
  --header-accent: #000000;
  --header-hover: #333333;
  --header-border: #e5e5e5;
  --header-height: 80px;
  --header-mobile-height: 70px;
  --top-banner-height: 40px;
  --dropdown-bg: #ffffff;
  --dropdown-text: #000000;
  --transition: all 0.3s ease;
}

/* Top Banner Bar */
.header-top-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: var(--color-text-header);
  color: #ffffff;
  z-index: 10001;
  padding: 0;
  margin: 0;
  font-size: 14px;
  text-align: center;
  box-shadow: none;
  height: var(--top-banner-height);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.header-top-banner-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-top-banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.header-top-banner-content i {
  font-size: 16px;
}

.header-top-banner-content span {
  font-weight: 500;
}

/* Header Container */
.header-new {
  position: fixed;
  top: var(--top-banner-height);
  left: 0;
  right: 0;
  width: 100%;
  background: var(--header-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  z-index: 10000;
  transition: var(--transition);
  margin: 0;
  padding: 0;
  border: none;
}

/* Cart Sidebar should be above header */
.sidebar.sidebar--right,
#site-cart-sidebar,
sidebar-drawer.sidebar--right,
.sidebar {
  z-index: 10002 !important;
}

.site-overlay {
  z-index: 10001 !important;
}

.header-new.sticky {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

/* Top Bar */
.header-top-bar {
  background: var(--header-accent);
  color: #ffffff;
  padding: 8px 0;
  font-size: 12px;
  text-align: center;
  display: none;
}

.header-top-bar.show {
  display: block;
}

.header-top-bar .container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Main Header Container */
.header-main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Logo Section */
.header-logo {
  flex-shrink: 0;
  z-index: 10;
}

.header-logo a {
  display: block;
  text-decoration: none;
  font-size: 24px;
  font-weight: bold;
  color: var(--header-text);
  transition: var(--transition);
}

.header-logo a:hover {
  color: var(--header-hover);
}

.header-logo img {
  max-height: 70px;
  width: auto;
  display: block;
}

/* Navigation Menu */
.header-nav {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.header-nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 35px;
  align-items: center;
}

.header-nav-menu li {
  position: relative;
}

.header-nav-menu > li > a {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 0;
  text-decoration: none;
  color: var(--header-text);
  font-size: 15px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: var(--transition);
  position: relative;
}

.header-nav-menu > li > a::after {
  content: '';
  position: absolute;
  bottom: 5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--header-accent);
  transition: var(--transition);
}

.header-nav-menu > li:hover > a::after,
.header-nav-menu > li.active > a::after {
  width: 100%;
}

.header-nav-menu > li > a:hover {
  color: var(--header-hover);
}

.header-nav-menu > li > a .menu-icon {
  font-size: 12px;
  transition: var(--transition);
}

.header-nav-menu > li.has-submenu:hover > a .menu-icon {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.header-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-20%);
  background: var(--dropdown-bg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 20px 0;
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: var(--transition);
  margin-top: 15px;
  z-index: 1000;
}

.header-nav-menu > li:hover > .header-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  margin-top: 0px;
}

.header-dropdown ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header-dropdown ul li {
  margin: 0;
}

.header-dropdown ul li a {
  display: block;
  padding: 12px 25px;
  text-decoration: none;
  color: var(--dropdown-text);
  font-size: 14px;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.header-dropdown ul li a:hover {
  background: #f8f8f8;
  border-left-color: var(--header-accent);
  padding-left: 30px;
}

/* Mega Menu */
.header-mega-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-10%);
  background: var(--dropdown-bg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 30px;
  min-width: 900px;
  max-width: 1200px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: var(--transition);
  margin-top: 15px;
  z-index: 1000;
}

.header-nav-menu > li:hover > .header-mega-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  margin-top: 0px;
}

.mega-menu-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  width: 100%;
}

/* Ensure promotion box spans full width on new row */
.mega-menu-content:has(.mega-menu-promotion) {
  grid-auto-rows: auto;
}

.mega-menu-column h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 15px 0;
  color: var(--header-text);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--header-border);
}

.mega-menu-column ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mega-menu-column ul li {
  margin: 0 0 8px 0;
}

.mega-menu-column ul li a {
  display: block;
  padding: 8px 0;
  text-decoration: none;
  color: var(--dropdown-text);
  font-size: 14px;
  transition: var(--transition);
}

.mega-menu-column ul li a:hover {
  color: var(--header-accent);
  padding-left: 8px;
}

.mega-menu-promotion {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  padding: 30px;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  min-height: 200px;
  width: calc(100% + 0px);
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  clear: both;
  display: block;
}

.mega-menu-promotion img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.3;
  display: block;
  margin: 0;
  padding: 0;
}

.mega-menu-promotion-content {
  position: relative;
  z-index: 1;
}

.mega-menu-promotion h3 {
  font-size: 24px;
  margin: 0 0 10px 0;
  font-weight: bold;
}

.mega-menu-promotion p {
  font-size: 14px;
  margin: 0 0 20px 0;
  opacity: 0.9;
}

.mega-menu-promotion a {
  display: inline-block;
  padding: 12px 30px;
  background: #ffffff;
  color: var(--header-accent);
  text-decoration: none;
  border-radius: 5px;
  font-weight: 600;
  transition: var(--transition);
}

.mega-menu-promotion a:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.header-action-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--header-text);
  font-size: 20px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  text-decoration: none;
}

.header-action-btn:hover {
  color: var(--header-hover);
  transform: translateY(-2px);
}

.header-action-btn .cart-count,
.header-action-btn .badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--header-accent);
  color: #ffffff;
  font-size: 11px;
  font-weight: bold;
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* Search Container */
.header-search-container {
  position: relative;
  display: flex;
  align-items: center;
  /* gap: 10px; */
}

.header-search-form {
  display: flex;
  align-items: center;
}

.header-search-input {
  width: 0;
  opacity: 0;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 5px 0;
  font-size: 14px;
  transition: all 0.3s ease;
  outline: none;
  background: transparent;
  order: 2;
}

.header-search-container.active {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 10px;
}

.header-search-container.active .header-search-input {
  width: 250px;
  opacity: 1;
  padding: 5px 10px;
  border: 1px solid var(--header-border);
  order: 2;
}

.header-search-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--header-text);
  font-size: 18px;
  padding: 8px;
  transition: var(--transition);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  order: 1;
}

.header-search-container.active .header-search-btn {
  order: 1;
}

.header-search-btn:hover {
  color: var(--header-hover);
}

/* Mobile Menu Button */
.header-mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--header-text);
  font-size: 24px;
  padding: 8px;
  transition: var(--transition);
}

.header-mobile-menu-btn:hover {
  color: var(--header-hover);
}

.header-mobile-menu-btn span {
  display: block;
  width: 25px;
  height: 3px;
  background: var(--header-text);
  margin: 5px 0;
  transition: var(--transition);
}

.header-mobile-menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.header-mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.header-mobile-menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu */
.header-mobile-menu {
  position: fixed;
  top: calc(var(--top-banner-height) + var(--header-mobile-height));
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--header-bg);
  z-index: 9998;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: var(--transition);
  padding: 20px;
}

.header-mobile-menu.active {
  transform: translateX(0);
}

.header-mobile-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header-mobile-menu > ul > li {
  border-bottom: 1px solid var(--header-border);
}

.header-mobile-menu > ul > li > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  text-decoration: none;
  color: var(--header-text);
  font-size: 16px;
  font-weight: 500;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.header-mobile-menu > ul > li.has-submenu > a {
  cursor: pointer;
}

.header-mobile-menu > ul > li > a:hover,
.header-mobile-menu > ul > li > a:active {
  color: var(--header-hover);
}

.header-mobile-menu > ul > li > a .menu-toggle {
  font-size: 12px;
  transition: transform 0.3s ease;
  display: inline-block;
}

.header-mobile-menu > ul > li.active > a .menu-toggle,
.header-mobile-menu ul li.has-submenu.active > a .menu-toggle {
  transform: rotate(180deg);
}

.header-mobile-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
  padding: 0;
}

.header-mobile-menu > ul > li.active > .header-mobile-submenu,
.header-mobile-menu ul li.has-submenu.active > .header-mobile-submenu,
.header-mobile-menu li.has-submenu.active .header-mobile-submenu,
.header-mobile-menu li.has-submenu.active > .header-mobile-submenu {
  max-height: 2000px !important;
  padding: 15px 0 !important;
  overflow: visible !important;
  display: block !important;
}

.header-mobile-submenu ul {
  padding-left: 15px;
}

.header-mobile-submenu ul li a {
  display: block;
  padding: 12px 0;
  text-decoration: none;
  color: var(--dropdown-text);
  font-size: 14px;
  transition: var(--transition);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.header-mobile-submenu ul li a:hover,
.header-mobile-submenu ul li a:active {
  color: var(--header-accent);
  padding-left: 10px;
}

/* Mobile Submenu Sections with Titles */
.mobile-submenu-section {
  margin-bottom: 25px;
}

.mobile-submenu-section:last-child {
  margin-bottom: 0;
}

.mobile-submenu-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 15px 0;
  color: var(--header-text);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--header-border);
}

.mobile-submenu-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  padding-left: 0;
}

.mobile-submenu-section ul li {
  margin: 0 0 8px 0;
}

.mobile-submenu-section ul li a {
  display: block;
  padding: 10px 0;
  text-decoration: none;
  color: var(--dropdown-text);
  font-size: 14px;
  transition: var(--transition);
  padding-left: 0;
}

.mobile-submenu-section ul li a:hover,
.mobile-submenu-section ul li a:active {
  color: var(--header-accent);
  padding-left: 8px;
}

/* Mobile Search */
.header-mobile-search {
  padding: 15px 0;
  border-bottom: 1px solid var(--header-border);
  margin-bottom: 20px;
}

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

.header-mobile-search-input {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--header-border);
  border-radius: 5px;
  font-size: 14px;
  outline: none;
}

.header-mobile-search-btn {
  padding: 12px 20px;
  background: var(--header-accent);
  color: #ffffff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.header-mobile-search-btn:hover {
  background: var(--header-hover);
}

/* Overlay */
.header-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9997;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.header-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Mobile - Hide overlay since menu slides from side */
@media screen and (max-width: 992px) {
  .header-overlay {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }
}

/* Responsive Design */
@media screen and (max-width: 1200px) {
  .header-mega-menu {
    min-width: 700px;
    max-width: 900px;
  }
}

@media screen and (max-width: 992px) {
  .header-top-banner {
    font-size: 12px;
    padding: 6px 0;
  }

  .header-top-banner-content i {
    font-size: 14px;
  }

  .header-main-container {
    height: var(--header-mobile-height);
    padding: 0 15px;
  }

  .header-nav {
    display: none;
  }

  .header-mobile-menu-btn {
    display: block;
  }

  .header-actions {
    gap: 15px;
  }

  .header-search-container {
    display: none;
  }
}

@media screen and (max-width: 768px) {
  .header-main-container {
    padding: 0 10px;
    gap: 15px;
  }

  .header-logo a {
    font-size: 20px;
  }

  .header-logo img {
    max-height: 60px;
  }

  .header-actions {
    gap: 10px;
  }

  .header-action-btn {
    font-size: 18px;
    padding: 6px;
  }
}

@media screen and (max-width: 480px) {
  :root {
    --header-mobile-height: 60px;
    --top-banner-height: 35px;
  }

  .header-top-banner {
    font-size: 11px;
    padding: 5px 0;
  }

  .header-logo a {
    font-size: 18px;
  }

  .header-logo img {
    max-height: 50px;
  }
}

/* Smooth Scroll */
html {
  scroll-behavior: smooth;
}

/* Body padding for fixed header and top banner - Apply only if header-new exists */
body:has(.header-new) {
  padding-top: calc(var(--top-banner-height) + var(--header-height));
}

@media screen and (max-width: 992px) {
  body:has(.header-new) {
    padding-top: calc(var(--top-banner-height) + var(--header-mobile-height));
  }
}

/* Ensure header doesn't conflict with existing styles */
.header-new {
  box-sizing: border-box;
}

/* Fallback for browsers that don't support :has() */
@supports not selector(:has(*)) {
  body {
    padding-top: var(--header-height);
  }
  
  @media screen and (max-width: 992px) {
    body {
      padding-top: var(--header-mobile-height);
    }
  }
}

