/* Header Styles */
header.top-header {
  position: sticky;
  top: 0;
  z-index: 999;
  background-color: #fff;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  height: 80px; /* Fixed height as per .roorules */
  width: 100%; /* Fixed width as per .roorules */
}

.top-header.has-admin-bar {
  top: 32px;
}

header.top-header nav ul {
  list-style: none;
  display: flex;
  margin: 0;
  gap: 20px;
}

header.top-header nav ul li a {
  text-decoration: none;
  color: var(--dark);
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

header.top-header nav ul li a::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--secondary);
  transition: var(--transition);
}

header.top-header nav ul li a:hover {
  color: var(--primary);
}

header.top-header nav ul li a:hover::after {
  width: 100%;
}

.header-logo {
  font-size: 24px;
  font-weight: bold;
  color: var(--primary);
}

.header-contact {
  display: flex;
  gap: 20px;
  align-items: center;
}

.header-contact a {
  display: flex;
  align-items: center;
  height: 24px; /* Match icon height */
}

.header-contact svg {
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

.header-contact span {
  font-weight: 500;
}

.header-phone {
  color: var(--dark);
  cursor: pointer;
  font-size: 18px;
  font-style: normal;
  font-weight: 700;
  line-height: 19.8px;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.header-phone .phone-text {
  /* Show by default on desktop */
  display: inline;
}

.header-phone .phone-icon {
  /* Hide by default on desktop */
  display: none;
}

.header-icons {
  display: flex;
  align-items: center;
  margin-left: 10px;
}

.grecaptcha-badge {
  visibility: hidden;
}

.header-icons a {
  padding: 0 12px;
  display: flex;
  align-items: center;
}

.header-icons img {
  width: 24px;
  height: 24px;
  vertical-align: middle;
}


/* Search Styles */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 5px;
}

.search-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-toggle:hover {
  background: none;
}

.search-toggle img {
  width: 20px;
  height: 20px;
  transition: all 0.3s ease;
  color: #000;
}

.search-input {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  visibility: hidden;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px 12px 8px 12px !important;
  width: 0;
  height: 36px;
  transition: all 0.3s ease;
  font-size: 16px;
  z-index: 10;
}

.search-input.active {
  opacity: 1;
  visibility: visible;
  width: 350px;
}

@media (max-width: 768px) {
  .search-input.active {
    width: 175px;
  }
}

.header-icons .cart-badge {
  position: relative;
}

.header-icons .cart-badge::after {
  content: "0";
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: red;
  color: white;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 50%;
  font-weight: bold;
}
/* Menu toggle button styles */
.menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: none; /* Hidden by default, shown in media query */
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
  fill: #000;
}

/* Responsive Design for Header */
.mobile-menu-links {
  display: none; /* Hidden by default on desktop */
}

@media (max-width: 1124px) {
  /* Hide the main navigation */
  header.top-header nav {
    display: none;
  }

  .header-menu-sidebar {
    /* display: none; */
  }

  /* Position logo on the left */
  .header-logo {
    margin-right: auto;
  }

  /* Hide all icons except cart */
  .header-icons a:not(.cart-icon) {
    display: none;
  }

  /* Show menu toggle button */
  .menu-toggle {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 25px;
  }

  .menu-toggle svg {
    width: 24px;
    height: 24px;
  }

  /* Show mobile-only navigation links */
  .mobile-menu-links {
    display: block;
    width: 100%; /* Take full width in mobile menu */
    margin-bottom: 20px; /* Space before categories button */
  }

  .mobile-menu-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .mobile-menu-links li {
    margin-bottom: 10px;
  }

  .mobile-menu-links a {
    text-decoration: none;
    color: var(--primary);
    font-size: 18px;
    font-weight: 300;
    line-height: 19.8px;
  }
}

/* Small menu. */
/* .menu-toggle,
.main-navigation.toggled ul {
	display: block;
} */

.menu-toggle:hover,
.menu-toggle:focus,
.menu-toggle:active {
  text-decoration: none;
  background: none;
  outline: none;
  box-shadow: none;
}



/* Header Mega-menu */
.header-mega-menu {
  font-size: 18px;
  font-weight: 300;
  line-height: 19.8px;
  /* max-width: 1400px; */
  margin: 0 auto;
  display: flex;
  gap: 20px;
  padding: 20px 65px;
}

/* Sidebar navigation */
.header-menu-sidebar {
  width: 200px;
  border-right: 1px solid #e0e0e0;
  padding-right: 20px;
}

.header-menu-toggle-button {
  padding: 12px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-weight: 500;
  color: #333;
  position: relative;
  transition: all 0.3s ease;
}
/*
.header-menu-toggle-button::after {
    content: '>';
    position: absolute;
    right: 0;
    font-weight: 400;
    margin-left: 10px;
} */

.header-menu-toggle-button.active {
  background: #f5f5f5;
  color: #2c3e50;
}

.header-menu-toggle-button.active::after {
  transform: rotate(90deg);
}

/* Style buttons and links in header menu sidebar similar to .header-menu-column h4 */
.header-menu-sidebar .header-menu-toggle-button,
.header-menu-sidebar a {
  color: var(--primary);
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  position: relative;
  margin: 10px 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  display: block;
  transition: color 0.3s ease;
}

.header-menu-sidebar .header-menu-toggle-button:hover,
.header-menu-sidebar a:hover {
  color: var(--accent);
}

.header-menu-sidebar .header-menu-toggle-button.active {
  background: transparent;
  color: var(--accent);
}

/* Content area */
.header-menu-content {
  display: none;
  width: calc(100% - 220px);
  margin-left: 20px;
}

.header-menu-content.active {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.header-menu-column {
  flex: 1 1 23%;
  min-width: 250px;
  border-left: 1px solid #e0e0e0;
  padding-left: 20px;
}

.header-menu-column:first-child {
  border-left: none;
  padding-left: 0;
}

.header-menu-column h4 {
  color: var(--primary);
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  position: relative;
  /* padding-left: 30px; */
  /* margin: 0 0 10px; */
  margin: 10px 0;
}
.header-menu-column h4 a {
  color: var(--primary);
  text-decoration: none;
}

/*
.header-menu-column h4::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: #e0e0e0;
} */

.header-menu-column img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  margin-right: 10px;
  vertical-align: middle;
}

.header-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.header-menu-list li {
  margin-bottom: 8px;
}

.header-menu-list a,
.header-menu-sidebar a,
.header-menu-list a:visited,
.header-menu-sidebar a:visited {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.header-menu-list a:hover {
  color: var(--accent);
}

/* Responsive design */
@media (max-width: 1024px) {
  .header-mega-menu {
    padding: 10px;
  }

  .header-menu-column {
    /* flex-basis: 48%; */
    border-left: none;
    min-width: 200px;
  }
}

@media (max-width: 768px) {
  .header-mega-menu {
    flex-direction: column;
  }

  .header-menu-sidebar {
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
  }

  .header-menu-content {
    gap: 10px;
  }

  .header-menu-column {
    flex-basis: 100%;
    min-width: 100%;
    border-left: none;
    padding-left: 0;
  }

  .header-menu-column h4::before {
    display: none;
  }
}

/* Megamenu positioning and visibility */
#header-megamenu {
  position: fixed; /* Changed to fixed */
  left: 0;
  right: 0;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 998; /* Just below the header */
  display: none; /* Initially hide the megamenu */
}

/* Show the megamenu when the 'show' class is added */
#header-megamenu.show {
  display: block;
}

/* Prevent body scrolling when megamenu is open */
body.megamenu-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  #header-megamenu {
    position: fixed;
    top: 90px; /* Below header */
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    /* height: calc(100vh - 90px); */ /* Removed explicit height */
    overflow-y: auto; /* Allow scrolling of entire megamenu */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    z-index: 997;
    background: #fff;
    padding: 20px;
    box-shadow: none;
  }

  .admin-bar #header-megamenu {
    top: calc(90px + 32px); /* Account for admin bar */
    /* height: calc(100vh - 90px - 32px); */ /* Removed explicit height */
  }

  .header-mega-menu {
    flex-direction: column;
    min-height: 100%; /* Ensure it takes at least full height */
    padding: 0;
  }

  .header-menu-sidebar {
    width: 100%;
    border-right: none;
    padding-right: 0;
    margin-bottom: 20px;
  }

  .header-menu-content {
    width: 100%;
    margin-left: 0;
    flex-grow: 1;
    overflow-y: hidden; /* Prevent individual scrolling */
    max-height: none; /* Remove height restrictions */
    height: auto;
  }

  .header-menu-content.active {
    display: flex;
    flex-direction: column;
  }

  /* Ensure columns don't create additional scrollbars */
  .header-menu-column {
    min-width: 100%;
    flex-basis: 100%;
  }
  .header-phone .phone-text {
    display: none;
  }

  .header-phone .phone-icon {
    display: inline-block;
  }
}
