/* ════════════════════════════════════════════════════════════════════════════
   global.css — site-wide cosmetics
   ────────────────────────────────────────────────────────────────────────────
   Add to every page with:
       <link rel="stylesheet" href="/global.css">
   Loaded BEFORE page-specific styles so per-page rules can still override.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Hide scrollbars while keeping scroll behaviour ──
   The content still scrolls (wheel, drag, keyboard, touch) — we just hide
   the visual scrollbar tracks. */
html, body {
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* old Edge / IE */
}
html::-webkit-scrollbar,
body::-webkit-scrollbar { display: none; }   /* Chrome / Safari */

/* Apply to every scrollable child too. `* { scrollbar-width: none }` is
   safe because it doesn't change scroll behaviour, just the visuals. */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; }

/* ── Floating back button (injected by nav.js if a page doesn't declare its
   own #backBtn). Positioned top-left, doesn't interfere with anything. ── */
.global-back-btn {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  background: rgba(255, 253, 249, 0.95);
  border: 1px solid #E8DDD0;
  color: #2C2420;
  font-family: 'Jost', sans-serif;
  font-size: 0.78rem;
  padding: 7px 12px 7px 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(44, 36, 32, 0.06);
  transition: all 0.15s;
}
.global-back-btn:hover {
  background: #FFFDF9;
  border-color: #C9A84C;
  color: #2C2420;
}
.global-back-btn svg { width: 14px; height: 14px; }

/* Page-defined #backBtn elements use the same look unless overridden. */
#backBtn.page-back-btn {
  background: none;
  border: 1px solid #E8DDD0;
  color: #5C4A3A;
  font-family: 'Jost', sans-serif;
  font-size: 0.78rem;
  padding: 7px 12px 7px 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.15s;
}
#backBtn.page-back-btn:hover {
  border-color: #C9A84C;
  color: #2C2420;
}
#backBtn.page-back-btn svg { width: 14px; height: 14px; }

/* Floating Dashboard link — sits to the right of the floating back button
   on pages that don't have their own header navigation. */
.global-dashboard-btn {
  position: fixed;
  top: 14px;
  /* Position to the right of the back button. Back is ~84px wide at 14px left,
     so 14 + 84 + 8 = 106px. Adjust slightly upward if it ever wraps. */
  left: 106px;
  z-index: 200;
  background: rgba(255, 253, 249, 0.95);
  border: 1px solid #E8DDD0;
  color: #2C2420;
  font-family: 'Jost', sans-serif;
  font-size: 0.78rem;
  padding: 7px 12px 7px 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(44, 36, 32, 0.06);
  transition: all 0.15s;
}
.global-dashboard-btn:hover {
  background: #FFFDF9;
  border-color: #C9A84C;
  color: #2C2420;
}
.global-dashboard-btn svg { width: 14px; height: 14px; }

@media (max-width: 600px) {
  /* On phones, hide the "Dashboard" / "Back" text labels — keep just the icons. */
  .global-back-btn span,
  .global-dashboard-btn span { display: none; }
  .global-back-btn,
  .global-dashboard-btn { padding: 7px 9px; }
  .global-dashboard-btn { left: 56px; }
}

/* ════════════════════════════════════════════════════════════════════════════
   Top loading bar (thin sweeping indicator for initial page fetches).
   Show by adding the .active class; remove to fade out.
   Auto-injected by progress.js on pages that include it.
   ═══════════════════════════════════════════════════════════════════════════ */
.top-progress-bar {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  background: transparent;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  overflow: hidden;
}
.top-progress-bar.active { opacity: 1; }

.top-progress-bar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; height: 100%;
  width: 30%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #C9A84C 40%,
    #C4363A 60%,
    transparent 100%
  );
  /* Rapid left-to-right sweep, loops while .active is on. */
  animation: top-progress-sweep 0.9s linear infinite;
}

@keyframes top-progress-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(440%); }
}

@media (prefers-reduced-motion: reduce) {
  .top-progress-bar::before {
    animation-duration: 1.8s;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   Canonical top-right nav pills.
   Same look and order across every protected page.
   Apply by giving each link in the header right side the class .nav-pill.
   ═══════════════════════════════════════════════════════════════════════════ */
.nav-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-pill {
  font-family: 'Jost', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  padding: 7px 12px;
  background: #FFFDF9;
  border: 1px solid #E8DDD0;
  color: #5C4A3A;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1;
}
.nav-pill:hover {
  border-color: #C9A84C;
  color: #2C2420;
}
.nav-pill:active { transform: translateY(0.5px); }

.nav-pill svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* The current page's pill is dimmed, so it's clearly "you are here" but
   still visually present (no jarring layout shift between pages). */
.nav-pill.current {
  background: transparent;
  border-color: transparent;
  color: #8B7355;
  cursor: default;
  pointer-events: none;
}

/* Variant: primary (used for the rightmost CTA like "Save", if needed) */
.nav-pill.primary {
  background: #C4363A;
  border-color: #C4363A;
  color: #FFFFFF;
}
.nav-pill.primary:hover {
  background: #9B1B30;
  border-color: #9B1B30;
  color: #FFFFFF;
}

/* On phones, drop the text labels and keep only the icons so the pills
   stay compact and the header doesn't wrap. */
@media (max-width: 600px) {
  .nav-pill .nav-pill-text { display: none; }
  .nav-pill { padding: 7px 10px; }
  .nav-row { gap: 6px; }
}

/* Avoid double-buttons: if a page still has the OLD floating back/dashboard
   buttons in the corner, hide them once nav-pills are present in the header
   (they'd just duplicate the same actions). */
body:has(.nav-pill) .global-back-btn,
body:has(.nav-pill) .global-dashboard-btn { display: none; }
