/* ─── Global Header ──────────────────────────────────────────────────────── */

/* ─── Dealer white-label CSS custom properties (injected by branding.js) ─── */
/* Fallbacks preserve the original design when no branding is active.          */
:root {
  --brand-primary:       #d4411e;
  --brand-secondary:     #e0e0e0;
  --brand-bg:            #f5f5f5;
  --brand-header-bg:     #111827;
  --brand-text:          #222;
  --nav-link-color:      #fff;
  --nav-link-border:     rgba(255,255,255,.5);
  --nav-link-hover-bg:   rgba(255,255,255,.18);
}

/* ─── Cross-document view transitions (Chrome 126+, Safari 18.2+) ────────── */
/* Both pages must include this stylesheet to opt in.                          */
@view-transition {
  navigation: auto;
}

/* Root content: 200 ms cross-fade — smooth fade including header & shadow.   */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.2s;
  animation-timing-function: ease;
}

/* ─── Page-transition fade (JS fallback for Firefox / no-VT browsers) ───── */
/* JS sets html opacity to 0 instantly on load, then transitions to 1.        */
/* The html element itself needs no special rule — JS drives it.               */

/* ─── Base header ────────────────────────────────────────────────────────── */
.site-header {
  background: var(--brand-header-bg);
  color: #fff;
  height: 64px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: hidden;
  box-shadow: 0 2px 20px rgba(0,0,0,.28), 0 1px 0 rgba(255,255,255,.04);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── Brand link ─────────────────────────────────────────────────────────── */
.header-brand-link {
  color: #fff;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -.5px;
  flex-shrink: 0;
  opacity: .97;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
.header-brand-link:hover { opacity: 1; }

/* ─── Actions container ──────────────────────────────────────────────────── */
.header-actions { display: flex; align-items: center; }

/* ─── Nav link — pill button (order-page style) ──────────────────────────── */
.header-nav-link {
  color: var(--nav-link-color, #fff);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 600;
  padding: 7px 18px;
  border: 2px solid var(--nav-link-border, rgba(255,255,255,.5));
  border-radius: 100px;
  transition: background .18s cubic-bezier(.4,0,.2,1), border-color .18s cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
  letter-spacing: .1px;
  display: inline-block;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
.header-nav-link:hover { background: var(--nav-link-hover-bg, rgba(255,255,255,.18)); border-color: var(--nav-link-color, #fff); }

/* ─── gh-wrap: animated wrapper for per-page elements ───────────────────── */
/* Uses the CSS grid 0fr→1fr trick so width animates from 0 to content size. */
.gh-wrap {
  display: grid;
  grid-template-columns: 0fr;
  opacity: 0;
  margin-left: 0;
  flex-shrink: 0;
  pointer-events: none;
  transition:
    grid-template-columns .38s cubic-bezier(.4,0,.2,1),
    opacity              .28s cubic-bezier(.4,0,.2,1),
    margin-left          .38s cubic-bezier(.4,0,.2,1);
}
.gh-wrap > * {
  overflow: hidden;
  min-width: 0;
}
.gh-wrap.gh-visible {
  grid-template-columns: 1fr;
  opacity: 1;
  margin-left: 10px;
  pointer-events: auto;
}
.gh-wrap.gh-visible > * { overflow: visible; }

/* ─── Cart toggle button ─────────────────────────────────────────────────── */
.cart-toggle-btn {
  position: relative;
  background: rgba(255,255,255,.18);
  border: 2px solid rgba(255,255,255,.5);
  border-radius: 100px;
  color: #fff;
  cursor: pointer;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .18s, border-color .18s;
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
}
.cart-toggle-btn:hover { background: rgba(255,255,255,.28); border-color: #fff; }

/* ─── Cart badge ─────────────────────────────────────────────────────────── */
.cart-badge {
  position: absolute;
  top: -7px; right: -7px;
  background: #ef4444;
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  min-width: 20px; height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  pointer-events: none;
  border: 2px solid var(--primary, #111827);
}

/* ─── Language switcher ──────────────────────────────────────────────────── */
.lang-switcher { display: flex; gap: 6px; }
.lang-btn {
  background: transparent;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  transition: border-color .2s, opacity .2s;
  opacity: .6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lang-btn img { display: block; border-radius: 3px; }
.lang-btn.active { border-color: rgba(255,255,255,.8); opacity: 1; }
.lang-btn:hover { opacity: 1; }

/* ─── Mobile header sizing ───────────────────────────────────────────────── */
@media (max-width: 540px) {
  .gh-wrap.gh-visible { margin-left: 4px; }
  .header-nav-link { padding: 5px 10px; font-size: .82rem; }
}

/* ─── Login / signup page layout (body flex-column when header is present) ─ */
body.login-page {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}
.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}
