/* ===== SCROLL FIX ===== */
html {
  scroll-behavior: smooth;
}

*,
[id] {
  scroll-margin-top: 222px;
}

@media (max-width: 768px) {
  *,
  [id] {
    scroll-margin-top: 112px;
  }
}

/* ===== HEADER STYLES ===== */
.header {
  position: fixed;
  top: 0;
  width: 100%;
  max-width: 100vw;
  z-index: 1000;
}

.header-container {
  background-color: var(--colour-maroon);
  color: white;
  padding: 14px 120px;
}

.header-top {
  margin: 0;
  padding: 0;
  font-size: 12px;
  line-height: 12px;
  justify-content: flex-end;
}

.header-top li {
  align-self: center;
}

.header-top i {
  font-size: 16px;
  opacity: 0.8;
  display: inline-block;
}

.header-top a {
  transition: opacity 0.3s ease;
}

.header-top button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  text-decoration: underline;
  transition: opacity 0.3s ease;
}

.header-top a:hover,
.header-top button:hover {
  opacity: 0.6;
}

.social-icon {
  color: rgba(255, 255, 255, 0.8);
  transition: opacity 0.3s ease;
}

.social-icon:hover {
  color: white;
  opacity: 1;
}

.list-inline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
}

.list-inline-item {
  display: block;
}

/* Gap classes for nested list spacing */
.gap-24 > .list-inline-item:not(:last-child) {
  margin-right: 24px;
}

.gap-16 > .list-inline-item:not(:last-child) {
  margin-right: 16px;
}

.gap-8 > .list-inline-item:not(:last-child) {
  margin-right: 8px;
}

.header-text-fix {
  transform: translateY(1px);
}

.header-main {
  margin-top: 19.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo,
.logo img {
  width: 174px;
  height: 75px;
}

.search-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  width: 240px;
  height: 48px;
  max-height: 48px;
  border: none;
  border-radius: 4px;
  background: white;
  opacity: 0.8;
  color: var(--colour-dark-grey);
}

.search-bar input {
  width: 100%;
  border: none;
  font-size: 13px;
  font-family: Arial, sans-serif;
  outline: none;
}

.search-btn {
  background: none;
  border: none;
  cursor: pointer;
}

.search-btn i {
  color: var(--colour-maroon);
  font-size: 18px;
}

.utility-link i {
  color: rgba(255, 255, 255, 0.8);
}

.utility-link i:first-child {
  font-size: 16px;
}

.utility-link i:last-child {
  font-size: 7px;
  transition: transform 0.3s ease;
}

.login-button-container {
  position: relative;
}

.login-button {
  border-radius: 4px;
  transition: border-radius 0.3s ease;
}

.login-button.active {
  border-radius: 4px 4px 0 0;
}

.login-button.active i:last-child {
  transform: rotate(180deg);
}

@keyframes dropdown-slide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--colour-black);
  z-index: 1000;
  width: 100%;
  border-radius: 0 0 6px 6px;
  display: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  animation: dropdown-slide 0.3s ease forwards;
}

.login-dropdown ul {
  list-style: none;
  padding: 8px 16px;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.login-dropdown > ul > li:not(:last-child) {
  border-bottom: 1px solid var(--colour-grey-dark) !important;
}

.login-dropdown li {
  width: 100%;
  height: 36px;
  margin: 0;
}

.login-dropdown .utility-link {
  width: 100%;
  height: 36px;
  align-items: left;
  justify-content: flex-start;
}

.login-dropdown .utility-link i,
.login-dropdown .utility-link img {
  font-size: 12px;
  height: 12px;
  width: 12px;
  margin-right: 12px;
  opacity: 0.6;
}

.login-dropdown .utility-link span {
  font-family: "Franklin Gothic ATF", sans-serif;
  font-weight: normal;
  font-size: 15px;
  color: white;
  line-height: 1;
}

.basket-icon {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.basket-icon i {
  font-size: 24px;
}

.basket-icon i,
.basket-icon span {
  margin: 0;
  align-self: center;
}

.basket-count {
  position: absolute;
  top: -1px;
  right: -4px;
  width: 13px;
  height: 13px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--colour-maroon-dark);
  border: 1px solid var(--colour-maroon-dark);
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.navbar-container {
  margin: 16px 0;
  padding: 0;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  padding: 0;
}

.navbar-header {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  gap: 8px;
  color: white;
}

.navbar-header h3 {
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
  color: white;
}

.navbar-header i {
  font-size: 7px;
  transition: transform 0.3s ease;
}

.navbar-header.active i,
.navbar-header .flipped {
  transform: rotate(180deg);
}

.navbar-header h3,
.navbar-header i {
  margin: 0;
  align-self: center;
}

.navbar-header:hover h3 {
  text-decoration: underline;
}

/* ===== NAVBAR HIGHLIGHTING STYLES ===== */
.navbar-header-active {
  position: relative;
}

.navbar-header-active h3 {
  color: var(--colour-yellow) !important;
}

.navbar-header-active i {
  color: var(--colour-yellow) !important;
}

.navbar-header-active::after {
  content: "";
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-51%);
  width: 120%;
  height: 1px;
  background-color: var(--colour-yellow);
  border: 1px solid var(--colour-yellow);
  border-radius: 8px 8px 0 0;
}

/* ===== DESKTOP MEGAMENU STYLES ===== */
.desktop-megamenu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  background-color: var(--colour-maroon-dark);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.8), inset 0 3px 6px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(0, 0, 0, 0.2);
  z-index: 999;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s ease-out, opacity 0.3s ease;
  transform-origin: top;
  margin-top: 28px;
}

.desktop-megamenu.active {
  max-height: 480px;
  opacity: 1;
  transform: translateX(-50%);
}

.megamenu-content {
  display: none;
  padding: 40px 120px;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 48px;
  min-height: 256px;
  max-height: 480px;
  animation-duration: 0.3s;
  animation-fill-mode: both;
}

.megamenu-content.active {
  display: flex;
  animation-name: fadeInUp;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.megamenu-section {
  flex: 0 0 auto;
  width: 192px;
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}

.megamenu-content.active .megamenu-section:nth-child(1) {
  animation-delay: 0.1s;
}
.megamenu-content.active .megamenu-section:nth-child(2) {
  animation-delay: 0.2s;
}
.megamenu-content.active .megamenu-section:nth-child(3) {
  animation-delay: 0.3s;
}
.megamenu-content.active .megamenu-section:nth-child(4) {
  animation-delay: 0.4s;
}
.megamenu-content.active .megamenu-section:nth-child(5) {
  animation-delay: 0.5s;
}

.megamenu-section h4 {
  color: white;
  font-family: "Franklin Gothic ATF", sans-serif;
  font-weight: bold;
  font-size: 16px;
  text-transform: uppercase;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.megamenu-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.megamenu-section ul:not(:last-child) {
  margin-bottom: 32px;
}

.megamenu-section li {
  margin: 0;
}

.megamenu-section a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-family: "Rockwell", serif;
  font-size: 14px;
  line-height: 1.4;
  transition: all 0.3s ease;
  display: block;
  padding: 4px 0;
}

.megamenu-section a:hover {
  color: white;
  text-decoration: underline;
  transform: translateX(8px);
}

/* Megamenu Animation States */
.navbar-container {
  position: relative;
}

.navbar-header.megamenu-active i {
  transform: rotate(180deg);
}

/* Responsive adjustments for megamenu */
@media (max-width: 1200px) {
  .header-container {
    padding: 14px 64px;
  }

  .megamenu-content {
    padding: 40px 64px;
    gap: 32px;
  }
}

.header-fix-on {
  display: none;
}

@media (max-width: 1024px) {
  .header-container {
    padding: 14px 32px;
  }

  .header-fix-off {
    display: none;
  }

  .header-fix-on {
    display: flex;
  }

  .megamenu-content {
    padding: 40px 32px;
    gap: 24px;
  }
}

@media (max-width: 768px) {
  .desktop-megamenu {
    display: none;
  }

  .header {
    display: none;
  }

  .utility-link {
    padding: 16px;
  }
}

/* ===== MOBILE HEADER STYLES ===== */
.header-mobile {
  display: none;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
}

.header-mobile-container {
  background-color: var(--colour-maroon);
  position: relative;
}

.header-mobile-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px;
  height: 96px;
}

.header-mobile-top i {
  font-size: 18px;
}

.logo-mobile img {
  height: 56px;
  width: auto;
}

.header-mobile .header-utilities {
  display: flex;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu-toggle i {
  transition: all 0.3s ease;
}

.menu-toggle .menu-icon {
  width: 18px;
  height: 18px;
  transition: all 0.3s ease;
  filter: brightness(0) invert(1); /* Makes the SVG white */
  display: block;
}

.menu-toggle.active .menu-bars {
  display: none;
}

.menu-toggle.active .menu-icon.menu-bars {
  display: none;
}

.menu-toggle.active i.fa-times {
  display: block;
  margin-right: 4.5px;
}

.menu-toggle i.fa-times {
  display: none;
}

.menu-toggle span {
  font-size: 10px;
  text-transform: uppercase;
}

.header-mobile-megamenu {
  position: fixed;
  top: 96px;
  right: -100%;
  width: 100%;
  height: calc(100vh - 96px);
  background-color: var(--colour-maroon);
  z-index: 1000;
  transition: right 0.3s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.header-mobile-megamenu.active {
  right: 0;
}

.header-mobile-megamenu .search-bar {
  margin: 0 24px 24px;
  width: calc(100% - 48px); /* Full width minus margins */
}

.nav-mobile-links {
  flex: 1;
}

.nav-mobile-back {
  display: none;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: white;
  font-family: "Franklin Gothic ATF", sans-serif;
  font-weight: bold;
  font-size: 16px;
  padding: 20px 24px;
  height: 52px;
  cursor: pointer;
}

.nav-mobile-back.active {
  display: flex;
}

.nav-mobile-back i {
  font-size: 12px;
}

.nav-mobile-current-section {
  display: none;
  padding: 0;
  margin: 0;
  background: var(--colour-maroon-dark);
  border-bottom: 1px solid var(--colour-maroon-dark);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.nav-mobile-current-section.active {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  height: 52px;
}

.nav-mobile-current-section img {
  width: 14px;
  height: 14px;
  display: block;
}

.nav-mobile-section-title {
  font-family: "Franklin Gothic ATF", sans-serif;
  font-weight: bold;
  font-size: 20px;
  color: white;
  margin: 0;
  text-transform: uppercase;
  line-height: 1;
}

.nav-mobile-links-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-mobile-link {
  border-bottom: 1px solid var(--colour-maroon-dark);
}

.nav-mobile-link.active-section {
  border-bottom: none;
}

.nav-mobile-header,
.nav-mobile-link-item {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  padding: 20px 24px;
  height: 52px;
  cursor: pointer;
  color: white;
  text-align: left;
  text-decoration: none;
}

.nav-mobile-header img {
  display: none;
  width: 16px;
  height: 16px;
  margin-right: 12px;
}

.nav-mobile-header.active img {
  display: block;
}

.nav-mobile-header h3 {
  font-family: "Franklin Gothic ATF", sans-serif;
  font-weight: bold;
  color: white;
  margin: 0;
  flex: 1;
  font-size: 20px;
  line-height: 1;
}

.nav-mobile-header h4,
.nav-mobile-link-item h4 {
  font-family: "Rockwell", serif;
  font-weight: normal;
  color: white;
  margin: 0;
  flex: 1;
  font-size: 20px;
  line-height: 1;
  transform: translateY(4px);
}

.nav-mobile-link-item {
  text-decoration: none !important;
}

.nav-mobile-link-item:hover,
.nav-mobile-link-item:focus,
.nav-mobile-link-item:active {
  text-decoration: none !important;
  color: white !important;
}

.nav-mobile-link-item:hover h4,
.nav-mobile-link-item:focus h4,
.nav-mobile-link-item:active h4 {
  text-decoration: none !important;
  color: white !important;
}

.nav-mobile-link-item a:hover,
.nav-mobile-link-item a:focus {
  text-decoration: none;
  color: white;
}

.nav-mobile-header.active h3,
.nav-mobile-header.active h4 {
  text-transform: uppercase;
}

.nav-mobile-header i.nav-mobile-arrow {
  font-size: 14px;
  color: white;
  opacity: 0.7;
}

.nav-mobile-header.active i.nav-mobile-arrow {
  display: none;
}

.nav-mobile-links-list .nav-mobile-links-list {
  display: none;
  padding-left: 0;
  margin-top: 0;
}

.nav-mobile-links-list .nav-mobile-links-list.active {
  display: block;
}

/* Hide nested levels initially */
.nav-mobile-links-list .nav-mobile-links-list .nav-mobile-links-list {
  display: none;
}

.header-mobile-bottom {
  margin-top: 24px;
  padding: 24px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  justify-content: center;
}

.header-mobile-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.header-mobile-buttons .btn {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-mobile-links {
  display: flex;
  flex-direction: row;
  width: 100%;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 14px;
  gap: 16px;
  list-style: none;
  margin-left: 0;
}

.header-mobile-links a {
  text-wrap: none;
}

@media (max-width: 768px) {
  .header-mobile {
    display: block;
  }

  /* Adjust body padding for mobile header */
  body {
    padding-top: 96px; /* Mobile header height */
  }

  /* Prevent body scroll when mobile menu is open */
  body.mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }
}

@media (max-width: 360px) {
  .header-mobile-links {
    flex-direction: column;
  }
}

@media (max-width: 320px) {
  .logo-mobile img {
    height: 48px;
  }

  .header-mobile-bottom {
    padding: 8px;
  }
}
