/**
 * File: header.css
 * Purpose: Styles the site-wide global header component, including navigation 
 * links, user avatar dropdown, and responsive layout adjustments.
 */
/* ════════════════════════════════════════════════════════════
   header.css — Site-wide header component
   Exact CSS extracted from AffairOva_Header_extracted_css.html
   Design tokens live in base.css.
   ════════════════════════════════════════════════════════════ */

/* ── HEADER SHELL ────────────────────────────────────────────── */
.ao-header {
  width: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,0.78) 0%, rgba(255,255,255,0.55) 100%);
  border-bottom: 1px solid rgba(255,255,255,0.6);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    inset 0 -1px 1px rgba(20,30,70,0.03),
    0 4px 16px rgba(20,30,70,0.05);
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  isolation: isolate;
}

.ao-header-inner {
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

@media (min-width: 1024px) {
  .ao-header-inner {
    height: 62px;
    padding: 0 40px;
  }
}

/* ── LOGO ────────────────────────────────────────────────────── */
.ao-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.ao-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.22);
}

.ao-logo-icon svg { width: 18px; height: 18px; }

.ao-logo-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1;
}

.ao-logo-text {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
  line-height: 1.15;
}

.ao-logo-text span { color: #2563eb; }

.ao-logo-tagline {
  font-size: 8.5px;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.15px;
  white-space: nowrap;
  margin-top: 1px;
}

@media (min-width: 1024px) {
  .ao-logo-text { font-size: 16px; }
  .ao-logo-tagline { font-size: 9px; }
}

/* ── RIGHT CLUSTER ───────────────────────────────────────────── */
.ao-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0; /* allow shrink so logo is never pushed off screen */
}

/* ── AVATAR ──────────────────────────────────────────────────── */
.ao-avatar-wrap {
  position: relative;
  cursor: pointer;
}
.ao-avatar:focus-visible {
  outline: 3px solid var(--blue, #2563eb);
  outline-offset: 2px;
}

.ao-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.2px;
  border: 2px solid #eef1f6;
  flex-shrink: 0;
  user-select: none;
  font-family: var(--font-main);
  transition: border-color 0.2s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) and (pointer: fine) {
  .ao-avatar-wrap:hover .ao-avatar {
    transform: scale(1.22);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.32);
    border-color: #2563eb;
  }
}

@keyframes aoPulse {
  0%   { box-shadow: 0 0 0 0px rgba(37, 99, 235, 0.55); }
  70%  { box-shadow: 0 0 0 5px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0px rgba(37, 99, 235, 0); }
}

.ao-status-ring {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1.5px solid #2563eb;
  pointer-events: none;
  animation: aoPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ── DROPDOWN ────────────────────────────────────────────────── */
.ao-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 210px;
  background: #ffffff;
  border: 1px solid #eef1f6;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(20,30,70,0.12);
  padding: 6px;
  z-index: 300;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.95);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 0.18s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.ao-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Staggered pop-in for each row once the panel is open */
.ao-dropdown.open > * {
  animation: ao-pop-in 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.ao-dropdown.open > *:nth-child(1) { animation-delay: 0.02s; }
.ao-dropdown.open > *:nth-child(2) { animation-delay: 0.05s; }
.ao-dropdown.open > *:nth-child(3) { animation-delay: 0.08s; }
.ao-dropdown.open > *:nth-child(4) { animation-delay: 0.11s; }
.ao-dropdown.open > *:nth-child(5) { animation-delay: 0.14s; }
.ao-dropdown.open > *:nth-child(6) { animation-delay: 0.17s; }

/* Desktop already shows Profile / Bookmarks / Support / Upgrade as
   standalone header links, so the avatar dropdown is mobile/tablet-only. */
@media (min-width: 769px) {
  .ao-dropdown { display: none; }
}

.ao-dropdown-user {
  padding: 10px 10px 8px;
  border-bottom: 1px solid #eef1f6;
  margin-bottom: 4px;
  overflow: hidden; /* prevent long names from widening the dropdown */
}

.ao-dropdown-name  {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ao-dropdown-email {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ao-dropdown-premium {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  margin-bottom: 4px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(245,158,11,0.88) 0%, rgba(217,119,6,0.88) 100%);
  border: 1px solid rgba(255,255,255,0.4);
  backdrop-filter: blur(6px) saturate(160%);
  -webkit-backdrop-filter: blur(6px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), inset 0 -1px 1px rgba(120,60,0,0.12);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: #ffffff;
  text-transform: uppercase;
  font-family: var(--font-main);
  position: relative;
  overflow: hidden;
}

.ao-dropdown-premium::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  pointer-events: none;
  background: linear-gradient(160deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 55%);
}

.ao-dropdown-premium svg { width: 13px; height: 13px; flex-shrink: 0; }

.ao-dropdown a,
.ao-dropdown button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: #334155;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s, backdrop-filter 0.12s;
  font-family: var(--font-main);
}

.ao-dropdown a:hover,
.ao-dropdown button:hover {
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(4px) saturate(150%);
  -webkit-backdrop-filter: blur(4px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
  color: #0f172a;
}

.ao-dropdown a svg,
.ao-dropdown button svg { width: 15px; height: 15px; flex-shrink: 0; }

.ao-logout { color: #ef4444 !important; }
.ao-dropdown .ao-logout:hover {
  background: rgba(255,245,245,0.7) !important;
  backdrop-filter: blur(4px) saturate(150%);
  -webkit-backdrop-filter: blur(4px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
  color: #dc2626 !important;
}

/* Desktop sign-out: plain red, no glass or lift */
.ao-header-link.ao-logout:hover {
  background: rgba(255,245,245,0.7) !important;
  color: #dc2626 !important;
  transform: none !important;
  box-shadow: none !important;
}

/* ── DESKTOP HEADER ITEMS ────────────────────────────────────── */
.ao-premium-badge {
  display: none;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245,158,11,0.88) 0%, rgba(217,119,6,0.88) 100%);
  border: 1px solid rgba(255,255,255,0.4);
  backdrop-filter: blur(6px) saturate(160%);
  -webkit-backdrop-filter: blur(6px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), inset 0 -1px 1px rgba(120,60,0,0.12);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: #ffffff;
  text-transform: uppercase;
  flex-shrink: 0;
  font-family: var(--font-main);
  position: relative;
  overflow: hidden;
  animation: aoZoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.26s both;
}

.ao-premium-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  pointer-events: none;
  background: linear-gradient(160deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 55%);
}

.ao-premium-badge svg { width: 10px; height: 10px; }

.ao-header-link {
  display: none;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  font-family: var(--font-main);
  transition: background 0.2s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  animation: aoZoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.30s both;
}

@media (hover: hover) and (pointer: fine) {
  .ao-header-link:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  }
}

.ao-header-link svg { width: 16px; height: 16px; flex-shrink: 0; }

@media (min-width: 769px) {
  .ao-premium-badge { display: inline-flex; }
  .ao-header-link   { display: flex; }
}

/* ── PAGE-LOAD ANIMATIONS ────────────────────────────────────── */
@keyframes aoHeaderDrop {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: translateY(0); }
}

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

.ao-header {
  animation: aoHeaderDrop 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.ao-logo {
  animation: aoZoomIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.18s both;
}

.ao-avatar-wrap {
  animation: aoZoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.36s both;
}

/* ── PRESS FEEL ──────────────────────────────────────────────── */
.ao-press {
  transform: scale(0.91) translateY(1px) !important;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.10) !important;
  transition: transform 0.08s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.08s ease !important;
}

/* ════════════════════════════════════════════════════════════
   NOTE HEADER — glass effect + entrance animations only.
   Shape, size, padding, font — all left to note-view.css.
   Scoped to .ao-note-header so no other page is affected.
   ════════════════════════════════════════════════════════════ */

/* Staggered entrance: logo 0.18s → bookmark 0.26s → lang 0.34s */
.ao-note-header #bookmark-form {
  animation: aoZoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.26s both;
}

.ao-note-header .lang-switcher-inline {
  animation: aoZoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.34s both;
}

/* ── Bookmark button — glass layer only ──────────────────────── */
.ao-note-header .bookmark-btn {
  background: linear-gradient(180deg, rgba(255,255,255,0.78) 0%, rgba(255,255,255,0.55) 100%);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    inset 0 -1px 1px rgba(20,30,70,0.03),
    0 4px 12px rgba(20,30,70,0.06);
}

/* Bookmarked state — blue-tinted glass */
.ao-note-header .bookmark-btn.is-active {
  background: color-mix(in srgb, var(--blue-soft) 78%, transparent);
  border-color: rgba(37, 99, 235, 0.20);
  color: var(--blue);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.90),
    0 4px 14px rgba(37, 99, 235, 0.12);
}

/* Pop animation replayed by JS on each toggle */
@keyframes aoBmPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1); }
  100% { transform: scale(1); }
}

.ao-note-header .bookmark-btn.just-toggled {
  animation: aoBmPop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── Lang switcher buttons — glass layer only ────────────────── */
.ao-note-header .lang-switcher-inline .lb {
  background: linear-gradient(180deg, rgba(255,255,255,0.60) 0%, rgba(255,255,255,0.40) 100%);
  border: 1px solid rgba(255,255,255,0.55);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.75),
    0 2px 8px rgba(20,30,70,0.05);
}

/* Active language — blue-tinted glass */
.ao-note-header .lang-switcher-inline .lb.active {
  background: color-mix(in srgb, var(--blue-soft) 78%, transparent);
  border-color: rgba(37, 99, 235, 0.20);
  color: var(--blue);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.90),
    0 4px 12px rgba(37, 99, 235, 0.10);
}


