/* ==========================================================================
   BRIGAWAN UNIVERSAL HEADER SYSTEM v1.0
   Scoped strictly to .briga-header* classes (no bare `header` tag leakage).
   Supports Light Mode, Dark Mode (.dark), Always-Dark (.briga-header--dark),
   Fixed/Sticky Public Headers, Portal Topbars, and Minimal Print-Hidden Bars.
   ========================================================================== */

.briga-header {
  --bh-height: 64px;
  --bh-bg: rgba(250, 251, 249, 0.86);
  --bh-bg-scrolled: rgba(255, 255, 255, 0.96);
  --bh-border: rgba(13, 59, 19, 0.08);
  --bh-border-scrolled: rgba(13, 59, 19, 0.14);
  --bh-shadow-scrolled: 0 4px 24px -4px rgba(13, 59, 19, 0.08), 0 1px 3px rgba(13, 59, 19, 0.04);
  --bh-text: #0D3B13;
  --bh-text-nav: #334155;
  --bh-text-nav-hover: #0D3B13;
  --bh-text-sub: #047857;
  --bh-nav-hover-bg: rgba(6, 78, 59, 0.06);
  --bh-nav-active-bg: rgba(4, 120, 87, 0.09);
  --bh-nav-active-text: #065F46;
  --bh-nav-active-border: rgba(4, 120, 87, 0.18);
  --bh-nav-active-bar: #047857;
  --bh-util-bg: rgba(255, 255, 255, 0.88);
  --bh-util-border: rgba(13, 59, 19, 0.13);
  --bh-util-text: #1A2E1C;
  --bh-util-hover-bg: #FFFFFF;
  --bh-util-hover-border: rgba(4, 120, 87, 0.36);
  --bh-divider: rgba(13, 59, 19, 0.12);
  --bh-dropdown-bg: rgba(255, 255, 255, 0.98);
  --bh-dropdown-shadow: 0 18px 42px -8px rgba(13, 59, 19, 0.16), 0 4px 12px rgba(0, 0, 0, 0.05);
  --bh-mark-bg: rgba(4, 120, 87, 0.08);
  --bh-mark-border: rgba(4, 120, 87, 0.18);
  --bh-pill-bg: rgba(4, 120, 87, 0.08);
  --bh-pill-border: rgba(4, 120, 87, 0.20);
  --bh-pill-text: #065F46;

  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 950;
  background: var(--bh-bg);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--bh-border);
  transition: background-color 220ms cubic-bezier(0.4, 0, 0.2, 1),
              border-color 220ms cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .briga-header,
.briga-header.briga-header--dark {
  --bh-bg: rgba(5, 10, 7, 0.82);
  --bh-bg-scrolled: rgba(5, 10, 7, 0.95);
  --bh-border: rgba(52, 211, 153, 0.12);
  --bh-border-scrolled: rgba(52, 211, 153, 0.22);
  --bh-shadow-scrolled: 0 12px 32px -4px rgba(0, 0, 0, 0.62);
  --bh-text: #ECFDF5;
  --bh-text-nav: rgba(226, 232, 240, 0.80);
  --bh-text-nav-hover: #FFFFFF;
  --bh-text-sub: #D4A853;
  --bh-nav-hover-bg: rgba(255, 255, 255, 0.06);
  --bh-nav-active-bg: rgba(16, 185, 129, 0.14);
  --bh-nav-active-text: #ECFDF5;
  --bh-nav-active-border: rgba(52, 211, 153, 0.28);
  --bh-nav-active-bar: #34D399;
  --bh-util-bg: rgba(255, 255, 255, 0.05);
  --bh-util-border: rgba(52, 211, 153, 0.22);
  --bh-util-text: #E2E8F0;
  --bh-util-hover-bg: rgba(255, 255, 255, 0.10);
  --bh-util-hover-border: rgba(212, 168, 83, 0.48);
  --bh-divider: rgba(255, 255, 255, 0.14);
  --bh-dropdown-bg: rgba(8, 16, 11, 0.99);
  --bh-dropdown-shadow: 0 22px 48px -8px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(52, 211, 153, 0.16);
  --bh-mark-bg: rgba(16, 185, 129, 0.12);
  --bh-mark-border: rgba(52, 211, 153, 0.26);
  --bh-pill-bg: rgba(16, 185, 129, 0.12);
  --bh-pill-border: rgba(52, 211, 153, 0.26);
  --bh-pill-text: #6EE7B7;
}

.briga-header--fixed {
  position: fixed;
}

.briga-header--portal {
  z-index: 30;
}

.briga-header--portal-mobile {
  position: fixed;
  z-index: 90;
}

.briga-header.is-scrolled {
  background: var(--bh-bg-scrolled);
  border-bottom-color: var(--bh-border-scrolled);
  box-shadow: var(--bh-shadow-scrolled);
}

@media (min-width: 1024px) {
  .briga-header {
    --bh-height: 72px;
  }
  .briga-header--portal,
  .briga-header--compact {
    --bh-height: 64px;
  }
}

.briga-header-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1rem;
  height: var(--bh-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.briga-header--portal .briga-header-inner,
.briga-header--portal-mobile .briga-header-inner {
  max-width: none;
  padding: 0 1.25rem;
}

@media (min-width: 640px) {
  .briga-header-inner {
    padding: 0 1.5rem;
    gap: 1rem;
  }
  .briga-header--portal .briga-header-inner {
    padding: 0 2rem;
  }
}

@media (min-width: 1024px) {
  .briga-header-inner {
    padding: 0 2rem;
  }
}

/* --- BRAND LOCKUP (LEFT ZONE) --- */
.briga-brand-cluster {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex-shrink: 0;
}

.briga-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0.15rem 0;
  flex-shrink: 0;
  transition: opacity 180ms ease;
}

.briga-brand:hover {
  opacity: 0.92;
}

.briga-brand-mark-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bh-mark-bg);
  border: 1px solid var(--bh-mark-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  flex-shrink: 0;
  transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1),
              border-color 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.briga-brand:hover .briga-brand-mark-wrap {
  transform: translateY(-1px);
  border-color: var(--bh-nav-active-bar);
}

.briga-brand-mark {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.briga-brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
  text-align: left;
}

.briga-brand-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--bh-text);
  line-height: 1.1;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .briga-brand-title {
    font-size: 1.15rem;
  }
}

.briga-brand-sub {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bh-text-sub);
  margin-top: 2px;
  white-space: nowrap;
}

@media (max-width: 379px) {
  .briga-brand-sub {
    display: none;
  }
}

.briga-brand-divider {
  width: 1px;
  height: 20px;
  background: var(--bh-divider);
  flex-shrink: 0;
}

.briga-context-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--bh-pill-bg);
  border: 1px solid var(--bh-pill-border);
  color: var(--bh-pill-text);
  white-space: nowrap;
}

/* --- CENTER NAVIGATION (DESKTOP >= 1024px) --- */
.briga-nav {
  display: none;
}

@media (min-width: 1024px) {
  .briga-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin: 0 auto;
  }
}

.briga-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.8rem;
  border-radius: 0.625rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--bh-text-nav);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.briga-nav-link:hover {
  color: var(--bh-text-nav-hover);
  background: var(--bh-nav-hover-bg);
}

.briga-nav-link.is-active,
.briga-nav-link.tab-active {
  color: var(--bh-nav-active-text);
  background: var(--bh-nav-active-bg);
  border-color: var(--bh-nav-active-border);
  border-bottom-width: 1px;
  font-weight: 600;
}

.briga-nav-link.is-active::after,
.briga-nav-link.tab-active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 24%;
  right: 24%;
  height: 2px;
  border-radius: 9999px;
  background: var(--bh-nav-active-bar);
}

/* --- RIGHT ACTIONS CLUSTER --- */
.briga-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.briga-divider {
  display: none;
  width: 1px;
  height: 20px;
  background: var(--bh-divider);
  margin: 0 0.2rem;
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .briga-divider {
    display: block;
  }
}

/* --- UTILITY CONTROLS (LANG PICKER & THEME TOGGLE) --- */
.briga-lang-wrap {
  position: relative;
}

.briga-util-btn,
.briga-lang-btn {
  height: 36px;
  border-radius: 9999px;
  background: var(--bh-util-bg);
  border: 1px solid var(--bh-util-border);
  color: var(--bh-util-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.briga-util-btn {
  width: 36px;
  padding: 0;
}

.briga-lang-btn {
  padding: 0 0.65rem;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.briga-util-btn:hover,
.briga-lang-btn:hover {
  background: var(--bh-util-hover-bg);
  border-color: var(--bh-util-hover-border);
  color: var(--bh-text);
}

.briga-theme-toggle .briga-icon-sun {
  display: none;
}
.briga-theme-toggle .briga-icon-moon {
  display: block;
}
.dark .briga-theme-toggle .briga-icon-sun {
  display: block;
  color: #F0C75E;
}
.dark .briga-theme-toggle .briga-icon-moon {
  display: none;
}

/* --- LANGUAGE DROPDOWN --- */
.briga-lang-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 180px;
  padding: 0.375rem;
  border-radius: 0.875rem;
  background: var(--bh-dropdown-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--bh-border-scrolled);
  box-shadow: var(--bh-dropdown-shadow);
  z-index: 10020;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.briga-lang-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.briga-lang-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--bh-text-nav);
  border-radius: 0.55rem;
  cursor: pointer;
  text-align: left;
  transition: background-color 150ms ease, color 150ms ease;
}

.briga-lang-option:hover {
  background: var(--bh-nav-hover-bg);
  color: var(--bh-text-nav-hover);
}

.briga-lang-option.selected {
  background: var(--bh-nav-active-bg);
  color: var(--bh-nav-active-text);
  font-weight: 600;
}

.briga-lang-option .flag {
  font-size: 1rem;
  line-height: 1;
}

/* --- AUTH ACTION BUTTONS (WCAG AA+ CONTRAST IN BOTH MODES) --- */
.briga-auth-desktop {
  display: none;
}

@media (min-width: 1024px) {
  .briga-auth-desktop {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }
}

.briga-auth-group {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.briga-btn-login {
  height: 36px;
  padding: 0 1rem;
  border-radius: 9999px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  background: #064E3B;
  color: #FFFFFF;
  border: 1px solid transparent;
  box-shadow: 0 2px 10px rgba(6, 78, 59, 0.18);
  transition: background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.briga-btn-login:hover {
  background: #047857;
  box-shadow: 0 4px 14px rgba(4, 120, 87, 0.26);
  transform: translateY(-1px);
}

.dark .briga-btn-login,
.briga-header--dark .briga-btn-login {
  background: #047857;
  color: #FFFFFF;
  border-color: rgba(52, 211, 153, 0.38);
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.22);
}

.dark .briga-btn-login:hover,
.briga-header--dark .briga-btn-login:hover {
  background: #065F46;
  border-color: rgba(52, 211, 153, 0.58);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.32);
}

.briga-btn-dashboard {
  height: 36px;
  padding: 0 0.9rem;
  border-radius: 9999px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  background: rgba(4, 120, 87, 0.08);
  color: #064E3B;
  border: 1px solid rgba(4, 120, 87, 0.24);
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.briga-btn-dashboard:hover {
  background: rgba(4, 120, 87, 0.14);
  border-color: rgba(4, 120, 87, 0.42);
  box-shadow: 0 4px 12px rgba(4, 120, 87, 0.12);
}

.dark .briga-btn-dashboard,
.briga-header--dark .briga-btn-dashboard {
  background: rgba(16, 185, 129, 0.14);
  color: #D1FAE5;
  border-color: rgba(52, 211, 153, 0.30);
}

.dark .briga-btn-dashboard:hover,
.briga-header--dark .briga-btn-dashboard:hover {
  background: rgba(16, 185, 129, 0.24);
  border-color: rgba(52, 211, 153, 0.52);
  color: #FFFFFF;
}

.briga-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  background: #10B981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
  flex-shrink: 0;
}

.briga-btn-logout {
  height: 36px;
  padding: 0 0.85rem;
  border-radius: 9999px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  white-space: nowrap;
  background: #FFF1F2;
  color: #BE123C;
  border: 1px solid #FECDD3;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.briga-btn-logout:hover {
  background: #FFE4E6;
  color: #9F1239;
  border-color: #FDA4AF;
}

.dark .briga-btn-logout,
.briga-header--dark .briga-btn-logout {
  background: rgba(244, 63, 94, 0.14);
  color: #FDA4AF;
  border-color: rgba(251, 113, 133, 0.30);
}

.dark .briga-btn-logout:hover,
.briga-header--dark .briga-btn-logout:hover {
  background: rgba(244, 63, 94, 0.24);
  color: #FFE4E6;
  border-color: rgba(251, 113, 133, 0.52);
}

.briga-btn-ghost {
  height: 36px;
  padding: 0 0.85rem;
  border-radius: 9999px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  background: var(--bh-util-bg);
  color: var(--bh-util-text);
  border: 1px solid var(--bh-util-border);
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.briga-btn-ghost:hover {
  background: var(--bh-util-hover-bg);
  border-color: var(--bh-util-hover-border);
  color: var(--bh-text);
}

.briga-btn-gold {
  height: 36px;
  padding: 0 0.9rem;
  border-radius: 9999px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  white-space: nowrap;
  background: linear-gradient(135deg, #D4A853 0%, #E9C46A 100%);
  color: #071610;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 10px rgba(212, 168, 83, 0.22);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.briga-btn-gold:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 4px 14px rgba(212, 168, 83, 0.34);
}

/* --- MOBILE TOGGLE & DRAWER (< 1024px) --- */
.briga-mobile-toggle {
  display: inline-flex;
}

@media (min-width: 1024px) {
  .briga-mobile-toggle {
    display: none;
  }
}

.briga-mobile-drawer {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bh-dropdown-bg);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border-bottom: 1px solid var(--bh-border-scrolled);
  box-shadow: var(--bh-dropdown-shadow);
  padding: 0.75rem 1rem 1.25rem;
  z-index: 940;
  max-height: calc(100vh - var(--bh-height));
  overflow-y: auto;
}

.briga-mobile-drawer.hidden {
  display: none;
}

@media (min-width: 1024px) {
  .briga-mobile-drawer {
    display: none !important;
  }
}

.briga-mobile-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 80rem;
  margin: 0 auto;
}

.briga-mobile-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.72rem 0.9rem;
  border-radius: 0.75rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--bh-text-nav);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.briga-mobile-link:hover {
  background: var(--bh-nav-hover-bg);
  color: var(--bh-text-nav-hover);
}

.briga-mobile-link.is-active {
  background: var(--bh-nav-active-bg);
  color: var(--bh-nav-active-text);
  border-color: var(--bh-nav-active-border);
  font-weight: 600;
}

.briga-mobile-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.briga-mobile-auth {
  margin: 0.75rem auto 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--bh-divider);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 80rem;
}

.briga-mobile-auth .briga-btn-login,
.briga-mobile-auth .briga-btn-dashboard,
.briga-mobile-auth .briga-btn-logout {
  width: 100%;
  height: 42px;
  font-size: 0.85rem;
}

/* --- RESPONSIVE VISIBILITY UTILITIES --- */
.briga-brand-divider.hidden { display: none; }
.briga-only-sm-up { display: none; }
.briga-only-md-up { display: none; }
.briga-only-lg-up { display: none; }

@media (min-width: 640px) {
  .briga-only-sm-up { display: inline-flex; }
}

@media (min-width: 768px) {
  .briga-only-md-up { display: inline-flex; }
  .briga-hide-md { display: none !important; }
}

@media (min-width: 1024px) {
  .briga-only-lg-up { display: inline-flex; }
  .briga-hide-lg { display: none !important; }
}

/* --- FOCUS & ACCESSIBILITY --- */
.briga-header :focus-visible {
  outline: 2px solid #D4A853;
  outline-offset: 2px;
}

@media print {
  .briga-header--print-hidden {
    display: none !important;
  }
}
