/**
 * App front header: sticky bar + utilities (locale, account).
 * Brand navy: #0b163f (aligns with brand-buttons.css).
 */
:root {
  --header-brand: #0b163f;
  --header-brand-hover: #08122e;
  --header-surface: #ffffff;
  --header-border: rgba(11, 22, 63, 0.12);
  --header-muted: #64748b;
  --header-radius: 12px;
  --header-radius-pill: 999px;
  --header-shadow: 0 10px 40px rgba(11, 22, 63, 0.12);
}

.main-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background-color: var(--header-surface);
  box-shadow:
    0 1px 0 rgba(15, 23, 42, 0.06),
    0 6px 18px rgba(15, 23, 42, 0.06);
}

.main-header .navbar {
  background-color: var(--header-surface);
}

/* Allow account panel to paint outside the flex row (avoid clipping). */
.main-header .navbar > .container,
.main-header .navbar .container {
  overflow: visible;
}

/*
 * Public site: no bootstrap.bundle.js — no data-bs-toggle dropdown.
 * Desktop (navbar-expand-xl): submenu on hover / focus-within.
 * Absolute .dropdown-menu does not extend <li> hit box — padding-bottom + negative margin
 * keeps a hover “bridge” so moving from the link to the panel does not drop :hover.
 */
@media (min-width: 1200px) {
  .main-header .navbar-collapse .main-menu > li.nav-item.dropdown {
    position: relative;
    padding-bottom: 14px;
    margin-bottom: -14px;
  }

  .main-header .navbar-collapse .main-menu > li.nav-item.dropdown > .dropdown-menu {
    display: block !important;
    position: absolute;
    top: 100%;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    z-index: 1025;
    margin-top: -6px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.18s ease,
      visibility 0.18s ease;
  }

  .main-header .navbar-collapse .main-menu > li.nav-item.dropdown:hover > .dropdown-menu,
  .main-header .navbar-collapse .main-menu > li.nav-item.dropdown:focus-within > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

.main-header .main-menu li.nav-item.dropdown > a.nav-link.dropdown-toggle {
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: Poppins, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #334155;
  text-decoration: none;
}

.main-header .main-menu li.nav-item.dropdown > a.nav-link.dropdown-toggle:hover,
.main-header .main-menu li.nav-item.dropdown > a.nav-link.dropdown-toggle:focus-visible {
  color: #175cff;
}

.main-header .main-menu li.nav-item.dropdown > a.nav-link.dropdown-toggle.active {
  color: #175cff;
}

/* ——— Flags + auth row ——— */
.header-utilities,
.lang-flag-wrapper.header-utilities {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: nowrap;
}

.header-utilities__flags {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding-inline-end: 0.35rem;
  border-inline-end: 1px solid var(--header-border);
}

.header-flag-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 2px;
  transition: opacity 0.15s, background 0.15s;
}

.header-flag-link:hover {
  background: rgba(11, 22, 63, 0.06);
}

.header-utilities__shop {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding-inline-end: 0.55rem;
  margin-inline-end: 0.1rem;
  border-inline-end: 1px solid var(--header-border);
}

.header-shop-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  border: 1px solid var(--header-border);
  color: var(--header-brand);
  background: #fff;
  text-decoration: none !important;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.12s ease;
}

.header-shop-link:hover {
  background: rgba(11, 22, 63, 0.06);
  border-color: rgba(11, 22, 63, 0.22);
  color: var(--header-brand-hover);
}

.header-shop-link:active {
  transform: scale(0.96);
}

.header-shop-link__icon {
  display: grid;
  place-items: center;
}

.header-shop-link__badge {
  position: absolute;
  top: -0.32rem;
  inset-inline-end: -0.32rem;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #f8805f, #e06542);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1.125rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(224, 101, 66, 0.4);
}

.header-utilities__auth {
  display: flex;
  align-items: center;
}

/* ——— Guest login ——— */
.header-login-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.35rem 1.1rem;
  border-radius: var(--header-radius-pill);
  background: var(--header-brand);
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 8px rgba(11, 22, 63, 0.2);
  transition: background 0.15s, box-shadow 0.15s, transform 0.12s;
}

.header-login-pill:hover {
  background: var(--header-brand-hover);
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(11, 22, 63, 0.25);
}

.header-login-pill:active {
  transform: scale(0.98);
}

.header-login-pill--block {
  width: 100%;
}

.header-login-pill__label {
  line-height: 1.2;
}

/* ——— Logged-in: native <details> panel (no Bootstrap Dropdown JS) ——— */
.header-account-details {
  position: relative;
  z-index: 1;
}

.header-account-details[open] {
  z-index: 1060;
}

.header-account-details > summary {
  list-style: none;
}

.header-account-details > summary::-webkit-details-marker {
  display: none;
}

.header-account-details > summary::marker {
  content: "";
}

.header-account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: min(220px, 28vw);
  min-height: 42px;
  padding: 0.25rem 0.6rem 0.25rem 0.35rem;
  margin: 0;
  border: 1px solid var(--header-border);
  border-radius: var(--header-radius-pill);
  background: var(--header-surface);
  color: var(--header-brand);
  cursor: pointer;
  font: inherit;
  text-align: start;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    background 0.15s;
}

.header-account-trigger:hover {
  border-color: rgba(11, 22, 63, 0.28);
  box-shadow: 0 2px 12px rgba(11, 22, 63, 0.08);
  background: #f8fafc;
}

.header-account-trigger:focus-visible {
  outline: 2px solid var(--header-brand);
  outline-offset: 2px;
}

.header-account-details[open] > .header-account-trigger {
  border-color: rgba(11, 22, 63, 0.35);
  box-shadow: 0 2px 14px rgba(11, 22, 63, 0.1);
  background: #f8fafc;
}

.header-account-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(11, 22, 63, 0.08);
}

.header-account-avatar--placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #0b163f 0%, #1e3a8a 100%);
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.header-account-trigger__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.15;
}

[dir="rtl"] .header-account-trigger__text {
  align-items: flex-end;
  text-align: end;
}

.header-account-trigger__kicker {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--header-muted);
}

.header-account-trigger__name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--header-brand);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-account-trigger__chevron {
  flex-shrink: 0;
  margin-inline-start: 0.1rem;
  color: var(--header-muted);
  transition: transform 0.2s ease;
}

.header-account-details[open] .header-account-trigger__chevron {
  transform: rotate(180deg);
}

[dir="rtl"] .header-account-trigger__chevron {
  transform: scaleX(-1);
}

[dir="rtl"] .header-account-details[open] .header-account-trigger__chevron {
  transform: scaleX(-1) rotate(180deg);
}

/* ——— Account panel ——— */
.header-account-details .header-account-menu {
  position: absolute;
  z-index: 1061;
  inset-inline-end: 0;
  top: calc(100% + 0.45rem);
  display: flex;
  flex-direction: column;
  min-width: 260px;
  max-width: min(320px, 92vw);
  margin: 0;
  padding: 0;
  background: var(--header-surface);
  border: 1px solid var(--header-border);
  border-radius: var(--header-radius);
  box-shadow: var(--header-shadow);
  overflow: hidden;
  text-align: start;
}

.header-account-menu__head {
  padding: 0.85rem 1rem 0.75rem;
  background: linear-gradient(180deg, #f4f6fb 0%, #fff 100%);
  border-bottom: 1px solid var(--header-border);
}

.header-account-menu__name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--header-brand);
  line-height: 1.3;
  word-break: break-word;
}

.header-account-menu__email {
  font-size: 0.75rem;
  color: var(--header-muted);
  margin-top: 0.2rem;
  word-break: break-all;
}

.header-account-menu__link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e293b;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.header-account-menu__link:hover,
.header-account-menu__link:focus {
  background: rgba(11, 22, 63, 0.06);
  color: var(--header-brand);
}

.header-account-menu__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  color: var(--header-muted);
}

.header-account-menu__link:hover .header-account-menu__icon,
.header-account-menu__link:focus .header-account-menu__icon {
  color: var(--header-brand);
}

.header-account-menu__foot {
  padding: 0.5rem 0.65rem 0.65rem;
  background: #fafbfc;
}

.header-account-logout {
  display: block;
  width: 90%;
  padding: 0.5rem 0.75rem;
  margin: 0;
  border: 1px solid rgba(220, 53, 69, 0.35);
  border-radius: 10px;
  background: #fff;
  color: #c82333 !important;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.header-account-logout:hover {
  background: rgba(220, 53, 69, 0.08);
  border-color: rgba(220, 53, 69, 0.55);
}

/* ——— Offcanvas account card ——— */
.header-offcanvas-account {
  width: 100%;
  border: 1px solid var(--header-border);
  border-radius: var(--header-radius);
  background: linear-gradient(180deg, #f8fafc 0%, #fff 55%);
  box-shadow: 0 4px 18px rgba(11, 22, 63, 0.06);
  overflow: hidden;
}

.header-offcanvas-account__user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid var(--header-border);
}

.header-offcanvas-account__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(11, 22, 63, 0.1);
  flex-shrink: 0;
}

.header-offcanvas-account__avatar--ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(135deg, #0b163f 0%, #1e3a8a 100%);
}

.header-offcanvas-account__meta {
  min-width: 0;
}

.header-offcanvas-account__name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--header-brand);
  line-height: 1.25;
  word-break: break-word;
}

.header-offcanvas-account__email {
  font-size: 0.75rem;
  color: var(--header-muted);
  margin-top: 0.15rem;
  word-break: break-all;
}

.header-offcanvas-account__nav {
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0;
}

.header-offcanvas-account__link {
  display: block;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #1e293b;
  text-decoration: none;
  border-bottom: 1px solid rgba(11, 22, 63, 0.06);
  transition: background 0.12s, color 0.12s, padding-inline-start 0.12s;
}

.header-offcanvas-account__link:last-of-type {
  border-bottom: none;
}

.header-offcanvas-account__link:hover {
  background: rgba(11, 22, 63, 0.05);
  color: var(--header-brand);
}

[dir="ltr"] .header-offcanvas-account__link:hover {
  padding-inline-start: 1.15rem;
}

[dir="rtl"] .header-offcanvas-account__link:hover {
  padding-inline-end: 1.15rem;
}

.header-offcanvas-account__logout-form {
  padding: 0.65rem 1rem 1rem;
  margin: 0;
}

.header-offcanvas-account__logout {
  width: 100%;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(220, 53, 69, 0.35);
  background: #fff;
  color: #c82333;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
}

.header-offcanvas-account__logout:hover {
  background: rgba(220, 53, 69, 0.07);
}

