.menu-actions {
  border-top: 1px solid #f1f5f9;
  margin-top: 8px;
  padding-top: 6px;
  display: grid;
  gap: 4px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  text-decoration: none;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}
.menu-item:hover,
.menu-item:focus-visible {
  background: #f9fafb;
  outline: none;
}
.menu-item i {
  width: 18px;
  height: 18px;
}
.menu-item.destructive {
  color: #b91c1c;
}
.menu-item.destructive:hover {
  background: #fef2f2;
}

/* Underline for active or hover states */
html,
body {
  overflow-x: hidden;
}
.nav-links a:hover,
.nav-links a.active {
  color: rgb(175, 175, 175);
}

/* Navigation */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.nav-container {
  display: grid;
  grid-template-columns: auto 1fr auto; /* logo | centered links | cart */
  align-items: center;
  height: 120px;
  padding: 0 100px;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  z-index: 4000;
  column-gap: 2rem;
  position: relative;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-self: end; /* push cart to far right */
  margin-left: 0;
}

.logo img {
  height: 110px;
}

.nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  width: max-content;
  pointer-events: auto;
  padding: 8px 18px;
  background-color: #0e141b;
  border-radius: 20px;
  opacity: 0.85;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  justify-content: center; /* center the link row */
}

.nav-links a {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.nav-links a.active {
  color: var(--accent);
}

.navbar.scrolled {
  background-color: white;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.navbar {
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  background-color: white;
}

body.index2 .navbar {
  background: rgba(255, 255, 255, 0);
}

/* Dropdown Menu */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Navigation Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.icon-button {
  background: none;
  border: none;
  color: var(--black);
  cursor: pointer;
  position: relative;
  padding: 0.5rem;
  transition: var(--transition);
  display: inline-flex; /* ensure consistent vertical centering */
  align-items: center; /* center icon inside button */
  justify-content: center;
  line-height: 1; /* avoid baseline offsets */
}

.icon-button:hover {
  color: var(--primary);
}

.cart-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--accent);
  color: var(--white);
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 10px;
}

/* Mobile Menu Panel */
/* Mobile Menu Panel - slides in from right, below header */
.mobile-menu-panel {
  position: absolute;
  top: 0;
  right: -110%;
  width: 100%;
  height: 100vh;
  background-color: white;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  transition: right 0.3s ease-in-out;
  z-index: 1000;
  overflow-y: auto;
  box-sizing: border-box;
}

.mobile-menu-panel.active {
  right: 0;
}

.mobile-menu-panel .logo {
  max-width: 140px;
  margin-bottom: 2rem;
}

.mobile-menu-panel .nav-links {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.mobile-menu-panel .nav-links a {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.mobile-menu-close {
  background: none;
  border: none;
  font-size: 2rem;
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  cursor: pointer;
}

/* --- Mega Menu Styles (from test.html, adapted for index2.html) --- */
.mega-menu {
  border-top: 1px solid var(--border-color);
  position: fixed;
  top: 50px; /* Ligger rett under "Products"-knappen */
  left: 50%;
  transform: translate(-50%, 0);
  width: min(96vw, 1200px);
  max-width: none;
  box-sizing: border-box;
  height: auto;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: white;
  padding: 1rem 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 5000;
  flex-direction: column;
  border-radius: 3px;
  text-align: center;
  border-radius: 14px;

  /* Smooth transition */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.mega-menu-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 24px; /* row x column gap */
  align-items: start;
  border-bottom: 1px solid var(--border-color);
}

.mega-menu-column {
  font-size: 0.9rem;
}

.mega-menu-column h4 {
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

.mega-menu-column ul {
  list-style: disc;
  margin: 0;
  list-style-type: none;
}
.mega-menu-column h4::first-letter {
  border-bottom: 1px solid #000000;
}

.mega-menu-column ul li {
  margin-bottom: 0.3rem;
  padding-bottom: 0.3rem;
}

.mega-menu-column ul li a {
  color: #545454;
  font-weight: 200;
}

.mega-menu-column ul li a:hover {
  color: #000;
  text-decoration: underline;
}

.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.dropdown-arrow {
  transition: transform 0.3s ease;
}

.dropdown-toggle.active .dropdown-arrow {
  transform: rotate(180deg);
}

body.blur-active::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: blur(6px);
  background-color: rgba(255, 255, 255, 0.3);
  z-index: 9;
}

.mega-menu.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

/* navbar for mobil layout*/
/* Mobile Actions */
.mobile-actions {
  display: none;
  align-items: center;
  gap: 1rem;
}

.mobile-cart .icon-button {
  padding: 0.75rem;
}

/* Ensure mobile actions are on the far right of the grid */
.nav-container .mobile-actions {
  grid-column: 3 / 4;
  justify-self: end;
  margin-left: auto;
  z-index: 1001; /* above background/hero */
  align-self: center; /* center the whole group inside the grid row */
  height: 70px; /* match nav height so it lines up */
}

/* Keep logo locked to left grid column */
.nav-container .logo {
  grid-column: 1 / 2;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none; /* Skjules som standard */
  flex-direction: column;
  justify-content: space-between;
  width: 32px;
  height: 15px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.hamburger-line {
  width: 28px;
  height: 2px;
  background-color: var(--primary);
  border-radius: 1px;
  transition: all 0.3s ease;
  transform-origin: center;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  border: none;
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
}

.mobile-menu-header .logo img {
  height: 32px;
  padding: 0.5rem;
  display: flex;
}
.mobile-menu-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--black);
  height: 32px;
  justify-content: center;
}

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

.mobile-nav-links li {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.mobile-nav-links a {
  color: var(--black);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 500;
  display: block;
  padding: 0.75rem 0;
  border-bottom: 1px solid transparent;
  transition: var(--transition);
}

.mobile-nav-links a:hover {
  color: var(--primary);
  border-bottom-color: var(--border-color);
}

/* Body overlay when menu is open */
body.mobile-menu-open {
  overflow: hidden;
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
}

.mobile-menu-header .logo img {
  height: 32px;
}

.mobile-menu-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--black);
}

.mobile-menu-content {
  flex: 1;
  padding: 2rem;
  margin-top: 80px;
}

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

.mobile-nav-links li {
  margin-bottom: 1.5rem;
}

.mobile-nav-links li:last-child {
  border-bottom: 1px solid var(--border-color);
}

.mobile-nav-links a {
  color: var(--black);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid transparent;
  transition: var(--transition);
  position: relative;
}

.arrow-icon {
  margin-left: auto; /* presser pilen helt til høyre */
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Body overlay when menu is open */
body.mobile-menu-open {
  overflow: hidden;
}

.mobile-contact-footer {
  padding: 1rem 2rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.mobile-contact-footer p {
  margin: 0 0 0.5rem;
  line-height: 1.4;
}

.mobile-contact-footer a {
  color: var(--black);
  text-decoration: none;
  font-size: 1.25rem;
}

.mobile-contact-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.mobile-contact-footer .social-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  margin-top: 0.25rem;
}

.mobile-contact-footer .social-links a {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: #b91c1c;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 0 0 2px #ffffff;
}

.mobile-contact-footer .social-links a svg {
  width: 30px;
  height: 30px;
  color: white;
}

/* Large breakpoint adjustments */
@media (max-width: 1400px) {
  .logo img {
    height: 80px;
  }
  .nav-container {
    padding: 0 60px;
  }
}

/* Mega menu responsiveness */
@media (max-width: 1440px) {
  .mega-menu {
    width: min(96vw, 1100px);
  }
  .mega-menu-content {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}

@media (max-width: 1280px) {
  .mega-menu {
    width: min(96vw, 1000px);
  }
  .mega-menu-content {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

/* Safety: if mega menu is ever shown on tablet, make it full-bleed */
@media (max-width: 1024px) {
  .mega-menu {
    width: 100vw;
    left: 50%;
    transform: translate(-50%, 0);
    border-radius: 0;
  }
}

/* VERY IMPORTANT:
   Hide desktop nav on <=1024px and show mobile controls */
@media (max-width: 1024px) {
  .nav-container {
    padding: 1rem 40px;
    height: 64px;
    align-items: center;
  }

  /* Hide desktop nav clusters */
  .nav-right,
  .nav-center,
  .nav-links,
  .nav-actions,
  .login-container {
    display: none !important;
  }

  /* Show mobile controls */
  .mobile-actions {
    display: flex !important;
  }
  .mobile-menu-toggle {
    display: flex !important;
    margin-left: 6px;
  }
  #hamburgerBtn {
    display: block;
  }

  /* Mobile icon/badge tweaks */
  .mobile-actions .icon-button {
    padding: 0.25rem 0.35rem;
  }
  .mobile-actions .cart-count {
    top: -8px;
    right: -10px;
  }
  .hamburger-line {
    background-color: #0f172a;
  }

  /* Keep icon group vertically centered */
  .nav-container .mobile-actions {
    height: 64px;
  }
}

/* Hide mobile UI on desktop */
@media (min-width: 1025px) {
  .mobile-actions,
  .mobile-menu-toggle,
  .mobile-menu-panel {
    display: none !important;
  }
}

/* Phone refinements */
@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
  }
  .nav-container {
    padding: 1rem 1rem;
    height: 76px;
  }
  .logo img {
    height: 62px;
  }
  .mobile-menu-content {
    padding: 1.5rem;
  }
  .mobile-menu-header {
    padding: 1rem 1.5rem;
  }
  #hamburgerBtn {
    display: block;
  }
}
