/* ==========================================================================
   THE DEFINTIVE ESOWE BOARDWALK NAVIGATION FIXED CORE 
   ========================================================================== */

header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2000 !important; /* Alltid på topp */
  background: #ffffff;
  border-bottom: 1px solid rgba(16, 43, 30, 0.06);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.015);
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

header.scrolled {
  padding: 4px 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

.nav-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
}

.logo-container {
  display: flex;
  align-items: center;
  height: 92px;
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

header.scrolled .logo-container {
  height: 72px;
}

.logo-img {
  height: 100%;
  width: auto;
  display: block;
}

/* Desktop Menu Layout */
.nav-menu {
  display: flex;
  list-style: none;
  gap: 32px;
  align-items: center;
  margin: 0;
  padding: 0;
}

.nav-link {
  color: #1f2937;
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.03em;
  position: relative;
  padding: 8px 0;
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  opacity: 0.85;
}

.nav-link:hover, .nav-link.active {
  opacity: 1;
  color: #f75f2c;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #f75f2c;
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.nav-link:hover::after, .nav-link.active::after {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-only-actions {
  display: none !important;
}

.header-actions .header-btn-filled,
.header-actions .header-btn-outlined {
  min-width: 126px;
  border-radius: 999px !important;
  box-shadow: 0 10px 24px rgba(16, 43, 30, 0.08);
}

.header-actions .header-btn-filled {
  background: linear-gradient(135deg, #cbdcd0 0%, #f3f4f1 100%) !important;
  border: 1px solid rgba(6, 78, 59, 0.12) !important;
  color: #064e3b !important;
}

.header-actions .header-btn-filled:hover {
  background: linear-gradient(135deg, #f75f2c 0%, #fa7c50 100%) !important;
  color: #ffffff !important;
  border-color: #f75f2c !important;
  transform: translateY(-2px);
}

.header-actions .header-btn-outlined {
  background: #064e3b !important;
  color: #ffffff !important;
  border: 2px solid #064e3b !important;
  box-shadow: 0 12px 28px rgba(6, 78, 59, 0.18);
}

.header-actions .header-btn-outlined:hover {
  background: #f75f2c !important;
  border-color: #f75f2c !important;
  color: #ffffff !important;
  transform: translateY(-2px);
}

/* Desktop Dropdown logic */
.nav-item-dropdown {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  border: 1px solid rgba(16, 43, 30, 0.06);
  border-radius: 12px;
  list-style: none;
  padding: 12px 0;
  min-width: 240px;
  display: none;
}
.dropdown-menu li a {
  display: block;
  padding: 10px 24px;
  color: #1f2937;
  font-size: 15px;
  transition: all 0.3s ease;
}
.dropdown-menu li a:hover {
  background: #f3f4f1;
  color: #f75f2c;
}
.nav-item-dropdown:hover .dropdown-menu {
  display: block;
}

/* ==========================================================================
   CRITICAL MOBILE MEDIA QUERY DISPATCH ENGINE
   ========================================================================== */

/* Hamburger-knapp (Tvinger frem rå klikkbarhet på mobil) */
.mobile-menu-toggle {
  display: none;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  padding: 10px !important;
  z-index: 3000 !important; /* Skal ligge over over-overlayet */
  flex-direction: column;
  gap: 6px;
  width: 48px !important;  
  height: 48px !important; 
  justify-content: center;
  align-items: center;
  pointer-events: auto !important;
}

.mobile-menu-toggle span {
  display: block;
  width: 26px;
  height: 3px;
  background-color: #064e3b;
  border-radius: 3px;
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

@media (max-width: 991px) {
  .nav-container {
    padding: 12px 24px; /* Holder pusterom på mobilskjermer */
  }

  .mobile-menu-toggle {
    display: flex !important; /* Tvinger frem synlighet */
  }

  .header-actions {
    display: none !important; /* Dreper skrivebordsknappene helt */
  }

  /* Fullstendig transformasjon av menylisten til mørkegrønt slide-panel */
  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 360px;
    height: 100vh;
    background: #064e3b;
    padding: 100px 32px 40px 32px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 16px;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.2);
    transition: right 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    overflow-y: auto;
    z-index: 2500;
    box-sizing: border-box;
  }

  header.nav-open .nav-menu {
    right: 0 !important;
  }

  .nav-link {
    color: #ffffff !important;
    font-size: 20px !important;
    width: 100%;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    opacity: 0.9;
  }

  .nav-link::after {
    display: none !important;
  }

  .dropdown-menu {
    position: static;
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 4px 0 4px 16px;
    display: block;
  }

  .dropdown-menu li a {
    color: rgba(255, 255, 255, 0.75) !important;
    font-size: 16px;
    padding: 8px 0;
  }

  /* Mobilknappene integrert vakkert i bunnen */
  .mobile-only-actions {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
  }

  .mobile-only-actions .header-btn-filled,
  .mobile-only-actions .header-btn-outlined {
    width: 100% !important;
    height: 48px !important;
    font-size: 13px !important;
  }

  .mobile-only-actions .header-btn-outlined {
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
  }

  /* HAMBURGER TIL "X" LUKKEANIMASJON */
  header.nav-open .mobile-menu-toggle span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
    background-color: #ffffff !important; /* Blir hvit over det grønne panelet */
  }

  header.nav-open .mobile-menu-toggle span:nth-child(2) {
    opacity: 0 !important;
  }

  header.nav-open .mobile-menu-toggle span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
    background-color: #ffffff !important;
  }
}

/* Polished mobile navigation */
.mobile-nav-contact {
  display: none;
}

@media (max-width: 991px) {
  .nav-container {
    padding: 12px 18px 12px 24px !important;
  }

  .mobile-menu-toggle {
    display: inline-flex !important;
    margin-left: auto;
    width: 58px !important;
    height: 58px !important;
    padding: 0 !important;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    gap: 6px;
    z-index: 2600 !important;
    background: rgba(203, 220, 208, 0.36) !important;
  }

  .mobile-menu-toggle span {
    width: 30px;
    height: 4px;
    background: #064e3b;
    border-radius: 999px;
  }

  .nav-menu {
    right: -100% !important;
    width: min(88vw, 390px) !important;
    max-width: none !important;
    padding: 104px 30px 32px !important;
    background: #ffffff !important;
    border-left: 1px solid rgba(16, 43, 30, 0.08);
    box-shadow: -18px 0 48px rgba(16, 43, 30, 0.16) !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  body.nav-open .nav-menu,
  header.nav-open .nav-menu {
    right: 0 !important;
  }

  .nav-menu > li {
    width: 100%;
  }

  .nav-link {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 !important;
    color: #1f2937 !important;
    font-size: 21px !important;
    line-height: 1.15;
    border-bottom: 1px solid rgba(16, 43, 30, 0.08) !important;
  }

  .dropdown-menu {
    position: static !important;
    display: grid !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    gap: 4px;
    min-width: 0;
    width: 100%;
    margin: 6px 0 8px !important;
    padding: 10px !important;
    background: rgba(203, 220, 208, 0.22) !important;
    border: 1px solid rgba(16, 43, 30, 0.08) !important;
    border-radius: 18px !important;
    box-shadow: none !important;
  }

  .dropdown-menu li a {
    display: block;
    padding: 9px 12px !important;
    color: #064e3b !important;
    font-size: 16px !important;
    line-height: 1.25;
    border-radius: 10px;
  }

  .mobile-only-actions {
    margin-top: 20px !important;
    padding-top: 18px !important;
    border-top: 1px solid rgba(16, 43, 30, 0.1) !important;
  }

  .mobile-nav-contact {
    display: block;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(16, 43, 30, 0.08);
    color: rgba(31, 41, 55, 0.72);
    font-size: 14px;
    line-height: 1.5;
  }

  .mobile-nav-contact a {
    color: #064e3b;
    font-weight: 700;
  }

  header.nav-open .mobile-menu-toggle {
    background: #064e3b !important;
  }
}
