/* ── Shared navbar used by every public page (landing + inner pages) ── */
#navbar.navbar-folded { transform: translateY(-100%); }
/* Built on Bootstrap's navbar/collapse components; visuals fully overridden here.
   Page-specific chrome (fixed no-scroll body, mini fixed footer) lives in each
   page's own stylesheet, NOT here — this file must stay safe to load on the
   landing page too. */

#navbar.navbar { padding: 0; }
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000; min-height: 70px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(229,231,235,0.7);
  box-shadow: 0 1px 12px rgba(0,0,0,0.06);
  transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, transform 0.35s cubic-bezier(0.4,0,0.2,1);
  /* Safari (mac and iOS) tends to drop a fixed element off its own GPU
     layer mid-scroll when it combines backdrop-filter with an animated
     transform — it then has to repaint on the main thread before the
     transform change is reflected, which is exactly what reads as the
     navbar "not returning immediately" during a fast scroll-up. Promoting
     the layer up front (will-change + a 3D transform hint) keeps it
     composited throughout the scroll so the translateY responds instantly. */
  will-change: transform;
  -webkit-transform: translateZ(0); transform: translateZ(0);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.nav-inner { max-width: 1200px; margin: 0 auto; padding: 0 48px; width: 100%; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.nav-logo.navbar-brand { margin-right: 0; padding: 0; font-size: 1rem; }
.nav-logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.nav-logo img { height: 34px; width: 34px; object-fit: contain; }
.nav-logo-name { font-size: 1.1rem; font-weight: 700; color: var(--text); line-height: 1; letter-spacing: -0.01em; transition: color 0.3s ease; }
.nav-logo-sub  { font-size: 0.58rem; font-weight: 500; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 1px; transition: color 0.3s ease; }

.navbar-nav.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; }
.nav-links .nav-link { position: relative; padding: 6px 12px; font-size: 0.85rem; font-weight: 500; color: var(--muted); transition: color 0.25s ease; white-space: nowrap; }
.nav-links .nav-link::after { content: ''; position: absolute; bottom: 2px; left: 12px; width: 0; height: 2px; background: var(--orange); border-radius: 2px; transition: width 0.3s cubic-bezier(0.4,0,0.2,1); }
.nav-links .nav-link:hover { color: var(--orange); }
.nav-links .nav-link:hover::after { width: calc(100% - 24px); }
.nav-links .nav-link.active { color: var(--orange); font-weight: 600; }
.nav-links .nav-link:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 4px; }

.nav-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.nav-login { font-size: 0.85rem; font-weight: 500; color: var(--muted); padding: 6px 12px; transition: color 0.2s ease; }
.nav-login:hover { color: var(--orange); }
.nav-login:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 4px; }
.nav-book { display: inline-flex; align-items: center; gap: 6px; padding: 8px 20px; background: var(--orange); color: #fff; font-size: 0.85rem; font-weight: 600; border-radius: 999px; transition: opacity 0.25s ease, transform 0.25s ease; }
.nav-book:hover { opacity: 0.9; transform: translateY(-1px); }
.nav-book:active { transform: translateY(0); }
.nav-book:focus-visible { outline: 2px solid var(--orange-dk); outline-offset: 2px; }
.nav-link-login { display: none; }
.nav-link-logout { display: none; }
.nav-link-account { display: none; }
.nav-link-dashboard { display: none; }
.nav-link-book { display: none; }

/* Logged-in profile dropdown (replaces the desktop "Login" link via
   public-nav.js when a session is active) */
.nav-profile { position: relative; }
.nav-profile-btn { display: flex; align-items: center; gap: 8px; background: transparent; border: none; cursor: pointer; padding: 4px 10px 4px 4px; border-radius: 999px; transition: background 0.2s ease; }
.nav-profile-btn:hover { background: rgba(127,127,127,0.1); }
.nav-profile-btn:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.nav-profile-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--orange); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.68rem; font-weight: 700; overflow: hidden; flex-shrink: 0; }
.nav-profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nav-profile-name { font-size: 0.85rem; font-weight: 600; color: var(--muted); white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.nav-profile-chevron { flex-shrink: 0; color: var(--muted); transition: transform 0.2s ease; }
.nav-profile-btn[aria-expanded="true"] .nav-profile-chevron { transform: rotate(180deg); }

.nav-profile-dropdown { position: absolute; top: calc(100% + 10px); right: 0; min-width: 220px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,0.14); padding: 8px; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s; z-index: 1100; }
.nav-profile-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-profile-dropdown-head { padding: 8px 10px 10px; }
.nav-profile-dropdown-name { font-size: 0.85rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-profile-dropdown-email { font-size: 0.74rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-profile-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.nav-profile-dropdown-item { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; border: none; background: transparent; font-family: 'Poppins', sans-serif; font-size: 0.84rem; font-weight: 500; color: var(--text); cursor: pointer; transition: background 0.15s ease, color 0.15s ease; text-decoration: none; }
.nav-profile-dropdown-item:hover { background: var(--orange-lt); color: var(--orange-dk); }
.nav-profile-logout { color: #DC2626; }
.nav-profile-logout:hover { background: #FEF2F2; color: #DC2626; }

/* Hamburger toggle (mobile) — a circular tap target that visibly responds
   to hover/press and shows a distinct "open" state, instead of three bare
   lines floating with no affordance. */
.nav-toggle.navbar-toggler { display: none; flex-direction: column; justify-content: center; align-items: center; gap: 5px; width: 40px; height: 40px; background: transparent; border: none; border-radius: 50%; padding: 0; cursor: pointer; flex-shrink: 0; }
.nav-toggle[aria-expanded="true"] { background: rgba(232,137,28,0.14); }
.nav-toggle:focus { box-shadow: none; }
.nav-toggle:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.nav-toggle span { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--text); transition: transform 0.25s ease, opacity 0.25s ease; }
.nav-toggle[aria-expanded="true"] span { background: var(--orange); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Desktop: a 3-column grid (1fr / auto / 1fr) instead of flex+space-between.
   The two equal 1fr side columns keep the middle nav-links column
   mathematically centered on the bar regardless of how wide the logo or
   nav-actions are — important because the logged-in profile widget
   (avatar + name + chevron) is noticeably wider than the plain "Login"
   text it replaces, which threw off the old "center the leftover flex
   space" approach and made the links look off-center while logged in. */
@media (min-width: 992px) {
  .nav-inner { display: grid; grid-template-columns: 1fr auto 1fr; }
  .nav-logo { grid-column: 1; justify-self: start; }
  .navbar-collapse { grid-column: 2; justify-self: center; justify-content: center; }
  .nav-actions { grid-column: 3; justify-self: end; }
}

@media (max-width: 991.98px) {
  .nav-toggle.navbar-toggler { display: flex; }
  /* Bypass Bootstrap's collapse JS entirely — it sets inline height styles
     that made the dropdown render taller than its content (extra white space).
     We use a max-height CSS toggle driven by our own JS click handler instead.
     display:block !important overrides Bootstrap's .collapse { display:none }. */
  /* opacity+transform animation avoids the max-height "white sliver" flash.
     visibility delays to 0 on close so the element hides only after the
     fade completes; on open it snaps to visible immediately. */
  .navbar-collapse {
    display: block !important;
    /* 100vw bypasses any containing-block created by backdrop-filter on the
       navbar ancestor — using 100% can resolve to a narrower ancestor width.
       z-index must be explicit: position:fixed takes the element out of the
       navbar's stacking context, so without it the collapse sits at z-index:auto
       (effectively 0) and hero section layers (image, overlays) render on top. */
    position: fixed; top: 70px; left: 0; width: 100vw; z-index: 999;
    box-sizing: border-box;
    background: #fff;
    border-bottom: 1px solid rgba(229,231,235,0.7);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
  }
  .navbar-collapse.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0s;
  }
  /* Prevent the flex row from wrapping now that the collapse is out of flow */
  .nav-inner { flex-wrap: nowrap; }
  /* backdrop-filter creates a GPU compositor layer that can flash white when
     a child changes visibility — not needed on mobile since the bar is opaque */
  #navbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(255,255,255,1); }
  /* .navbar-nav.nav-links (2 classes) elsewhere sets align-items:center —
     more specific than a plain .nav-links rule, so it would silently win
     over align-items:stretch here regardless of media-query order. Match
     the same compound selector so this override actually applies, or every
     item collapses to a short, centered, content-width box instead of a
     full-width left-aligned row (which is what made the menu look broken/
     "compressed" rather than a normal mobile dropdown). */
  .navbar-nav.nav-links { flex-direction: column !important; align-items: stretch !important; width: 100%; box-sizing: border-box; gap: 2px; padding: 10px 16px 16px !important; }
  .nav-links .nav-link { display: block; width: 100%; text-align: left; padding: 13px 14px; border-radius: 10px; border-bottom: none; transition: color 0.2s ease, background 0.2s ease; }
  .nav-links .nav-link::after { display: none; }
  .nav-links .nav-link:hover { background: rgba(127,127,127,0.1); }
  .nav-links .nav-link.active { background: rgba(232,137,28,0.12); }
  .nav-links .nav-link { display: flex; align-items: center; gap: 10px; }
  .nav-link-login { display: list-item; }
  .nav-link-login .nav-link { border-top: 2px solid rgba(0,0,0,0.10); border-radius: 0; margin-top: 4px; padding-top: 16px; }
  .nav-link-account { display: list-item; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 16px; }
  .nav-mobile-account { display: flex; align-items: center; gap: 10px; padding: 4px 14px 10px; }
  .nav-mobile-account-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
  .nav-link-dashboard { display: list-item; }
  .nav-link-logout { display: list-item; }
  .nav-link-logout .nav-link { color: #DC2626; }
  .nav-link-logout .nav-link:hover { background: #FEF2F2; }
  .nav-actions .nav-login { display: none; }
  /* The desktop profile button never appears collapsed — its content
     already lives in the mobile menu via the items above. */
  .nav-actions .nav-profile { display: none; }
  /* Reduce padding so logo + hamburger fit without overflow on small screens */
  .nav-inner { padding: 0 16px; }
  /* Hide the pill Book Now button — it's too wide to share the bar with the logo and hamburger */
  .nav-book { display: none; }
  /* Show Book Now as a styled link inside the mobile menu instead */
  .nav-link-book { display: list-item; position: relative; margin-top: 8px; }
  .nav-link-book::before { content: ''; display: block; height: 2px; background: rgba(232,137,28,0.45); margin: 0 14px 4px; }
  .nav-link-book .nav-link { color: var(--orange); font-weight: 600; border-top: none; border-radius: 10px; margin-top: 0; padding-top: 13px; }
  .nav-link-book .nav-link:hover { background: rgba(232,137,28,0.12); color: var(--orange-dk); }
}

