/*
 * Header + navigation, final layer.
 * Loaded last so it settles the conflicts between style.css, header.css,
 * premium.css and mobile-nav.css instead of adding a fifth opinion.
 * Tokens match the Event List 2.0 / homepage system.
 */

:root {
  --nav-brand: #4cac48;
  --nav-brand-dark: #3f9a3c;
  --nav-ink: #15182d;
  --nav-copy: #475569;
  --nav-line: #e2e8f0;
  --nav-shell: 1520px;
}

/* ---------- Header shell ---------- */

.headersticky .container-fluid {
  padding: 0 !important;
  background: #fff !important;
}

.headersticky .header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important; /* Shrunk gap */
  width: 100% !important; /* Full width window utility */
  margin: 0 !important;
  padding: 8px 24px !important; /* Standard edge paddings */
  box-sizing: border-box !important;
}

.headersticky .logo {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  margin-right: 24px !important; /* Ensure menu links never overlap the logo */
}

.headersticky .logo img {
  width: auto !important;
  max-width: none !important;
  height: 36px !important; /* Shrunk from 46px to save space and look premium */
  margin: 0 !important;
  object-fit: contain;
}

/* main-menu holds the nav row and the login button on one baseline. */
.headersticky .main-menu {
  display: flex !important;
  flex: 1 1 auto;
  align-items: center !important;
  justify-content: space-between !important; /* Distribute middle links and right buttons */
  gap: 16px !important;
  min-width: 0;
}

.headersticky .top-menu {
  order: 2;
  display: flex !important;
  flex: 0 0 auto;
  align-items: center !important;
  gap: 10px !important;
  margin: 0 !important;
  padding: 0 !important;
  position: static !important;
  width: auto !important;
}

.headersticky .login-btn a,
.headersticky .top-menu .welcome {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  height: 32px; /* Shrunk from 40px */
  padding: 0 14px !important; /* Shrunk from 22px */
  border: 1px solid var(--nav-brand) !important;
  border-radius: 999px !important;
  background: var(--nav-brand) !important;
  color: #fff !important;
  font-size: 12px !important; /* Shrunk from 14px */
  font-weight: 700 !important;
  line-height: 1 !important;
  text-transform: none !important;
  white-space: nowrap;
  transition: background-color .2s ease, border-color .2s ease;
}

.headersticky .login-btn a:hover,
.headersticky .top-menu .welcome:hover {
  background: var(--nav-brand-dark) !important;
  border-color: var(--nav-brand-dark) !important;
}

/* Search bar is removed from the markup; kill any legacy remnant. */
.headersticky .search-btn,
.headersticky .search-input,
.headersticky .searchbt {
  display: none !important;
}

/* ---------- Primary nav row: one even gap, no per-item margin hacks ---------- */

.headersticky .bottom-menu {
  order: 1;
  display: flex !important;
  flex: 1 1 auto;
  justify-content: center !important; /* Center navigation in center space */
  min-width: 0;
  max-height: none !important;
  padding: 0 !important;
  overflow: visible !important;
}

.headersticky .bottom-menu > ul {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 2px !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

.headersticky .bottom-menu > ul > li {
  position: relative !important;
  display: flex !important;
  align-items: center;
  min-width: 0;
  margin: 0 !important;
  padding: 0 !important;
}

.headersticky .bottom-menu > ul > li > a {
  display: block !important;
  max-width: none !important; /* Remove truncation max-width limits */
  padding: 6px 8px !important; /* Shrunk slightly from 10px to fit 12px font */
  border-radius: 6px !important;
  color: var(--nav-ink) !important;
  font-size: 12px !important; /* Increased font-size for better readability */
  font-weight: 600 !important;
  line-height: 1.2 !important;
  text-transform: none !important;
  text-decoration: none !important;
  letter-spacing: 0 !important;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap !important; /* Strictly nowrap */
  transition: color .2s ease, background-color .2s ease;
}

.headersticky .bottom-menu > ul > li > a:hover,
.headersticky .bottom-menu > ul > li:hover > a {
  background: rgba(76, 172, 72, .1) !important;
  color: var(--nav-brand) !important;
}

/* Dropdown caret: an inline chevron, so it can never sit on top of the label. */
.headersticky .bottom-menu > ul > li.dropdown > a {
  padding-right: 24px !important; /* Extended spacing for chevron to prevent text overlap */
  max-width: none !important; /* Ensure dropdown links are not truncated */
}

.headersticky .bottom-menu > ul > li.dropdown > a::before {
  content: "" !important;
  position: absolute !important;
  right: 10px !important; /* Balanced caret placement */
  left: auto !important;
  top: 50% !important;
  width: 6px !important; /* Slightly smaller, more elegant chevron */
  height: 6px !important;
  margin-top: -4px !important;
  border: 0 !important;
  border-right: 2px solid currentColor !important;
  border-bottom: 2px solid currentColor !important;
  background: none !important;
  transform: translateY(-50%) rotate(45deg) !important;
  transition: transform .2s ease;
}

.headersticky .bottom-menu > ul > li.dropdown:hover > a::before {
  transform: translateY(-50%) rotate(-135deg) !important;
  margin-top: 1px;
}

/* ---------- Dropdown panel: sized to its content, never clipped ---------- */

.headersticky .dropdown .dropdown-menu {
  position: absolute !important;
  top: calc(100% + 6px) !important;
  left: 0 !important;
  right: auto !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px !important;
  width: max-content !important;
  min-width: 260px !important;
  max-width: min(560px, calc(100vw - 48px)) !important;
  max-height: min(70vh, 560px) !important;
  padding: 16px !important;
  border: 1px solid var(--nav-line) !important;
  border-radius: 14px !important;
  background: #fff !important;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .14) !important;
  opacity: 0 !important;
  visibility: hidden !important;
  overflow: hidden auto !important;
  transform: translateY(6px) !important;
  transform-origin: top left !important;
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease !important;
  z-index: 100000 !important;
}

.headersticky .dropdown:hover .dropdown-menu,
.headersticky .dropdown:focus-within .dropdown-menu {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

/* The last few items open right-aligned so they stay inside the viewport. */
.headersticky .bottom-menu > ul > li:nth-last-child(-n+4) .dropdown-menu {
  left: auto !important;
  right: 0 !important;
  transform-origin: top right !important;
}

.headersticky .dropdown-menu > div {
  width: auto !important;
  max-width: 100% !important;
  padding: 0 0 12px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--nav-line) !important;
}

.headersticky .dropdown-menu > div h3 {
  margin: 0 0 4px !important;
  color: var(--nav-ink) !important;
  font-family: inherit !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  line-height: 1.3 !important;
}

.headersticky .dropdown-menu > div p {
  display: -webkit-box;
  margin: 0 !important;
  overflow: hidden;
  color: var(--nav-copy) !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.headersticky .dropdown-menu > div a {
  display: none !important;
}

/* Submenu items: full label visible, wrapping to a second line if needed. */
.headersticky .dropdown-menu > ul {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

/* More than 8 links reads better as two columns than one tall strip. */
.headersticky .dropdown-menu > ul:has(> li:nth-child(9)) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 10px !important;
}

.headersticky .dropdown-menu > ul > li {
  position: static !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.headersticky .dropdown-menu > ul > li > a {
  display: block !important;
  min-width: 0 !important;
  max-width: 100% !important;
  padding: 8px 10px !important;
  border-radius: 8px !important;
  color: var(--nav-copy) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.45 !important;
  text-transform: none !important;
  text-decoration: none !important;
  overflow-wrap: anywhere;
  white-space: normal !important;
  transition: background-color .18s ease, color .18s ease;
}

.headersticky .dropdown-menu > ul > li > a:hover {
  padding-left: 10px !important;
  background: rgba(76, 172, 72, .1) !important;
  color: var(--nav-brand) !important;
}

.headersticky .dropdown-menu .menu-img {
  display: none !important;
}

.headersticky .plusminuse {
  display: none !important;
}

/* ---------- Tablet: tighter type before the burger takes over ---------- */

@media (max-width: 1399px) {
  .headersticky .header {
    padding: 8px 16px !important; /* Slightly tighter edge margin */
  }

  .headersticky .logo {
    margin-right: 12px !important;
  }

  .headersticky .bottom-menu > ul > li > a {
    max-width: none !important;
    padding: 6px 6px !important;
    font-size: 11px !important; /* Slightly larger, readable font */
  }

  .headersticky .bottom-menu > ul > li.dropdown > a {
    max-width: none !important;
    padding-right: 18px !important;
  }

  .headersticky .bottom-menu > ul > li.dropdown > a::before {
    right: 7px !important; /* Prevent overlapping on smaller width links */
  }

  .headersticky .logo img {
    height: 32px !important;
  }

  .headersticky .login-btn a,
  .headersticky .top-menu .welcome {
    height: 30px;
    padding: 0 12px !important;
    font-size: 11px !important;
  }
}

/* ---------- Tablet (768-992px): burger panel ----------
   The bottom dock only exists at <=767px and style.css hides the burger above
   it, so this band previously had 15 nav items and no way to reach them. */

@media (max-width: 992px) {
  .headersticky .header {
    position: relative !important;
    width: calc(100% - 24px) !important;
    gap: 12px !important;
  }

  .headersticky .main-menu {
    gap: 10px !important;
  }

  .headersticky .toggle-button {
    order: 3;
    display: block !important;
    flex: 0 0 auto;
    margin: 0 !important;
  }

  .headersticky .bottom-menu {
    order: 4;
    position: absolute !important;
    left: 0;
    right: 0;
    top: 100%;
    display: none !important;
    max-height: calc(100vh - 100%) !important;
    padding: 8px 16px 24px !important;
    background: #fff !important;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .16) !important;
    overflow: auto !important;
  }

  .headersticky .bottom-menu.show {
    display: block !important;
  }

  .headersticky .bottom-menu > ul {
    display: block !important;
    width: 100%;
  }

  .headersticky .bottom-menu > ul > li {
    display: block !important;
    border-bottom: 1px solid var(--nav-line);
  }

  .headersticky .bottom-menu > ul > li > a,
  .headersticky .bottom-menu > ul > li.dropdown > a {
    max-width: none;
    padding: 13px 4px !important;
    font-size: 15px !important;
    white-space: normal;
    overflow: visible;
  }

  .headersticky .bottom-menu > ul > li.dropdown > a::before {
    display: none !important;
  }

  .headersticky .dropdown .dropdown-menu {
    position: static !important;
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: none !important;
    padding: 0 0 10px 10px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    overflow: visible !important;
  }

  .headersticky .dropdown-menu > div {
    display: none !important;
  }

  .headersticky .dropdown-menu > ul,
  .headersticky .dropdown-menu > ul:has(> li:nth-child(9)) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Phones: the fixed bottom dock is the primary nav, so the burger and its
   panel stand down entirely rather than offering a second, competing menu. */
@media (max-width: 767px) {
  .headersticky .toggle-button,
  .headersticky .bottom-menu,
  .headersticky .bottom-menu.show {
    display: none !important;
  }

  .headersticky .header {
    width: 100% !important;
    padding: 8px 12px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  .headersticky .logo img {
    height: 36px !important;
  }

  .headersticky .login-btn a,
  .headersticky .top-menu .welcome {
    height: 36px;
    padding: 0 14px !important;
    font-size: 12px !important;
  }

  /* Global horizontal scroll prevention on mobile */
  html, body {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  /* Prevent any wide container from causing page-level scroll */
  .container,
  .container-fluid,
  .row {
    max-width: 100% !important;
  }
}

/* ---------- Mobile bottom dock ---------- */

@media (max-width: 991px) {
  .mobile-bottom-nav {
    gap: 4px !important;
    padding: 6px !important;
  }

  .mobile-nav-item {
    gap: 5px !important;
    padding: 0 2px !important;
    height: 54px !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
  }

  /* Lucide renders an <svg>; size it like the old icon font glyph. */
  .mobile-nav-item svg,
  .mobile-nav-item i[data-lucide] {
    width: 21px !important;
    height: 21px !important;
    stroke-width: 2 !important;
    flex: 0 0 auto;
  }

  .mobile-nav-item span {
    display: block;
    width: 100%;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Sheet rows: icon | label | chevron, so long titles never hit the arrow.
     Submenu titles are admin-authored and often long, so they wrap to two
     lines rather than being cut off mid-word. */
  .mobile-more-overlay .more-grid-item {
    display: grid !important;
    grid-template-columns: 20px minmax(0, 1fr) 16px !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    min-height: 52px !important;
    margin: 0 !important;
    padding: 11px 14px !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: transparent !important;
    color: var(--nav-ink) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-align: left !important;
    text-decoration: none !important;
  }

  .mobile-more-overlay .more-grid-item:active {
    background: rgba(76, 172, 72, .1) !important;
  }

  .mobile-more-overlay .more-grid-item > span {
    display: -webkit-box;
    min-width: 0;
    overflow: hidden;
    line-height: 1.32;
    overflow-wrap: anywhere;
    white-space: normal !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .mobile-more-overlay .more-grid-item svg {
    width: 18px !important;
    height: 18px !important;
    stroke-width: 2 !important;
    flex: 0 0 auto;
  }

  /* Leading bullet reads as a marker, not a competing icon. */
  .mobile-more-overlay .more-grid-item > svg:first-child {
    color: var(--nav-brand) !important;
  }

  .mobile-more-overlay .more-item-arrow {
    justify-self: end;
    color: var(--nav-copy) !important;
    opacity: .45;
  }

  .mobile-sheet-list,
  .more-grid-single,
  .more-section-group {
    display: grid !important;
    gap: 2px !important;
  }

  .more-section-title {
    margin: 14px 0 4px !important;
    padding: 0 14px !important;
    color: var(--nav-brand) !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    letter-spacing: .1em !important;
    text-transform: uppercase !important;
  }

  .more-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 4px 14px 10px !important;
    border-bottom: 1px solid var(--nav-line) !important;
  }

  .more-header h3 {
    margin: 0 !important;
    color: var(--nav-ink) !important;
    font-size: 18px !important;
    font-weight: 800 !important;
  }

  .more-close-btn {
    display: grid !important;
    place-items: center !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    border: 1px solid var(--nav-line) !important;
    border-radius: 999px !important;
    background: #fff !important;
    color: var(--nav-ink) !important;
    font-size: 20px !important;
    line-height: 1 !important;
  }
}
