.site-header {
    z-index: 1030;
    background:
        linear-gradient(90deg, rgb(255 250 244 / 98%), rgb(255 255 255 / 98%));
    border-top: 3px solid var(--primary);
    border-bottom: 1px solid rgb(216 154 34 / 42%);
    backdrop-filter: blur(16px);
}

.site-header.is-scrolled {
    box-shadow: 0 0.75rem 2rem rgb(93 0 20 / 11%);
}

.site-header .navbar {
    min-height: 5.15rem;
    padding: 0.45rem 0;
}

.header-navbar-inner {
    display: flex;
    width: 100%;
    max-width: none;
    align-items: center;
    padding-inline: clamp(0.8rem, 2vw, 2rem);
    gap: clamp(0.65rem, 1.4vw, 1.2rem);
}

.site-logo-link {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
}

.site-logo {
    width: clamp(10.2rem, 13vw, 12.5rem);
    height: auto;
    filter: drop-shadow(0 0.25rem 0.35rem rgb(93 0 20 / 12%));
}

.header-profile-search {
    position: relative;
    width: clamp(16rem, 21vw, 21rem);
    flex: 0 1 21rem;
    margin: 0;
}

.header-search-control {
    display: flex;
    width: 100%;
    min-width: 0;
    height: 2.9rem;
    align-items: center;
    overflow: hidden;
    background: linear-gradient(90deg, #fff7f7, #ffffff);
    border: 1.5px solid rgb(143 0 31 / 62%);
    border-radius: 999px;
    box-shadow:
        0 0.45rem 1.2rem rgb(78 29 41 / 10%),
        inset 0 0 0 1px rgb(255 255 255 / 72%);
}

.header-search-control:focus-within {
    border-color: var(--primary);
    box-shadow:
        0 0 0 0.2rem rgb(143 0 31 / 13%),
        0 0.65rem 1.5rem rgb(78 29 41 / 13%);
}

.header-search-control.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 0.2rem rgb(180 35 24 / 8%);
}

.header-search-control > i {
    display: grid;
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    margin-left: 0.38rem;
    place-items: center;
    color: #ffffff;
    background: var(--primary);
    border-radius: 50%;
    font-size: 0.78rem;
}

.header-search-control input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0 0.55rem;
    color: var(--text);
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 0.72rem;
}

.header-search-control input::placeholder {
    color: #9a8b8f;
}

.header-search-control button {
    display: flex;
    width: 5.7rem;
    height: 2.9rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #ffffff;
    background: linear-gradient(135deg, #780019, #b10a36);
    border: 0;
    font-size: 0.68rem;
    font-weight: 800;
    gap: 0.35rem;
}

.header-search-control button:hover,
.header-search-control button:focus-visible {
    color: #5d0014;
    background: linear-gradient(135deg, #ffd978, #d99a22);
}

.header-search-error {
    position: absolute;
    z-index: 4;
    top: calc(100% + 0.35rem);
    left: 0.8rem;
    width: max-content;
    max-width: calc(100vw - 2rem);
    padding: 0.25rem 0.55rem;
    color: #ffffff;
    background: var(--danger);
    border-radius: 0.4rem;
    font-size: 0.62rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.site-header .navbar-collapse {
    min-width: 0;
    flex: 1 1 auto;
}

.site-header .navbar-nav {
    margin-left: auto;
}

.site-header .nav-link {
    position: relative;
    padding: 0.55rem clamp(0.42rem, 0.62vw, 0.72rem) !important;
    color: #46373b;
    border-radius: 0.55rem;
    font-size: clamp(0.68rem, 0.95vw, 100rem);
    font-weight: 800;
    white-space: nowrap;
}

.site-header .nav-link:hover,
.site-header .nav-link.active {
    color: var(--primary);
    background: rgb(143 0 31 / 6%);
}

.site-header .nav-link::after {
    position: absolute;
    right: 0.4rem;
    bottom: 0.12rem;
    left: 0.4rem;
    height: 2px;
    background: linear-gradient(90deg, var(--gold), var(--saffron));
    border-radius: 2rem;
    content: "";
    transform: scaleX(0);
    transform-origin: center;
}

.site-header .nav-link:hover::after,
.site-header .nav-link.active::after {
    transform: scaleX(1);
}

.navbar-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    margin-left: clamp(0.3rem, 0.8vw, 0.8rem);
    gap: 0.45rem;
}

.header-login-button,
.header-register-button {
    min-height: 2.65rem;
    padding-inline: 1rem;
    font-family: var(--font-display);
    font-size: 0.9rem;
}

.header-member-toggle {
    display: flex;
    width: clamp(10.4rem, 12vw, 12.25rem);
    min-height: 2.85rem;
    align-items: center;
    padding: 0.3rem 0.55rem 0.3rem 0.35rem;
    color: var(--text);
    background: #ffffff;
    border: 1px solid rgb(143 0 31 / 28%);
    border-radius: 999px;
    box-shadow: 0 0.35rem 1rem rgb(79 26 39 / 7%);
    gap: 0.45rem;
}

.header-member-toggle:hover,
.header-member-toggle[aria-expanded="true"] {
    color: var(--primary);
    background: #fff8f4;
    border-color: var(--primary);
    box-shadow: 0 0.55rem 1.35rem rgb(143 0 31 / 11%);
}

.header-member-avatar {
    display: grid;
    width: 2.1rem;
    height: 2.1rem;
    flex: 0 0 auto;
    place-items: center;
    color: #ffffff;
    background: linear-gradient(145deg, var(--primary-dark), var(--primary));
    border: 2px solid #e6b64c;
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 800;
}

.header-member-avatar.is-large {
    width: 3.1rem;
    height: 3.1rem;
    font-size: 1.25rem;
}

.header-member-toggle-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: flex-start;
    flex-direction: column;
    line-height: 1.12;
}

.header-member-toggle-copy small,
.header-member-toggle-copy strong {
    width: 100%;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-member-toggle-copy small {
    color: var(--muted);
    font-size: 0.53rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.header-member-toggle-copy strong {
    font-size: 0.72rem;
}

.header-member-toggle > i {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.65rem;
}

.header-logout-icon-form {
    flex: 0 0 auto;
    margin: 0;
}

.header-logout-icon-form button {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    padding: 0;
    color: var(--primary);
    background: #fff7f5;
    border: 1px solid rgb(143 0 31 / 30%);
    border-radius: 50%;
    font-size: 1rem;
}

.header-logout-icon-form button:hover,
.header-logout-icon-form button:focus-visible {
    color: #ffffff;
    background: var(--primary);
    border-color: var(--primary);
}

.header-member-menu {
    width: min(22rem, calc(100vw - 2rem));
    margin-top: 0.65rem !important;
    padding: 0.75rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: 0 1.25rem 3.2rem rgb(62 21 32 / 18%);
}

.header-member-summary {
    display: flex;
    align-items: flex-start;
    padding: 0.65rem;
    background: linear-gradient(135deg, #fff9f2, #fff2f3);
    border: 1px solid rgb(216 154 34 / 22%);
    border-radius: 0.8rem;
    gap: 0.7rem;
}

.header-member-summary > div {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    flex-direction: column;
}

.header-member-summary strong,
.header-member-summary small {
    max-width: 15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-member-summary strong {
    color: var(--primary-dark);
    font-family: var(--font-display);
    font-size: 1.08rem;
}

.header-member-summary small {
    color: var(--muted);
    font-size: 0.68rem;
}

.header-status-badge {
    display: inline-flex;
    align-items: center;
    margin-top: 0.4rem;
    padding: 0.24rem 0.48rem;
    color: #805900;
    background: #fff4d5;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    gap: 0.25rem;
}

.header-status-badge.status-approved {
    color: #11633f;
    background: #e8f7ef;
}

.header-status-badge.status-rejected,
.header-status-badge.status-suspended {
    color: #9d2017;
    background: #fff0ee;
}

.header-menu-links {
    display: grid;
    margin-top: 0.55rem;
    gap: 0.18rem;
}

.header-menu-links > a {
    display: flex;
    min-height: 3.45rem;
    align-items: center;
    padding: 0.5rem 0.6rem;
    color: var(--text);
    border-radius: 0.7rem;
    gap: 0.65rem;
}

.header-menu-links > a:hover,
.header-menu-links > a.active {
    color: var(--primary);
    background: var(--primary-soft);
}

.header-menu-links > a > i {
    display: grid;
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 50%;
}

.header-menu-links > a > span {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.header-menu-links strong {
    font-size: 0.75rem;
}

.header-menu-links small {
    color: var(--muted);
    font-size: 0.62rem;
}

.header-create-profile-form {
    margin-top: 0.45rem;
}

.header-create-profile-form button {
    display: flex;
    width: 100%;
    min-height: 2.65rem;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 0.68rem;
    font-size: 0.76rem;
    font-weight: 800;
    gap: 0.45rem;
}

.header-create-profile-form button:hover {
    background: var(--primary-dark);
}

.site-header .navbar-toggler {
    border-color: rgb(143 0 31 / 28%);
}

.site-header .navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgb(143 0 31 / 10%);
}

@media (max-width: 1399.98px) {
    .header-navbar-inner {
        padding-inline: 0.75rem;
        gap: 0.55rem;
    }

    .site-logo {
        width: 10.5rem;
    }

    .header-profile-search {
        width: 16rem;
        flex-basis: 16rem;
    }

    .site-header .nav-link {
        padding-inline: 0.38rem !important;
        font-size: 0.68rem;
    }

    .navbar-actions {
        margin-left: 0.25rem;
    }

    .header-member-toggle {
        width: 10.4rem;
    }
}

@media (max-width: 1199.98px) {
    .site-header .navbar {
        min-height: 4.8rem;
    }

    .header-navbar-inner {
        flex-wrap: wrap;
    }

    .site-logo-link {
        order: 1;
    }

    .navbar-toggler {
        order: 2;
        margin-left: auto;
    }

    .header-profile-search {
        width: 100%;
        flex: 1 0 100%;
        order: 3;
    }

    .site-header .navbar-collapse {
        width: 100%;
        flex-basis: 100%;
        order: 4;
        margin-top: 0.25rem;
        padding: 0.8rem;
        background: #ffffff;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-lg);
    }

    .site-header .navbar-nav {
        align-items: stretch !important;
        margin-left: 0;
    }

    .site-header .nav-link {
        padding: 0.55rem !important;
        font-size: 0.78rem;
    }

    .site-header .nav-link::after {
        display: none;
    }

    .navbar-actions {
        align-items: stretch;
        margin: 0.55rem 0 0;
        padding-top: 0.7rem;
        border-top: 1px solid var(--border);
    }

    .header-member-dropdown {
        flex: 1;
    }

    .header-member-toggle {
        width: 100%;
    }

    .header-member-menu {
        position: static !important;
        width: 100%;
        margin-top: 0.55rem !important;
        transform: none !important;
    }
}

@media (max-width: 575.98px) {
    .site-logo {
        width: 9.75rem;
    }

    .navbar-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 2.75rem;
    }

    .header-login-button,
    .header-register-button {
        width: 100%;
    }

    .header-search-control input {
        font-size: 0.72rem;
    }

    .header-member-menu {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header .nav-link::after {
        transition: none;
    }
}


/* Final notification + message actions */

.header-quick-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.header-quick-action {
    position: relative;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: #8f001f;
    background: #ffffff;
    border: 1px solid rgba(143, 0, 31, 0.24);
    border-radius: 50%;
    text-decoration: none;
    box-shadow: 0 5px 16px rgba(79, 26, 39, 0.06);
    transition: 0.2s ease;
}

.header-quick-action:hover,
.header-quick-action:focus-visible {
    color: #ffffff;
    background: #8f001f;
    border-color: #8f001f;
    transform: translateY(-1px);
}

.header-quick-action i {
    font-size: 1.05rem;
}

.header-quick-badge {
    position: absolute;
    top: -3px;
    right: -2px;
    display: grid;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    place-items: center;
    color: #ffffff;
    background: #b10a36;
    border: 2px solid #ffffff;
    border-radius: 999px;
    font-size: 0.56rem;
    font-weight: 900;
    line-height: 1;
}

@media (max-width: 1199.98px) {
    .header-quick-actions {
        order: 2;
        margin-left: auto;
    }

    .site-header .navbar-toggler {
        order: 3;
        margin-left: 0.35rem;
    }

    .header-profile-search {
        order: 4;
    }
}

@media (max-width: 575.98px) {
    .header-quick-actions {
        gap: 5px;
    }

    .header-quick-action {
        width: 39px;
        height: 39px;
    }

    .header-quick-action i {
        font-size: 0.98rem;
    }
}

/* Logout menu item */
.header-menu-divider {
    width: 100%;
    height: 1px;
    margin: 0.55rem 0 0.45rem;
    background: var(--border);
}

.header-logout-menu-form {
    width: 100%;
    margin: 0;
}

.header-logout-menu-form button {
    display: flex;
    width: 100%;
    min-height: 3rem;
    align-items: center;
    padding: 0.5rem 0.6rem;
    color: #9d2017;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.7rem;
    text-align: left;
    gap: 0.65rem;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.header-logout-menu-form button:hover,
.header-logout-menu-form button:focus-visible {
    color: var(--primary);
    background: #fff3f3;
    border-color: rgb(143 0 31 / 12%);
}

.header-logout-menu-form button > i {
    display: grid;
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    place-items: center;
    color: #9d2017;
    background: #fff0ee;
    border-radius: 50%;
    font-size: 0.88rem;
}

.header-logout-menu-form button:hover > i,
.header-logout-menu-form button:focus-visible > i {
    color: #ffffff;
    background: var(--primary);
}

.header-logout-menu-form button > span {
    display: flex;
    min-width: 0;
    flex-direction: column;
    line-height: 1.15;
}

.header-logout-menu-form button strong {
    color: inherit;
    font-size: 0.75rem;
    font-weight: 800;
}

.header-logout-menu-form button small {
    margin-top: 0.12rem;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 600;
}

@media (max-width: 575.98px) {
    .header-logout-menu-form button {
        min-height: 2.9rem;
    }
}

/* Bootstrap-independent profile menu fallback. */
.header-member-menu.is-open {
    display: block !important;
}


/* Header readability update: larger search field and navigation labels */
@media (min-width: 1400px) {
    .header-navbar-inner {
        gap: clamp(0.65rem, 1vw, 1.1rem);
    }

    .header-profile-search {
        width: clamp(21rem, 23vw, 25rem);
        flex: 0 1 clamp(21rem, 23vw, 25rem);
    }

    .header-search-control {
        height: 3.15rem;
    }

    .header-search-control input {
        font-size: 0.86rem;
        padding-inline: 0.75rem;
    }

    .header-search-control button {
        width: 6.4rem;
        height: 3.15rem;
        font-size: 0.82rem;
    }

    .site-header .nav-link {
        padding-inline: clamp(0.42rem, 0.48vw, 0.7rem) !important;
        font-size: clamp(0.78rem, 0.82vw, 0.9rem);
    }
}

/* Compact desktop/laptop: prioritize legible labels without clipping the profile menu. */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .header-navbar-inner {
        padding-inline: 0.85rem;
        gap: 0.48rem;
    }

    .site-logo {
        width: 10.75rem;
    }

    .header-profile-search {
        width: 18rem;
        flex: 0 1 18rem;
    }

    .header-search-control {
        height: 3rem;
    }

    .header-search-control input {
        font-size: 0.8rem;
        padding-inline: 0.65rem;
    }

    .header-search-control button {
        width: 5.9rem;
        height: 3rem;
        font-size: 0.76rem;
    }

    .header-search-control > i {
        width: 2.15rem;
        height: 2.15rem;
        font-size: 0.84rem;
    }

    .site-header .nav-link {
        padding-inline: 0.3rem !important;
        font-size: 0.73rem;
    }

    .navbar-actions {
        gap: 0.35rem;
        margin-left: 0.2rem;
    }

    .header-member-toggle {
        width: 9.6rem;
    }
}

/* Mobile: keep the search field comfortably readable and full-width. */
@media (max-width: 1199.98px) {
    .header-search-control {
        min-height: 3rem;
        height: 3.1rem;
    }

    .header-search-control input {
        font-size: 0.88rem;
    }

    .header-search-control button {
        width: 6.1rem;
        height: 3.1rem;
        font-size: 0.82rem;
    }
}

