/* ============================================================================
   HEADERS — public app & admin top bar
   ============================================================================ */

/* ── Public app header (TAREHE-styled) ─────────────────────────────────── */
.app-header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(150%) blur(10px);
    -webkit-backdrop-filter: saturate(150%) blur(10px);
    border-bottom: 1px solid var(--border-light);
    box-shadow: none;
    padding: 0.85rem 0;
    transition: padding 0.22s ease, box-shadow 0.22s ease;
}

.app-header.scrolled {
    padding: 0.65rem 0;
    box-shadow: var(--shadow-sm);
}

.app-header .navbar-brand .app-logo-img {
    max-height: 42px;
    width: 65%;
    transition: max-height 0.22s ease;
}

.app-header.scrolled .navbar-brand .app-logo-img { max-height: 36px; }

@media (max-width: 575.98px) {
    .app-header { padding: 0.6rem 0; }
    .app-header .navbar-brand .app-logo-img { max-height: 34px; }
}

.app-header .nav-link {
    color: var(--text-dark) !important;
    font-weight: var(--font-weight-medium);
    padding: 0.5rem 0.9rem !important;
    transition: color 0.18s ease;
    position: relative;
}

.app-header .nav-link:hover { color: var(--primary-color) !important; }

.app-header .nav-link.public-active,
.app-header .nav-link.active {
    color: var(--primary-color) !important;
    font-weight: var(--font-weight-semibold);
}

.app-header .nav-link.public-active::after,
.app-header .nav-link.active::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 18px;
    height: 2px;
    background: var(--primary-color);
    border-radius: 2px;
}

.app-header .guest-buttons { gap: 0.5rem; }

.app-header .nav-dropdown {
    color: var(--text-dark) !important;
    padding: 0.45rem 0.75rem;
}

/* ── Admin top header ──────────────────────────────────────────────────── */
.admin-header {
    background: var(--surface-1);
    border-bottom: 1px solid var(--border-color);
    box-shadow: none;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    min-height: var(--header-height);
    padding: 0 var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    backdrop-filter: saturate(150%) blur(10px);
    -webkit-backdrop-filter: saturate(150%) blur(10px);
    background: rgba(255, 255, 255, 0.92);
}

.admin-header .navbar-toggler {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.35rem 0.55rem;
    background: var(--surface-1);
    color: var(--text-default);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.admin-header .navbar-toggler:hover {
    background: var(--surface-2);
    color: var(--text-strong);
}
.admin-header .navbar-toggler:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Page title slot inside the header (optional) */
.admin-header__title {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-strong);
    margin: 0;
    line-height: 1.2;
    letter-spacing: var(--letter-spacing-tight);
}

.admin-header .nav-link {
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-md);
    padding: 0.5rem 0.85rem !important;
    border-radius: var(--border-radius-sm);
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    text-decoration: none;
    transition: var(--transition-fast);
    color: var(--text-default);
}

.admin-header .nav-link:hover {
    background: var(--surface-2);
    color: var(--primary-color);
}

.admin-header .nav-link.active {
    background: var(--primary-soft);
    color: var(--primary-color) !important;
    font-weight: var(--font-weight-semibold);
}

/* Icon-only header button (notification bell, theme toggle, etc.) */
.header-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}
.header-icon-btn:hover {
    background: var(--surface-2);
    color: var(--text-strong);
    border-color: var(--border-color);
}
.header-icon-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger-color);
    border: 2px solid var(--surface-1);
}

/* Search slot in the admin header */
.admin-header__search {
    flex: 1;
    max-width: 380px;
    position: relative;
}

.admin-header__search .form-control {
    padding-left: 2.25rem;
    background: var(--surface-2);
    border-color: transparent;
    border-radius: var(--border-radius-pill);
    height: 36px;
    font-size: var(--font-size-sm);
}
.admin-header__search .form-control:focus {
    background: var(--surface-1);
    border-color: var(--border-focus);
}
.admin-header__search .bi-search {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Keyboard hint shortcut chip inside search */
.admin-header__search-kbd {
    position: absolute;
    right: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface-1);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xs);
    padding: 1px 6px;
    font-size: 0.7rem;
    font-family: var(--font-family-mono);
    pointer-events: none;
}

/* Mobile */
@media (max-width: 768px) {
    .admin-header { padding: 0 var(--spacing-md); gap: var(--spacing-sm); }
    .admin-header__search { max-width: none; }
    .admin-header__search-kbd { display: none; }
}

/* ── Stitch header refinements ─────────────────────────────────────────── */

/* Thin vertical divider between icon buttons and profile area */
.header-divider {
    display: inline-block;
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 var(--spacing-xs);
    flex-shrink: 0;
}

/* Profile pill (Stitch pattern — avatar + name, no chevron border) */
.header-profile {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 4px 12px 4px 4px;
    background: transparent;
    border: 0;
    border-radius: var(--border-radius-pill);
    color: var(--text-default);
    text-decoration: none;
    transition: var(--transition-fast);
    cursor: pointer;
}
.header-profile:hover,
.header-profile[aria-expanded="true"] {
    background: var(--surface-2);
    color: var(--text-strong);
}
/* Scoped under .header-profile so these classes don't leak into other
   call sites of the profile-dropdown partial (e.g. the public top-nav
   uses a different trigger class). */
.header-profile .header-profile__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--primary-soft);
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-xs);
    flex-shrink: 0;
    overflow: hidden;
}
.header-profile .header-profile__name {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    line-height: 1.2;
    color: var(--text-strong);
}
@media (max-width: 991.98px) {
    .header-profile .header-profile__name { display: none; }
}
