/* ==========================================================================
   header.css — sticky glass top bar: title, search, actions, account menu
   ========================================================================== */

.header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex: none;
  height: var(--header-h);
  padding: 0 var(--gap);
  border-bottom: 1px solid var(--border);
  background: var(--glass-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.header__left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.header__titles { min-width: 0; }
.header__title {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-sm);
  color: var(--text-subtle);
  white-space: nowrap;
}
.breadcrumb a { transition: color var(--t); }
.breadcrumb a:hover { color: var(--text-secondary); }
.breadcrumb .icon { width: 13px; height: 13px; opacity: 0.6; }
.breadcrumb [aria-current] { color: var(--text-muted); }

.header__right { display: flex; align-items: center; gap: var(--space-2); }

/* --- Search --------------------------------------------------------------- */
.search { position: relative; width: clamp(220px, 24vw, 320px); }

.search__icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-subtle);
  pointer-events: none;
  transition: color var(--t);
}
.search:focus-within .search__icon { color: var(--primary); }

.search__input {
  width: 100%;
  height: 38px;
  padding: 0 40px 0 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  font-size: var(--text-base);
  transition: border-color var(--t), box-shadow var(--t), background-color var(--t);
}
.search__input::placeholder { color: var(--text-subtle); }
.search__input::-webkit-search-cancel-button { display: none; }
.search__input:hover:not(:focus) { border-color: var(--border-strong); }
.search__input:focus {
  border-color: var(--primary);
  background: rgba(79, 140, 255, 0.05);
  box-shadow: var(--ring);
}

.search__kbd {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  pointer-events: none;
  transition: opacity var(--t);
}
.search__input:focus ~ .search__kbd { opacity: 0; }

/* Results popover */
.search__results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  width: min(420px, 92vw);
  max-height: 62vh;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--glass-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  animation: scale-in var(--t) both;
}

.result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  transition: background-color var(--t-fast);
}
.result:hover,
.result.is-highlighted { background: rgba(255, 255, 255, 0.06); }

.result__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent, var(--primary)) 12%, transparent);
  color: var(--accent, var(--primary));
}
.result__icon .icon { width: 16px; height: 16px; }
.result__body { min-width: 0; }
.result__title {
  display: block;
  font-size: var(--text-base);
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result__title mark {
  padding: 0 1px;
  border-radius: 3px;
  background: var(--primary-soft);
  color: #93b8ff;
}
.result__meta {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result__enter {
  margin-left: auto;
  opacity: 0;
  transition: opacity var(--t);
}
.result.is-highlighted .result__enter { opacity: 1; }

.search__empty {
  padding: var(--space-6) var(--space-3);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* --- Avatar / account ----------------------------------------------------- */
.avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--gradient);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 650;
  letter-spacing: 0.02em;
  transition: transform var(--t-fast), box-shadow var(--t);
}
.avatar:hover { box-shadow: var(--shadow-glow); }
.avatar:active { transform: scale(0.94); }
.avatar__status {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-sidebar);
}

/* Avatar photo — fills the circular button. */
.avatar__img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  display: block;
}
