/* Header (StackOverflow-inspired).
   Keep this file focused on header/nav/search components only.
*/

@import url('https://fonts.googleapis.com/css2?family=Fonseca:wght@400;500;600;700&display=swap');

.headerbar{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.headerbar__accent{
  height: 3px;
  background: var(--orange);
}

.headerbar__inner{
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.headerbar__brand{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
}

.headerbar__brand-text{
  font-family: 'Fonseca', serif;
  font-size: 1.3rem;
  font-weight: 600;
}

.headerbar__brand-mark{
  display: inline-block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--orange), #ffb26b);
}

.headerbar__menu{ position: relative; display: none; }
.headerbar__menu > summary{ list-style: none; }
.headerbar__menu > summary::-webkit-details-marker{ display: none; }

.headerbar__menu-label{
  margin-left: 6px;
  font-weight: 600;
  color: var(--muted);
}

.menupanel{
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  display: grid;
  gap: 4px;
}

.menupanel__item{
  display: block;
  padding: 10px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
}
.menupanel__item:hover{ background: var(--page-bg); }

/* Search */
.headerbar__search{
  flex: 1;
  min-width: 0;
  margin-left: 24px; /* move search a bit further right */
}

.searchbar{
  min-width: 260px;
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  max-width: 720px; /* keep room for actions */
}

.searchbar:focus-within{
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-weak);
}

.searchbar__field{
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  flex: 1;
  min-width: 0;
}

.searchbar__field--loc{
  flex: 0 0 220px;
}

.searchbar__icon{ color: var(--muted); }

.searchbar__input{
  border: 0;
  outline: none;
  width: 100%;
  min-width: 0;
  font-size: 14px;
  background: transparent;
  color: var(--text);
}

.searchbar__divider{
  width: 1px;
  background: var(--border);
}

.searchbar__submit{
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  padding: 0 16px;
  font-weight: 700;
}

/* Actions */
.headerbar__actions{
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* IMPORTANT: header-specific icon/button classes (avoid clash with static/css/icons.css) */
.headerbar .hbicon{
  width: 18px;
  height: 18px;
}

.headerbar .hbbtn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  font: inherit;
  white-space: nowrap;
}

.headerbar .btn,
.headerbar .hbbtn,
.headerbar button,
.headerbar .notification-bell,
.headerbar .notification-bell--system{
  background: #7AAACE;
  border-color: #7AAACE;
  color: #fff;
}

.headerbar .btn:hover,
.headerbar .hbbtn:hover,
.headerbar button:hover,
.headerbar .notification-bell:hover,
.headerbar .notification-bell--system:hover{
  background: #7AAACE;
  border-color: #7AAACE;
  color: #fff;
}

.headerbar .hbbtn--ghost:hover{
  background: #7AAACE;
  border-color: #7AAACE;
}

.headerbar .notification-bell__icon,
.headerbar .hbicon,
.headerbar .userdd__caret{
  color: currentColor;
}

/* User dropdown */
.userdd{ position: relative; }
.userdd > summary{ list-style: none; }
.userdd > summary::-webkit-details-marker{ display: none; }

.userdd__avatar{
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  object-fit: cover;
  background: var(--chip);
  display: block;
}

.userdd__text{
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.userdd__caret{ color: var(--muted); }

.userdd__panel{
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  display: grid;
  gap: 4px;
}

.userdd__item{
  display: block;
  padding: 10px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
}
.userdd__item:hover{ background: var(--page-bg); }

.userdd__divider{
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

.userdd__item--danger{ color: #b42318; }

/* Responsive */
@media (max-width: 900px){
  .headerbar__menu-label{ display:none; }
  .searchbar__field--loc{ flex-basis: 180px; }
}

@media (max-width: 720px){
  .searchbar{ max-width: 100%; }
  .searchbar__field--loc{ display:none; }
  .userdd__text{ display:none; }
}

/* Hide summary marker (cross-browser) */
.headerbar__menu > summary::marker{ content: ""; }
