/***************************************************************
 * theme-enhance.css — Glam & Fab visual layer
 *
 * Loaded AFTER each page's own <style> block, so it refines the
 * existing look without any page's markup or JavaScript changing.
 * Nothing here selects by JS hook, changes layout flow, or hides
 * anything — every rule is colour, type, border, shadow or motion.
 *
 * WHY THE GOLD IS SPLIT IN TWO
 * The brand gold (#C9A227) measures 2.42:1 against white. WCAG 2.1
 * AA needs 4.5:1 for text, so as *lettering* it is genuinely hard to
 * read — worse under clinic lighting, on a phone outdoors, or for
 * anyone with reduced contrast sensitivity. Rather than drop the
 * gold, it is split by job:
 *   --gf-gold-ink (#7E6110)  text, icons, focus rings   5.83:1 ✓
 *   --gf-gold-leaf (#C9A227) ornament only — hairlines, glows,
 *                            gradients, sweeps: never lettering
 * Both read unmistakably as gold; only the ink is dark enough to be
 * read at body size.
 ***************************************************************/

:root {
  /* Readable gold — for anything a person must actually read. */
  --gf-gold-ink: #7E6110;
  --gf-gold-ink-soft: #8A6A0F;

  /* Ornamental gold — hairlines, gradients, glow. Never text. */
  --gf-gold-leaf: #C9A227;
  --gf-gold-leaf-2: #E0BE5A;
  --gf-gold-wash: rgba(201, 162, 39, 0.10);
  --gf-gold-line: rgba(201, 162, 39, 0.34);

  /* Muted body copy at #8E747B measures 4.26:1 — just under AA. */
  --gf-muted-ink: #785E66;

  --gf-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --gf-lift: 0 10px 24px rgba(146, 106, 116, 0.16);
  --gf-lift-lg: 0 18px 42px rgba(146, 106, 116, 0.20);
}

/* ============================================================
   1. TYPOGRAPHY — weight now carries the hierarchy
   The page previously ran heading and body at similar weights,
   so a banner and a paragraph read with equal emphasis. Each
   level now has its own weight, size step and letter-spacing.
   ============================================================ */

.hero h1,
.app-topbar-title > span:first-child {
  font-family: var(--font-h);
  font-weight: 600;
  letter-spacing: 0.012em;
}

.hero h1 {
  font-size: clamp(30px, 6vw, 44px);
  line-height: 1.12;
  text-wrap: balance;
  background: linear-gradient(180deg, var(--text-strong) 0%, #7A5A62 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* Hairline gold rule under the banner — ornament, not text. */
.hero h1::after {
  content: "";
  display: block;
  width: 62px;
  height: 2px;
  margin: 14px auto 0;
  border-radius: 2px;
  background: linear-gradient(90deg,
    transparent, var(--gf-gold-leaf) 35%, var(--gf-gold-leaf-2) 65%, transparent);
}

/* Same hairline, sized for the Staff Sign In card's own heading — chosen
   deliberately by the client after comparing gold-accent options for this
   exact screen (login.html?staffMode=1). Scoped to this one card only. */
#staffLoginSection > h3::after {
  content: "";
  display: block;
  width: 40px;
  height: 2px;
  margin: 8px auto 0;
  border-radius: 2px;
  background: linear-gradient(90deg,
    transparent, var(--gf-gold-leaf) 35%, var(--gf-gold-leaf-2) 65%, transparent);
}

.hero p {
  font-weight: 400;
  font-size: 14.5px;
  letter-spacing: 0.006em;
  color: var(--gf-muted-ink);
}

h2, h3 { font-weight: 500; letter-spacing: 0.008em; }
h4 {
  font-family: var(--font-b);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Eyebrow / section labels — small, spaced, gold, and readable. */
.k, .app-topbar .app-topbar-sub {
  font-family: var(--font-b);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gf-gold-ink);
}

.muted, .section-note, .subtext { color: var(--gf-muted-ink); }

label {
  font-weight: 600;
  letter-spacing: 0.012em;
  color: var(--text-strong);
}

/* Figures line up in columns wherever numbers are compared. */
.num, table td, table th,
input[inputmode="numeric"], input[inputmode="decimal"], input[type="date"] {
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   2. BUTTONS — gold border sweep, lift, and a real press
   ============================================================ */

.btn, .hubc, .navlink, button.back, .cart-icon-btn {
  transition:
    transform 160ms var(--gf-ease),
    box-shadow 220ms var(--gf-ease),
    border-color 220ms var(--gf-ease),
    background-color 220ms var(--gf-ease);
}

.btn { position: relative; isolation: isolate; }

/* The sweep: a gold gradient edge that wipes in on hover. It sits
   on a pseudo-element so it can never affect the button's box or
   its click target. */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(115deg,
    transparent 12%,
    var(--gf-gold-leaf) 38%,
    var(--gf-gold-leaf-2) 52%,
    var(--gf-gold-leaf) 66%,
    transparent 88%);
  background-size: 260% 100%;
  background-position: 120% 0;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 200ms var(--gf-ease), background-position 620ms var(--gf-ease);
  pointer-events: none;
  z-index: 1;
}

.btn:hover:not(:disabled)::after,
.btn:focus-visible::after {
  opacity: 1;
  background-position: -20% 0;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1.5px);
  box-shadow: var(--gf-lift);
}

.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.988);
  box-shadow: 0 3px 10px rgba(146, 106, 116, 0.16);
  transition-duration: 70ms;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:disabled::after { opacity: 0; }

/* Secondary/light buttons carry the gold as their resting edge, so
   the accent is present without being shouted. */
.btn.btn-light, .btn.ghost, .btn.btn-secondary {
  border-color: var(--gf-gold-line);
  color: var(--gf-gold-ink);
}
.btn.btn-light:hover:not(:disabled),
.btn.ghost:hover:not(:disabled),
.btn.btn-secondary:hover:not(:disabled) {
  border-color: var(--gf-gold-leaf);
  background-color: var(--gf-gold-wash);
}

/* ============================================================
   3. FOCUS — visible on every control, in brand gold
   Focus was previously near-invisible on much of the app, which
   makes keyboard and switch use guesswork. The ring uses the INK
   gold so it clears 3:1 against every surface behind it.
   ============================================================ */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2.5px solid var(--gf-gold-ink);
  outline-offset: 2px;
  border-radius: 10px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gf-gold-ink-soft);
  box-shadow: 0 0 0 3.5px var(--gf-gold-wash);
}

/* ============================================================
   4. TOUCH TARGETS — WCAG 2.5.5 asks for 44x44
   Applied as a minimum, never a fixed size, so nothing that is
   already larger is altered and no layout reflows.
   ============================================================ */

.btn, button, .navlink, select, input:not([type="hidden"]), textarea {
  min-height: 44px;
}
.btn, button, .navlink { touch-action: manipulation; }

/* Small inline controls keep their compact look but gain a padded
   hit area via a transparent pseudo-element. */
.cart-icon-btn, .app-topbar-back {
  position: relative;
  min-height: 44px;
  min-width: 44px;
}

/* For a control that must STAY visually small — a "View all" sitting
   beside a card heading, where a 44px button would unbalance the row —
   project the hit area outward instead of growing the box. The
   pseudo-element belongs to the button, so taps anywhere in it still
   land on the button. Only safe where the neighbours are plain text;
   do not put this on a control that sits next to another control. */
.gf-tap-expand { position: relative; }
.gf-tap-expand::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 44px;
  min-width: 44px;
  transform: translateY(-50%);
}

/* ============================================================
   5. CARDS & SURFACES — layered depth, gold edge on focus-within
   ============================================================ */

.card, .lookup-editor, .details-card {
  transition: box-shadow 260ms var(--gf-ease), border-color 260ms var(--gf-ease);
}

.card:focus-within, .lookup-editor:focus-within {
  border-color: var(--gf-gold-line);
  box-shadow: var(--gf-lift);
}

/* Section headings inside cards get a gold hairline to their right,
   which gives the page rhythm without adding another border box. */
.lookup-editor > h4, .card > .k {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lookup-editor > h4::after, .card > .k::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--gf-gold-line), transparent);
}

details.details-card > summary {
  font-family: var(--font-h);
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ============================================================
   6. RESPONSE / FEEDBACK — status messages that announce themselves
   Status text used to appear with no transition, so a result could
   change silently under the reader's eyes. Each now rises into
   place with a coloured rail marking what kind of message it is.
   ============================================================ */

.status, .status-info, .status-success, .status-error, .info-box {
  animation: gfStatusIn 300ms var(--gf-ease) both;
  border-left: 3px solid transparent;
  padding-left: 14px;
}

@keyframes gfStatusIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.status-success { border-left-color: #5C8A63; }
.status-error   { border-left-color: #B4636F; }
.status-info    { border-left-color: var(--gf-gold-leaf); }

/* A single soft pulse on success — enough to notice, not to nag. */
.status-success { animation: gfStatusIn 300ms var(--gf-ease) both, gfSuccessGlow 1.1s var(--gf-ease) 300ms 1; }
@keyframes gfSuccessGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(92, 138, 99, 0); }
  40%      { box-shadow: 0 0 0 5px rgba(92, 138, 99, 0.12); }
}

/* ============================================================
   7. PROGRESS & LOADING — gold shimmer instead of a flat bar
   ============================================================ */

.bfill > i, .progress-bar-fill, .otp-progress-bar-fill {
  background-image: linear-gradient(90deg,
    var(--primary-2) 0%, var(--gf-gold-leaf-2) 50%, var(--primary-2) 100%);
  background-size: 220% 100%;
  animation: gfShimmer 2.4s linear infinite;
}
@keyframes gfShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -60% 0; }
}

/* ============================================================
   8. TABLES — readable rows, gold header rule
   ============================================================ */

table th {
  font-family: var(--font-b);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gf-gold-ink);
  border-bottom: 1.5px solid var(--gf-gold-line);
}
table tbody tr { transition: background-color 160ms var(--gf-ease); }
table tbody tr:hover { background-color: var(--gf-gold-wash); }

/* Wide tables scroll inside their own box rather than the page. */
.table-wrap, .package-history-results, #packageHistoryResults, #dsrRows {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ============================================================
   9. PILLS, BADGES & ICONS
   ============================================================ */

.rose, .pill {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 9.5px;
  font-weight: 600;
}

/* Icons pick up the readable gold so they stay legible as symbols. */
.hubc svg, .navlink svg, .app-topbar-back svg {
  stroke: var(--gf-gold-ink);
  transition: stroke 200ms var(--gf-ease), transform 200ms var(--gf-ease);
}
.hubc:hover svg { transform: scale(1.08); }

.hubc {
  border: 1px solid transparent;
}
.hubc:hover {
  border-color: var(--gf-gold-line);
  box-shadow: var(--gf-lift);
  transform: translateY(-2px);
}

/* ============================================================
   10. MOTION PREFERENCES
   Everything above is decoration; anyone who has asked their
   device for less movement gets none of it.
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .btn:hover:not(:disabled),
  .hubc:hover { transform: none; }
}

/* ============================================================
   11. HIGH CONTRAST / FORCED COLORS
   ============================================================ */

@media (forced-colors: active) {
  .btn::after { display: none; }
  a:focus-visible, button:focus-visible,
  input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid Highlight;
  }
}

/* ============================================================
   13. STAFF SIGN IN — client-chosen header + card treatment for
   this one screen only (login.html, step 'login'). Scoped by the
   .staff-login-header class renderStaffStep_ toggles on #appTopBar,
   and by #staffLoginSection for the card itself — nothing here can
   leak onto any other step or page.
   ============================================================ */

/* Centers the header+card as ONE block, both axes, on any device —
   phone, tablet, or a wide/tall desktop window. .shell itself already
   centers horizontally (margin:0 auto) but its children just flow from
   the top, which is what left the panel stranded in the top-left
   corner of a wide screen. .staff-login-header stops being sticky here
   (it has nothing to stay pinned above once it is part of the centered
   block) and both pieces get a shared max-width so the card reads as a
   normal auth panel instead of stretching edge to edge. */
.shell.shell-center-login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.shell.shell-center-login > .app-topbar.staff-login-header,
.shell.shell-center-login > #staffLoginSection {
  width: 100%;
  max-width: 420px;
  flex: 0 0 auto;
}
.shell.shell-center-login > .app-topbar.staff-login-header {
  position: static;
}

/* Unbox the usual pill nav bar into a plain page title. */
.app-topbar.staff-login-header {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 4px 2px 0;
  justify-content: flex-start;
}
.app-topbar.staff-login-header .app-topbar-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}
.app-topbar.staff-login-header #appTopBarSub {
  order: -1;
  display: block;
  font-family: var(--font-b);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gf-gold-ink);
  white-space: normal;
  margin-bottom: 2px;
}
.app-topbar.staff-login-header #appTopBarTitle {
  font-family: var(--font-h);
  font-weight: 600;
  font-size: 27px;
  letter-spacing: 0.008em;
  color: var(--text-strong);
  white-space: normal;
}
.app-topbar.staff-login-header .app-topbar-slot { display: none; }

/* Card: no separate "Staff Sign In" heading — the page title above
   already carries it — and no Clear Entries button, per reference. */
#staffLoginSection > h3 { display: none; }
#staffLoginSection .btn.btn-light { display: none; }

/* Sign in: gold outline instead of the filled rose used everywhere
   else, scoped to this one button only. */
#staffLoginSection .btn.btn-primary {
  background: transparent;
  border: 1.5px solid var(--gf-gold-leaf);
  color: var(--gf-gold-ink);
}
#staffLoginSection .btn.btn-primary:hover:not(:disabled) {
  background: var(--gf-gold-wash);
}

/* ============================================================
   12. "OR" DIVIDER — shared here so dashboard.html can use the
   exact same pattern login.html already had, without duplicating
   the rule in each page's own <style> block.
   ============================================================ */
.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 14px;
}
.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
