/*
  New site header styles - ported from SiteHeader.vue
  (wsd-data-frontend/src/components/common/SiteHeader.vue), itself sourced
  from "SPI new navigation"/assets/css/header.css. Class names match that
  source 1:1 so future changes there are easy to re-port.
*/

:root {
  --bg: #f5f6f8; --surface: #ffffff; --border: #e3e6eb; --text: #161b26; --text-muted: #68707e;
  --accent-ma: #2258c7;
  --accent-mp: #0c8f86;
  --accent-pf: #7346d1;
  --accent-rfq: #d3650f;
  --accent-edu: #1a8a5a;
  --accent-rn: #5b6472;
  --pill-bg: #eef1f5;
}
[data-theme='dark'] {
  --bg: #0a0e16; --surface: #121826; --border: #232b3b; --text: #e8ebf1; --text-muted: #8b95a8;
  --accent-ma: #5b93ef; --accent-mp: #2bb3a8; --accent-pf: #9b7ae8; --accent-rfq: #f0904f; --accent-edu: #3fc281; --accent-rn: #8b95a8;
  --pill-bg: #1a2230;
}

.a-header {
  position: sticky;
  top: 0;
  z-index: 999999;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, Helvetica, Arial, sans-serif;
}

.a-logo { display: flex; align-items: center; flex-shrink: 0; }
.a-logo__img { height: 26px; width: auto; display: block; }

.a-nav {
  flex: 1;
  display: flex;
  align-items: center;
  height: 100%;
  /* main.min.css has a bare `nav{...}` rule (Materialize default, dark navy
     brand background) that otherwise wins here since we never set our own
     background/color - a class selector beats it on specificity once we do. */
  background: transparent;
  color: inherit;
  margin: 0;
  box-shadow: none;
  position: static;
  font-family: inherit;
}

.nav-item { position: relative; height: 100%; display: flex; align-items: center; }

.nav-item > a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color .12s ease;
}
.nav-item > a svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item > a .caret { width: 10px; height: 10px; opacity: .6; margin-left: 2px; }
.nav-item > a:hover, .nav-item > a:focus-visible { color: var(--text); }

.nav-item > a::after {
  content: '';
  position: absolute;
  left: 11px; right: 11px; bottom: 6px;
  height: 2px;
  border-radius: 1px;
  background: transparent;
  transition: background-color .12s ease;
}
.nav-item.active > a { color: var(--text); }
.nav-item.active > a::after { background: var(--nav-accent); }

.nav-drop {
  position: absolute;
  top: 100%; left: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 28px -8px rgba(0, 0, 0, .18);
  padding: 6px;
  margin-top: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
  z-index: 110;
}
.nav-item:hover .nav-drop, .nav-item:focus-within .nav-drop {
  opacity: 1; visibility: visible; transform: translateY(0);
}

.drop-link {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.drop-link:hover, .drop-link:focus-visible { background: var(--pill-bg); color: var(--text); }
.drop-link:visited { color: var(--text); }

.nav-drop-empty { padding: 8px 10px; font-size: 12.5px; color: var(--text-muted); font-style: italic; }

.a-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Real global-search widget mount point (span#global-search-app), styled
   to sit in the same visual slot the reference's decorative search box
   occupied - see header-v2.handlebars for why this isn't just ported as-is. */
.a-search-mount { display: flex; align-items: center; }

/* The global-search trigger button (from the globalSearch vue3 project) uses
   class "menu-link", styled by main.min.css's Materialize rule for the OLD
   header's dark navy bar: `.menu-link{color:#fff;margin-right:28px;...}`.
   White-on-white against this header's light background made it invisible -
   override color/spacing here rather than in that project (it's shared
   across both header versions). */
.a-search-mount .menu-link {
  color: var(--text-muted) !important;
  margin-right: 0 !important;
  display: flex;
  align-items: center;
}
.a-search-mount .menu-link:hover,
.a-search-mount .menu-link:focus-visible {
  color: var(--text) !important;
}
.a-search-mount .menu-link:visited {
  color: var(--text-muted) !important;
}

.iq-btn {
  display: flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: none; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-pf), var(--accent-ma));
  color: #fff;
  font-size: 12.5px; font-weight: 700;
  cursor: pointer;
}
.iq-btn svg { width: 14px; height: 14px; }
.iq-btn:hover { filter: brightness(1.08); }

.avatar-wrap { position: relative; }

.a-avatar {
  display: flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 8px 0 4px;
  border: none; border-radius: 8px;
  background: transparent;
  cursor: pointer;
  color: var(--text);
}
.a-avatar:hover, .a-avatar:focus-visible { background: var(--pill-bg); }
.a-avatar .circ {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--nav-accent, var(--accent-ma));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700;
  flex-shrink: 0;
}
.a-avatar span { font-size: 12.5px; font-weight: 600; }
.a-avatar svg { width: 12px; height: 12px; transition: transform .12s ease; }
.a-avatar.open svg { transform: rotate(180deg); }

.avatar-drop {
  position: absolute;
  top: 100%; right: 0;
  margin-top: 6px;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 28px -8px rgba(0, 0, 0, .18);
  padding: 14px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
  z-index: 110;
}
.avatar-drop.open { opacity: 1; visibility: visible; transform: translateY(0); }

.avatar-drop-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.circ-lg {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--nav-accent, var(--accent-ma));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.ad-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.ad-email { font-size: 12px; color: var(--text-muted); }

.ad-profile-btn {
  display: block;
  width: 100%;
  height: 34px;
  line-height: 34px;
  text-align: center;
  border: none; border-radius: 8px;
  background: var(--text);
  color: var(--surface);
  font-size: 12.5px; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}
/* main.min.css has several bare a:hover{color:...} rules (e.g.
   a:hover{color:#002555}) - a plain a:hover selector outranks our unqualified
   .ad-profile-btn base rule on specificity (pseudo-classes count), so without
   re-asserting color here explicitly, hover could swap in dark text on this
   already-dark-background button. */
.ad-profile-btn:hover {
  opacity: .9;
  color: var(--surface);
}
.ad-profile-btn:visited { color: var(--surface); }

.ad-divider { height: 1px; background: var(--border); margin: 10px 0; }

.ad-signout {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 0;
}
.ad-signout:hover { color: var(--text); }
