/* ==========================================================================
   SP Portal — Primary Navigation
   Copied over from sp-cotabatocity-portal-gov-ph's styles/css/navigation.css
   (the "ceremonial theme" nav styling), trimmed to what's relevant to
   #sp-navigator here -- the reference file also has styling for
   #member-profile-bio-tab / #member-leg-tab / #ordinance-detail-tab, which
   are tab groups on pages this project doesn't have, so those were left out.
   ========================================================================== */

#sp-navigator {
  background-color: white !important;
  box-shadow: 0px 4px 24px rgba(0, 0, 0, 0.4);
}
#sp-navigator .nav-link,
#sp-navigator .navbar-brand {
  color: black !important;
}
#sp-navigator .nav-link {
  border-radius: 6px;
  transition: background-color .15s ease, color .15s ease;
}
/* Plain :hover/:focus alone isn't enough here: Bootstrap's Dropdown.show()
   (called from js/navigation.js's hover-open handler) moves DOM focus onto
   the toggle link even though nothing was clicked, so a rule keyed to
   :focus stayed lit long after the pointer actually left -- moving the
   mouse away closed the dropdown but left the green background stuck
   until something else stole focus. Fixed by dropping :focus in favor of:
     - :hover, for the immediate, purely pointer-driven highlight
     - :focus-visible, which (per spec) only matches focus that actually
       came from keyboard navigation, so it's unaffected by the show()
       side-effect above
     - .show, the class Bootstrap itself adds to the toggle exactly while
       its menu is open and removes on hide() -- keeping the header lit
       for the dropdown's whole open duration, and turning off in the same
       instant js/navigation.js's mouseleave timer calls hide(). */
#sp-navigator .nav-link:hover,
#sp-navigator .nav-link:focus-visible,
#sp-navigator .nav-link.show {
  color: #fff !important;
  background-color: forestgreen !important;
}

#sp-navigator .dropdown-menu { z-index: 2000 !important; }

/* Submenu items (Ordinances, Rules of the Sanggunian, etc.) -- apple
   green on hover, in place of Bootstrap's default light-gray
   .dropdown-item:hover. Apple green (#8db600) is light enough that the
   default dark dropdown-item text stays comfortably readable on it (no
   need for the white-text swap the darker forestgreen top-level nav-link
   hover needed), which also gives the two hover levels -- top-level menu
   vs. the submenu underneath it -- a visibly different, complementary
   tone. :focus-visible (not :focus), same reasoning as .nav-link above:
   keeps this from lighting up just because a link was clicked rather than
   tabbed to. */
#sp-navigator .dropdown-item:hover,
#sp-navigator .dropdown-item:focus-visible {
  background-color: #8db600;
}

/* Search icon + popup (SP Members / Ordinances / Committees / search box),
   pinned to the navbar's right-most edge. .navbar-collapse's own width is
   normally just its content's (the <ul>), so at xl+ (navbar-expand-xl's
   breakpoint) it's stretched with flex-grow to span the rest of the
   navbar's width -- only then does margin-left:auto on .nav-search have
   any spare room to push into, landing it flush against the right edge
   instead of immediately after the last nav item. Below xl the collapse
   panel is a full-width block (Bootstrap's mobile menu), so .nav-search
   just falls in its normal document position under the nav links, with no
   flex tricks needed. */
@media (min-width: 1200px) {
  #sp-navigator .navbar-collapse {
    flex-grow: 1;
  }
  #sp-navigator .nav-search {
    margin-left: auto;
  }
}

#sp-navigator .nav-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 8px; /* matches the nav-item stack spacing on mobile */
}
@media (min-width: 1200px) {
  #sp-navigator .nav-search {
    margin-top: 0;
  }
}
#sp-navigator .nav-search__toggle {
  background: transparent;
  border: none;
  color: black;
  font-size: 1.15rem;
  padding: 6px 10px;
  line-height: 1;
  border-radius: 6px;
  transition: background-color .15s ease, color .15s ease;
}
/* Same :focus-vs-:focus-visible fix as .nav-link above -- clicking the
   search icon leaves it focused after the pointer moves away, which kept
   this green too if it were keyed to :focus. */
#sp-navigator .nav-search__toggle:hover,
#sp-navigator .nav-search__toggle:focus-visible,
#sp-navigator .nav-search__toggle.show {
  color: #fff;
  background-color: forestgreen;
}
#sp-navigator .nav-search__menu {
  min-width: 240px;
  padding: 8px 0;
}
#sp-navigator .nav-search__form .form-control:focus {
  box-shadow: 0 0 0 0.2rem rgba(1, 68, 33, 0.15);
  border-color: #014421;
}

/* Default hamburger */
#sp-navigator .navbar-toggler.collapsed .navbar-toggler-icon {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(0,0,0,0.7)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}
/* When active, show X */
#sp-navigator .navbar-toggler:not(.collapsed) .navbar-toggler-icon {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(0,0,0,0.7)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M6 6l18 18M24 6L6 24'/%3E%3C/svg%3E");
}
#sp-navigator .disabled {
  pointer-events: none;
  color: gray;
  cursor: not-allowed;
  text-decoration: none;
}
#sp-navigator .nav-link.disabled {
  color: #6c757d !important;
  pointer-events: none;
  cursor: not-allowed;
}

#sp-navigator .nav-link.disabled:hover,
#sp-navigator .nav-link.disabled:focus {
  color: #6c757d !important;
  background-color: transparent !important;
  text-decoration: none !important;
}
