/* ================================
   ExamArchive – Header (POLISHED)
   ================================ */

:root {
  --avatar-bg: #ecfeff;
  --avatar-text: #155e75;
  --avatar-ring: #16a34a;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10000;

  display: flex;
  align-items: center;
  justify-content: space-between;

  height: 64px;
  padding: 0 0.75rem;

  background: var(--surface);
  border-bottom: 1px solid var(--border);

  /* 🔥 prevents pinch overflow */
  overflow-x: clip;
}

/* ---------- Logo ---------- */
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.logo-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--red);
}

.logo-text {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  color: var(--text);
}

/* ---------- Desktop Nav ---------- */
.nav {
  display: flex;
  gap: 0.9rem;
}

.nav-link {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.nav-link:hover,
.nav-link.active {
  color: var(--red);
  font-weight: 600;
}

/* ---------- Right Actions ---------- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---------- Icons ---------- */
.icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* ---------- Theme Toggle ---------- */
.theme-toggle {
  display: flex;
  gap: 0.2rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.theme-btn,
.night-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;

  display: grid;
  place-items: center;
}

.theme-btn.active {
  background: rgba(0,0,0,0.06);
}

.night-btn.active {
  background: #fef3c7;
  color: #92400e;
}

/* ---------- Pill ---------- */
.header-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;

  padding: 4px 6px;
  border-radius: 999px;

  background: var(--bg-soft);
  border: 1px solid var(--border);
}

/* ---------- Avatar ---------- */
.avatar-trigger {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;

  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* Geometry wrapper */
.avatar-wrap {
  position: relative;
  width: 36px;
  height: 36px;
}

/* Ring */
.avatar-wrap::before {
  content: "";
  position: absolute;

  width: 38px;
  height: 38px;

  border-radius: 50%;
  border: 2px solid var(--avatar-ring);

  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Inner avatar */
.avatar-mini {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--avatar-text);

  font-size: 0.75rem;
  font-weight: 600;

  display: grid;
  place-items: center;
}

/* ---------- Hamburger ---------- */
.menu-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text);

  display: grid;
  place-items: center;
}

.menu-btn:hover {
  background: var(--bg-soft);
  border-radius: 50%;
}

.hamburger-icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
}

/* SVG animation fix */
.hamburger-icon line {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.25s ease;
}

body.menu-open .hamburger-icon line:nth-child(1) {
  transform: rotate(45deg);
}

body.menu-open .hamburger-icon line:nth-child(2) {
  transform: rotate(-45deg);
}

/* ---------- Mobile Menu ---------- */
.mobile-nav {
  position: absolute;
  top: 100%;
  right: 0.5rem;

  min-width: 170px;
  padding: 0.5rem;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);

  display: none;
  flex-direction: column;
  gap: 0.35rem;
}

.mobile-nav.open {
  display: flex;
}

.mobile-nav a {
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
}

.mobile-nav a:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.mobile-nav a.active {
  color: var(--red);
  font-weight: 600;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .nav {
    display: none;
  }

  .site-header {
    height: 60px;
  }
}

@media (min-width: 769px) {
  .mobile-nav {
    display: none !important;
  }

  .menu-btn {
    display: none;
  }
}

/* ---------- Dark / AMOLED ---------- */
body[data-theme="dark"] .site-header,
body[data-theme="amoled"] .site-header {
  color: #fff;
}

body[data-theme="dark"] .site-header button,
body[data-theme="amoled"] .site-header button {
  color: inherit;
}
