/* ==========================================================================
   Header
   ========================================================================== */
.sr-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--sr-header-h);
  background: var(--sr-dark);
  border-bottom: 1px solid var(--sr-border);
}
.sr-header-inner {
  max-width: var(--sr-main-max);
  margin: 0 auto;
  padding: 0 var(--sr-gap);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sr-gap);
}
.sr-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.sr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--sr-radius-sm);
  cursor: pointer;
  border: none;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.sr-btn:focus { outline: 2px solid var(--sr-accent); outline-offset: 2px; }
.sr-btn-primary {
  background: var(--sr-accent);
  color: #fff;
}
.sr-btn-primary:hover { background: var(--sr-accent-hover); color: #fff; }
.sr-btn-outline {
  background: transparent;
  color: var(--sr-text);
  border: 1px solid var(--sr-border);
}
.sr-btn-outline:hover { background: var(--sr-card); color: var(--sr-text); border-color: var(--sr-muted); }
.sr-logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--sr-text);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 0;
  -webkit-tap-highlight-color: transparent;
}
.sr-logo:hover { color: var(--sr-accent); text-decoration: none; }
.sr-logo-icon { width: 28px; height: 28px; flex-shrink: 0; }
/* Mobile menu toggle — visible only on small screens */
.sr-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0 -8px 0 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--sr-text);
  cursor: pointer;
  border-radius: var(--sr-radius-sm);
}
.sr-menu-toggle:hover { background: var(--sr-card); color: var(--sr-accent); }
.sr-menu-toggle:focus { outline: 2px solid var(--sr-accent); outline-offset: 2px; }
.sr-menu-toggle-icon {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -7px 0 currentColor, 0 7px 0 currentColor;
}
.sr-menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
}
.sr-sidebar-close {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: var(--sr-card);
  color: var(--sr-text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--sr-radius-sm);
}
.sr-sidebar-close:hover { background: var(--sr-border); color: var(--sr-accent); }
.sr-sidebar-close:focus { outline: 2px solid var(--sr-accent); outline-offset: 2px; }

.sr-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.sr-nav a {
  padding: 8px 12px;
  border-radius: var(--sr-radius-sm);
  color: var(--sr-muted);
  font-size: 0.9rem;
}
.sr-nav a:hover { color: var(--sr-text); background: var(--sr-card); text-decoration: none; }
.sr-nav a.current { color: var(--sr-accent); }

/* Header search */
.sr-header-search-wrap {
  flex: 1;
  min-width: 0;
  max-width: 420px;
  margin: 0 auto 0 12px;
}
.sr-search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.sr-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sr-muted);
  pointer-events: none;
}
.sr-search-input {
  width: 100%;
  min-height: 40px;
  padding: 8px 36px 8px 40px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--sr-text);
  background: var(--sr-card);
  border: 1px solid var(--sr-border);
  border-radius: var(--sr-radius);
  -webkit-appearance: none;
  appearance: none;
}
.sr-search-input::placeholder { color: var(--sr-muted); }
.sr-search-input:hover { border-color: var(--sr-muted); }
.sr-search-input:focus {
  outline: none;
  border-color: var(--sr-accent);
  box-shadow: 0 0 0 2px rgba(230, 57, 0, 0.2);
}
.sr-search-input::-webkit-search-cancel-button,
.sr-search-input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}
.sr-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--sr-muted);
  text-decoration: none;
  border-radius: var(--sr-radius-sm);
  font-size: 1.25rem;
  line-height: 1;
}
.sr-search-clear:hover {
  color: var(--sr-text);
  background: var(--sr-dark);
  text-decoration: none;
}
.sr-search-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--sr-text);
  cursor: pointer;
  border-radius: var(--sr-radius-sm);
  flex-shrink: 0;
}
.sr-search-toggle:hover { background: var(--sr-card); color: var(--sr-accent); }
.sr-search-toggle:focus { outline: 2px solid var(--sr-accent); outline-offset: 2px; }
.sr-search-page-form { margin-top: 12px; max-width: 480px; }
.sr-search-form-page .sr-search-input { min-height: 44px; font-size: 1rem; }
.sr-search-query { color: var(--sr-accent); }
.sr-search-meta { margin-top: 4px; }

/* Header profile dropdown (avatar + chevron) */
.sr-header-profile {
  position: relative;
}
.sr-header-profile-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 4px;
  border: none;
  background: transparent;
  color: var(--sr-text);
  cursor: pointer;
  border-radius: var(--sr-radius-sm);
  -webkit-tap-highlight-color: transparent;
}
.sr-header-profile-trigger:hover {
  background: var(--sr-card);
}
.sr-header-profile-trigger:focus {
  outline: 2px solid var(--sr-accent);
  outline-offset: 2px;
}
.sr-header-profile-trigger[aria-expanded="true"] {
  background: var(--sr-card);
}
.sr-header-profile-trigger[aria-expanded="true"] .sr-header-profile-chevron {
  transform: rotate(180deg);
}
.sr-header-profile-avatar {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: #e0e0e0;
  flex-shrink: 0;
}
.sr-header-profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sr-header-profile-chevron {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sr-muted);
  transition: transform 0.2s ease, color 0.2s ease;
}
/* Soft accent on chevron when there is unread activity */
.sr-header-profile-chevron.sr-chevron-has-unread {
  color: var(--sr-accent);
}
/* Orange alert dot on the profile chevron */
.sr-header-chevron-dot {
  position: absolute;
  top: -1px;
  right: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sr-accent);
  box-shadow: 0 0 0 2px var(--sr-dark);
  pointer-events: none;
}
.sr-header-chevron-dot[hidden] {
  display: none !important;
}
.sr-header-profile-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--sr-card);
  border: 1px solid var(--sr-border);
  border-radius: var(--sr-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 6px 0;
  z-index: 110;
  display: none;
  flex-direction: column;
}
.sr-header-profile.is-open .sr-header-profile-dropdown {
  display: flex;
}
.sr-header-profile-dropdown[hidden] {
  display: none !important;
}
.sr-header-profile.is-open .sr-header-profile-dropdown:not([hidden]) {
  display: flex;
}
.sr-header-profile-item {
  display: block;
  flex: 0 0 auto;
  padding: 10px 16px;
  color: var(--sr-text);
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  line-height: 1.4;
}
.sr-header-profile-item:hover {
  background: var(--sr-dark);
  color: var(--sr-accent);
  text-decoration: none;
}
.sr-header-profile-item + .sr-header-profile-item {
  margin-top: 0;
  border-top: none;
}
/* Messages / Notifications items: label + unread dot */
.sr-header-profile-item-messages,
.sr-header-profile-item-notifications {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sr-header-profile-item-messages .sr-header-profile-item-label,
.sr-header-profile-item-notifications .sr-header-profile-item-label {
  flex: 1;
  min-width: 0;
}
.sr-unread-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sr-accent);
}
.sr-unread-dot[hidden] {
  display: none !important;
}
.sr-header-profile-dropdown .sr-header-profile-item {
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
}
