/* static/css/aq_navbar.css */
.aq-navbar {
  background: var(--bg-color);
  border-bottom: 1px solid var(--border-dim);
  position: sticky; top: 0; z-index: 50;
}
.aq-navbar-inner {
  max-width: 1320px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  height: 60px; padding: 0 24px;
}
.aq-navbar-mobile { display: none; }

.aq-navbar-logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; transform: translateX(-4px); }
.aq-navbar-logo-img { width: 26px; height: 28px; transform: translateY(1px); }
.aq-navbar-logo-text { font-family: Georgia, serif; font-size: 23px; color: var(--text-bright); }
.aq-navbar-logo-text .logo-accent { color: var(--accent-color); }

.aq-navbar-divider { width: 1px; height: 26px; background: var(--border-dim); }

.aq-navbar-primary { display: flex; align-items: center; gap: 4px; }
.aq-nav-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  font-family: 'Courier New', monospace; font-size: 13px; font-weight: 700;
  text-decoration: none;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
}
.aq-nav-link:hover { background: var(--accent-subtle); color: var(--accent-color); }
.aq-nav-link.is-active {
  color: var(--accent-color);
  background: var(--accent-subtle);
  border-bottom-color: var(--accent-color);
}
/* Icons inherit color from the surrounding link/button via currentColor.
   Active/hover states colorize the icon for free, no extra rules needed. */
.aq-nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.aq-search-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-dim); }
.aq-search-trigger:hover .aq-search-icon { color: var(--accent-color); }
.aq-credits-icon { width: 15px; height: 15px; flex-shrink: 0; color: var(--accent-color); }
.aq-create-icon { width: 16px; height: 16px; flex-shrink: 0; }
.aq-bell-btn svg, .aq-bell-btn-mobile svg { width: 22px; height: 22px; }

/* Right cluster: search-trigger | account group | divider | CREATE */
.aq-navbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; position: relative; }

/* Search trigger reads as a search input: glyph + placeholder text.
   Clicking opens the palette overlay (same behavior as a search input would). */
.aq-search-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 12px;
  min-width: 240px; max-width: 340px;
  background: #0d0d0d; border: 1px solid var(--border-dim);
  color: var(--text-dim); cursor: pointer; text-align: left;
  font-family: 'Courier New', monospace; font-size: 13px; font-weight: 600;
}
.aq-search-trigger:hover { border-color: var(--accent-color); color: var(--accent-color); }
.aq-search-trigger-label {
  flex: 1; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.aq-search-trigger:hover .aq-search-trigger-label { color: var(--accent-color); }

/* Palette overlay — fixed, centered top, ~640px wide. */
.aq-search-palette[hidden] { display: none; }
.aq-search-palette {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: flex; justify-content: center; align-items: flex-start;
  padding-top: 12vh;
}
.aq-search-palette-inner {
  width: min(640px, 92vw);
  background: var(--bg-secondary);
  border: 1px solid var(--accent-color);
}
.aq-search-palette-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 48px;
  border-bottom: 1px solid var(--border-dim);
}
.aq-search-palette-bar .aq-search-glyph { font-size: 18px; }
.aq-search-input {
  flex: 1; background: transparent; border: 0; outline: none;
  color: var(--text-bright); font-family: 'Courier New', monospace; font-size: 14px;
}
.aq-search-esc {
  font-family: 'Courier New', monospace; font-size: 10px;
  color: var(--text-dim); border: 1px solid var(--border-dim); padding: 1px 6px;
}
.aq-search-dropdown {
  max-height: 60vh; overflow-y: auto; padding: 8px 0;
}

/* Account group: credits + bell + avatar tight together. */
.aq-navbar-account { display: flex; align-items: center; gap: 4px; position: relative; }
.aq-navbar-cluster-divider { width: 1px; height: 24px; background: var(--border-dim); }

/* CREATE is the navbar's primary action — solid amber, dark text. */
.aq-create-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px; height: 34px;
  font-family: 'Courier New', monospace; font-size: 13px;
  text-decoration: none;
  color: var(--bg-color); background: var(--accent-color);
  border: 1px solid var(--accent-color); font-weight: 700;
}
.aq-create-btn:hover { background: #ffd766; border-color: #ffd766; color: var(--bg-color); }

.aq-credits-chip { position: relative; display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 12px; height: 34px; background: transparent;
  border: 1px solid var(--border-dim); color: var(--text-bright);
  font-family: 'Courier New', monospace; font-size: 13px; font-weight: 600; cursor: pointer; }
.aq-credits-amount { color: var(--accent-color); font-weight: 700; }
.aq-credits-pulse { position: absolute; top: 4px; right: 4px; width: 6px; height: 6px;
  background: var(--accent-color);
  animation: aq-credits-pulse 1.4s ease-in-out infinite; }
@keyframes aq-credits-pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }

.aq-bell-btn, .aq-avatar-btn { width: 38px; height: 38px; padding: 0; background: transparent;
  border: 1px solid transparent; cursor: pointer; color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center; position: relative; }
.aq-bell-btn:hover, .aq-avatar-btn:hover { color: var(--accent-color); }
.aq-bell-badge { position: absolute; top: -2px; right: -2px;
  background: var(--accent-color); color: var(--bg-color);
  font-family: 'Courier New', monospace; font-size: 9px; font-weight: 700;
  padding: 0 4px; line-height: 12px; min-width: 12px; text-align: center; }

.aq-avatar-btn { width: 36px; height: 36px; border-color: var(--accent-color); overflow: hidden; border-radius: 50%; }
.aq-avatar-img, .aq-avatar-placeholder { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.aq-avatar-placeholder { display: flex; align-items: center; justify-content: center;
  font-family: Georgia, serif; font-size: 14px; color: var(--accent-color); background: transparent; }

/* Popovers are body-level siblings so they remain renderable when the
   desktop navbar is display:none on mobile. aq_navbar.js sets their inline
   top/right from the clicked trigger's bounding rect — z-index sits below
   the modal search palette (200) and above the sticky bars (50). */
.aq-credits-popover, .aq-bell-popover, .aq-avatar-popover {
  position: fixed; min-width: 240px;
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 191, 0, 0.1);
  z-index: 100; padding: 8px 0;
}
.aq-credits-popover { width: 260px; }
.aq-avatar-popover { width: 296px; }
.aq-avatar-popover-header {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center; column-gap: 12px; row-gap: 2px;
  padding: 14px 14px 12px;
}
.aq-avatar-popover-pic {
  width: 42px; height: 42px; flex-shrink: 0;
  border: 1px solid var(--accent-color); border-radius: 50%;
  object-fit: cover;
}
/* Filled circle reads as a deliberate avatar instead of a lone italic letter
   floating in an empty ring. Border becomes redundant once the fill is amber. */
.aq-avatar-popover-pic-placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Courier New', monospace; font-size: 16px; font-weight: 700;
  letter-spacing: 1px; color: var(--bg-color);
  background: var(--accent-color); border: 0;
}
.aq-avatar-popover-id { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.aq-avatar-popover-name {
  display: block; font-family: Georgia, serif; font-size: 16px; color: var(--text-bright);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.aq-avatar-popover-email {
  display: block; font-family: 'Courier New', monospace; font-size: 12px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.aq-avatar-popover-tag {
  flex-shrink: 0; padding: 2px 6px;
  font-family: 'Courier New', monospace; font-size: 9px; font-weight: 700; letter-spacing: 1px;
  color: var(--bg-color); background: var(--accent-color);
}
.aq-avatar-popover-divider { height: 1px; background: var(--border-dim); margin: 6px 0; }
.aq-avatar-popover-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; font-family: 'Courier New', monospace; font-size: 11px;
  letter-spacing: 1px; text-transform: uppercase; text-decoration: none; color: var(--text-bright);
  background: transparent; border: 0; width: 100%; text-align: left; cursor: pointer;
}
.aq-avatar-popover-item:hover { background: var(--accent-subtle); color: var(--accent-color); }
.aq-avatar-popover-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-dim); }
.aq-avatar-popover-item:hover .aq-avatar-popover-icon { color: var(--accent-color); }
.aq-avatar-popover-form { margin: 0; }
.aq-signout { color: #ff8e7a; }
.aq-signout .aq-avatar-popover-icon { color: #ff8e7a; }
.aq-signout:hover .aq-avatar-popover-icon { color: #ff8e7a; }

.aq-pop-header { padding: 8px 14px; font-family: 'Courier New', monospace; font-size: 10px;
  letter-spacing: 2px; color: var(--text-dim); }

/* Credits popover row/divider/link styling — JS in aq_navbar.js builds these
   elements dynamically (renderCredits), so the styles live here, not in
   per-page CSS. */
.aq-pop-row { display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 14px; font-family: 'Courier New', monospace; font-size: 12px;
  color: var(--text-bright); }
.aq-pop-row span { color: var(--text-dim); }
.aq-pop-row strong { font-weight: 400; color: var(--text-bright); }
.aq-pop-row-total span { color: var(--text-bright); text-transform: uppercase;
  font-size: 10px; letter-spacing: 1px; }
.aq-pop-row-total strong { color: var(--accent-color); font-weight: 700; font-size: 14px; }
.aq-pop-divider { height: 1px; background: var(--border-dim); margin: 6px 14px; }
.aq-pop-link { display: block; padding: 8px 14px;
  font-family: 'Courier New', monospace; font-size: 11px;
  letter-spacing: 1px; text-transform: uppercase; text-decoration: none;
  color: var(--text-bright); }
.aq-pop-link:hover { background: var(--accent-subtle); color: var(--accent-color); }
.aq-claim-btn { display: block; width: calc(100% - 28px); margin: 8px 14px;
  padding: 8px 12px; background: var(--accent-color); color: var(--bg-color);
  border: 1px solid var(--accent-color); cursor: pointer; font-weight: 700;
  font-family: 'Courier New', monospace; font-size: 11px;
  letter-spacing: 1px; text-transform: uppercase; }
.aq-claim-btn:hover:not(:disabled) { background: #ffd766; border-color: #ffd766; }
.aq-claim-btn:disabled { opacity: 0.5; cursor: default; }
.aq-claim-error { padding: 6px 14px; font-family: 'Courier New', monospace;
  font-size: 11px; color: #ff8e7a; }
.aq-notif-row { display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; text-decoration: none; color: var(--text-bright); }
.aq-notif-row:hover { background: var(--accent-subtle); }
.aq-notif-dot { width: 8px; height: 8px; margin-top: 6px;
  background: var(--accent-color); flex-shrink: 0; }
.aq-notif-dot-read { background: transparent; border: 1px solid var(--border-dim); }
.aq-notif-body { display: flex; flex-direction: column; gap: 2px; }
.aq-notif-title { font-family: 'Courier New', monospace; font-size: 12px; }
.aq-notif-meta { font-family: 'Courier New', monospace; font-size: 10px; color: var(--text-dim); }
.aq-notif-empty { padding: 14px; font-family: 'Courier New', monospace; font-size: 11px;
  color: var(--text-dim); text-align: center; }
.aq-pop-footer { display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--border-dim); }
.aq-pop-footer .aq-pop-link { background: none; border: 0; cursor: pointer; }
.aq-notif-row.is-read .aq-notif-dot { background: transparent; border: 1px solid var(--border-dim); }

@media (max-width: 919px) {
  .aq-navbar { display: none; }
  .aq-navbar-mobile { display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center; column-gap: 8px;
    height: 54px; padding: env(safe-area-inset-top) 12px 0 12px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-dim);
    position: sticky; top: 0; z-index: 50; }
  .aq-mobile-search-btn { width: 44px; height: 44px; padding: 0;
    background: transparent; border: 0; cursor: pointer; color: var(--text-bright);
    display: inline-flex; align-items: center; justify-content: center;
    justify-self: start; }
  .aq-mobile-search-icon { width: 22px; height: 22px; }
  .aq-mobile-search-btn:hover { color: var(--accent-color); }
  .aq-navbar-logo-mobile { justify-self: center; }
  .aq-navbar-logo-mobile .aq-navbar-logo-img { width: 22px; height: 24px; }
  .aq-navbar-logo-mobile .aq-navbar-logo-text { font-size: 19px; }
  .aq-mobile-right { display: flex; align-items: center; gap: 8px;
    justify-self: end; }
  .aq-credits-chip-mobile { padding: 4px 10px; min-height: 36px; min-width: 44px; font-size: 13px; border: 0; }
  .aq-credits-chip-mobile .aq-credits-glyph { font-size: 16px; }
  .aq-bell-btn-mobile { min-width: 44px; min-height: 44px; }
  .aq-bell-btn-mobile svg { width: 24px; height: 24px; }
}

/* Search row layout: thumbnail + body. Used by both desktop dropdown and
   mobile overlay (aq_user_sheet.js). */
.aq-search-row { display: grid; grid-template-columns: 44px 1fr; gap: 10px;
  align-items: center; padding: 8px 12px; text-decoration: none; color: var(--text-bright); }
.aq-search-row:hover { background: var(--accent-subtle); }
.aq-search-row-thumb { display: block; width: 44px; height: 44px;
  background: #181818 center/cover no-repeat;
  border: 1px solid var(--border-dim); flex-shrink: 0; }
.aq-search-row-thumb-empty { display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent-color); font-size: 18px; opacity: 0.5; }
.aq-search-row-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.aq-search-row-title { font-family: Georgia, serif; font-size: 14px; color: var(--text-bright);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aq-search-row-meta { font-family: 'Courier New', monospace; font-size: 10px; color: var(--text-dim);
  letter-spacing: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aq-search-group-h { padding: 6px 12px; font-family: 'Courier New', monospace; font-size: 10px;
  letter-spacing: 2px; color: var(--text-dim); text-transform: uppercase; }
.aq-search-viewall { display: block; padding: 8px 12px; text-align: center;
  font-family: 'Courier New', monospace; font-size: 10px; letter-spacing: 1px;
  color: var(--accent-color); text-decoration: none; text-transform: uppercase; }
.aq-search-viewall:hover { background: var(--accent-subtle); }

/* Search overlay (mobile sheet) needs larger thumbs to feel like cards. */
.aq-search-overlay-results .aq-search-row { grid-template-columns: 64px 1fr; padding: 10px 14px; }
.aq-search-overlay-results .aq-search-row-thumb { width: 64px; height: 64px; }
.aq-search-overlay-results .aq-search-row-title { font-size: 16px; white-space: normal;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---------------- SPA navigation chrome ---------------- */

/* Thin top progress bar that fills during in-place page nav. */
.aq-spa-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0;
  background: var(--accent-color);
  box-shadow: 0 0 8px rgba(255,191,0,0.6);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: width 600ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 200ms ease;
}
.aq-spa-progress.is-loading {
  opacity: 1;
  width: 80%;
}
.aq-spa-progress.is-done {
  opacity: 0;
  width: 100%;
  transition: width 200ms ease, opacity 400ms ease 100ms;
}

/* Fade swapped page content in on SPA mount. */
@keyframes aq-spa-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
main#app-content[data-spa-fresh="true"] {
  animation: aq-spa-fadein 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@media (prefers-reduced-motion: reduce) {
  main#app-content[data-spa-fresh="true"] { animation: none; }
  .aq-spa-progress { transition: opacity 120ms ease; }
}

/* Directional pane slide between tabbar tabs. The track holds two stacked
   panes side-by-side (200% wide); animating the track's transform glides the
   incoming pane in from the right (forward) or left (backward), while the
   outgoing pane exits the opposite side — the iOS/Android tab-switch idiom. */
.aq-spa-stage {
  position: relative;
  width: 100%;
  overflow-x: hidden;
}
.aq-spa-track {
  display: flex;
  width: 200%;
  transform: translateX(0);
  will-change: transform;
}
.aq-spa-track.is-animating {
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.aq-spa-track > main {
  width: 50%;
  flex: 0 0 50%;
  min-width: 0;
}
@media (prefers-reduced-motion: reduce) {
  .aq-spa-track.is-animating { transition: none; }
}

/* Instant skeleton placeholder swapped in on tap, replaced by real content
   when the fetch resolves. Reuses the existing shimmer keyframe used by
   per-page skeletons so all loading states feel like one system. */
@keyframes aq-spa-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
main#app-content[data-spa-skeleton="true"] {
  padding: 24px 16px;
  max-width: 1320px;
  margin: 0 auto;
}
.aq-spa-skel-title,
.aq-spa-skel-hero,
.aq-spa-skel-card {
  background: linear-gradient(90deg, #161616 0%, #232323 50%, #161616 100%);
  background-size: 200% 100%;
  animation: aq-spa-shimmer 1.4s ease-in-out infinite;
  border: 1px solid var(--border-dim);
}
.aq-spa-skel-title {
  width: 55%;
  max-width: 320px;
  height: 28px;
  border: 0;
  margin: 0 0 24px;
}
.aq-spa-skel-hero {
  width: 100%;
  height: 180px;
  margin-bottom: 24px;
}
.aq-spa-skel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.aq-spa-skel-card { height: 180px; }
@media (prefers-reduced-motion: reduce) {
  .aq-spa-skel-title,
  .aq-spa-skel-hero,
  .aq-spa-skel-card {
    animation: none;
    background: #161616;
  }
}
