:root {
    --teal-primary: #0D9488;
    --teal-light: #14B8A6;
    --teal-dark: #0F766E;
    --off-white: #F8F9FA;
    --pure-white: #FFFFFF;
    --charcoal: #2D3748;
    --slate-600: #475569;
    --slate-800: #1E293B;
    --slate-200: #E2E8F0;
}

/* Bootstrap default font stack */
:root {
    --header-bootstrap-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

.header {
    background: var(--pure-white);
    border-bottom: 1px solid var(--slate-200);
    position: sticky;
    top: 0;
    z-index: 1000;
    font-family: var(--bs-body-font-family);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.header-navbar {
    min-height: 74px;
    background: transparent;
}

.header-shell {
    width: 100%;
    max-width: 100%;
    padding-left: clamp(1rem, 3vw, 3rem);
    padding-right: clamp(1rem, 3vw, 3rem);
    gap: 1rem;
    position: relative;
}

.logo-container {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    min-width: 0;
}

.logo-main {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    background: var(--teal-bg, #F0FDFA);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-main-fallback::before {
    content: attr(data-logo-initial);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--teal-primary);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.school-name {
    font-size: 1.35rem;
    font-weight: 400;
    color: var(--charcoal);
    line-height: 1.15;
}

.school-subtitle {
    font-size: 0.8rem;
    color: var(--slate-600);
    font-weight: 400;
    line-height: 1.2;
    white-space: nowrap;
}

.header-toggler {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 16px;
    background: var(--teal-bg, #F0FDFA);
    border: 1px solid rgba(13, 148, 136, 0.18) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.header-toggler:hover,
.header-toggler[aria-expanded="true"] {
    background: color-mix(in srgb, var(--teal-bg, #F0FDFA) 72%, var(--pure-white));
    border-color: rgba(13, 148, 136, 0.28) !important;
}

.header-toggler:focus-visible {
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18) !important;
}

.header-toggler-line {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--teal-primary);
    display: block;
    transition: transform 0.25s ease, opacity 0.2s ease;
    transform-origin: center;
}

.header-mobile-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.header-mobile-cart {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid rgba(13, 148, 136, 0.2);
    background: var(--teal-bg, #F0FDFA);
    color: var(--teal-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-decoration: none;
}

.header-mobile-cart i {
    font-size: 1rem;
}

.header-mobile-cart .cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 19px;
    height: 19px;
    font-size: 0.68rem;
    padding: 0 5px;
}

.header-mobile-cart.active {
    background: var(--teal-primary);
    color: #fff;
}

.header-toggler[aria-expanded="true"] .header-toggler-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.header-toggler[aria-expanded="true"] .header-toggler-line:nth-child(2) {
    opacity: 0;
}

.header-toggler[aria-expanded="true"] .header-toggler-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.header-nav-list {
    padding: 0.85rem 0;
    gap: 0.2rem;
}

.header-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    color: var(--slate-600);
    font-weight: 400;
    font-size: 0.82rem;
    padding: 0.7rem 0.95rem !important;
    border-radius: 999px;
    transition: color 0.25s ease, background-color 0.25s ease;
    white-space: nowrap;
}

.header-link,
.header-link:hover,
.header-link.active,
.header-link-label,
.header-link i,
.header-link-accent {
    font-family: var(--header-bootstrap-font) !important;
    font-weight: 400 !important;
}

.header-link:hover,
.header-link.active {
    color: var(--teal-primary) !important;
    background: var(--teal-bg, #F0FDFA);
}

.header-link::after {
    content: "";
    position: absolute;
    left: 0.95rem;
    right: 0.95rem;
    bottom: 0.35rem;
    height: 2px;
    border-radius: 999px;
    background: var(--teal-primary);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s ease;
}

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

.header-link i {
    font-size: 0.95rem;
}

.header-link-label {
    position: relative;
    display: inline-block;
}

.header-link-spinner {
    display: none;
    align-items: center;
    gap: 3px;
    margin-left: 2px;
}

.header-link-spinner span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.35;
    animation: headerDotPulse 0.9s infinite ease-in-out;
}

.header-link-spinner span:nth-child(2) {
    animation-delay: 0.15s;
}

.header-link-spinner span:nth-child(3) {
    animation-delay: 0.3s;
}

.header-link.loading {
    color: var(--teal-primary) !important;
    background: var(--teal-bg, #F0FDFA);
    pointer-events: none;
}

.header-link.loading .header-link-spinner {
    display: inline-flex;
}

.header-link-accent {
    border: 1px solid rgba(13, 148, 136, 0.15);
}

.cart-count {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    background: var(--teal-primary);
    color: var(--pure-white);
    border-radius: 999px;
    padding: 0 7px;
    font-size: 0.74rem;
    font-weight: 400;
    line-height: 1;
}

.order-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 21px;
    height: 21px;
    background: #EF4444;
    color: var(--pure-white);
    border-radius: 999px;
    padding: 0 7px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
}

.header-account-item {
    position: relative;
}

.header-account-toggle {
    border: 1px solid rgba(13, 148, 136, 0.18);
    background: var(--teal-bg, #F0FDFA);
    color: var(--teal-primary) !important;
    box-shadow: 0 8px 20px rgba(13, 148, 136, 0.08);
    cursor: pointer;
}

.header-account-toggle::after {
    display: none;
}

.header-account-chevron {
    font-size: 0.72rem !important;
    transition: transform 0.2s ease;
}

.header-account-toggle[aria-expanded="true"] .header-account-chevron {
    transform: rotate(180deg);
}

.header-account-toggle:hover,
.header-account-toggle:focus,
.header-account-toggle[aria-expanded="true"] {
    border-color: rgba(13, 148, 136, 0.32);
    background: color-mix(in srgb, var(--teal-bg, #F0FDFA) 72%, var(--pure-white));
    color: var(--teal-dark) !important;
    box-shadow: 0 10px 24px rgba(13, 148, 136, 0.13);
}

.header-account-menu {
    min-width: 210px;
    padding: 0.45rem;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 12px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
}

.header-account-menu-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border-radius: 9px;
    color: var(--slate-800);
    font-size: 0.86rem;
    padding: 0.62rem 0.7rem;
}

.header-account-menu-item i {
    color: var(--teal-primary);
    font-size: 0.96rem;
}

.header-account-menu-item:hover,
.header-account-menu-item:focus {
    background: var(--teal-bg, #F0FDFA);
    color: var(--teal-primary);
}

.header-account-logout,
.header-account-logout i {
    color: #DC2626;
}

.header-logout-link {
    border: 0;
    background: transparent;
    text-align: left;
}

.header-logout-link,
.header-logout-link i {
    color: #DC2626 !important;
}

.header-logout-link:hover,
.header-logout-link:focus {
    color: #DC2626 !important;
    background: #FEF2F2;
}

.header-mobile-section-label {
    display: none;
}

.particles-container,
.mobile-particles-container {
    display: none;
}

@keyframes headerDotPulse {
    0%, 80%, 100% {
        transform: scale(0.75);
        opacity: 0.25;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (min-width: 992px) {
    .header-mobile-actions {
        display: none;
    }

    .header-shell {
        padding-left: 4vw;
        padding-right: 4vw;
    }

    .header-collapse {
        display: flex !important;
        flex-basis: auto;
    }

    .header-nav-list {
        padding: 0;
    }

    .header-link {
        font-size: 0.82rem;
        font-weight: 400 !important;
        padding: 0.62rem 0.82rem !important;
    }

    .header-account-toggle {
        max-width: 190px;
    }

    .header-account-toggle .header-link-label {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-link i {
        font-size: 0.95rem;
    }

    .header-link-label {
        font-weight: 400 !important;
    }
}

@media (max-width: 991.98px) {
    .header-navbar {
        min-height: 70px;
    }

    .header-mobile-cart {
        display: inline-flex;
    }

    .header-collapse {
        position: absolute;
        top: calc(100% + 10px);
        right: clamp(1rem, 3vw, 3rem);
        width: min(230px, calc(100vw - 2rem));
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid rgba(226, 232, 240, 0.88);
        border-radius: 18px;
        margin-top: 0;
        padding: 14px 10px;
        box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
        backdrop-filter: blur(14px);
        z-index: 1002;
    }

    .header-nav-list {
        align-items: stretch !important;
        gap: 0.26rem !important;
        margin-left: 0 !important;
        padding: 0;
    }

    .header-mobile-section-label {
        display: block;
        padding: 0.65rem 0.68rem 0.18rem;
        color: #94a3b8;
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.06em;
        line-height: 1;
        text-transform: uppercase;
    }

    .header-mobile-section-spaced {
        margin-top: 0.55rem;
        padding-top: 0.9rem;
        border-top: 1px solid #e2e8f0;
    }

    .header-nav-list .nav-item {
        width: 100%;
    }

    .header-link {
        width: 100%;
        justify-content: flex-start;
        border-radius: 10px;
        padding: 0.72rem 0.68rem !important;
        font-size: 0.82rem;
        color: var(--slate-800);
    }

    .header-link i {
        min-width: 20px;
        color: var(--teal-dark);
    }

    .header-account-menu {
        position: static !important;
        transform: none !important;
        width: 100%;
        min-width: 0;
        margin-top: 0.25rem !important;
        box-shadow: none;
    }

    .header-link-accent {
        border: 0;
    }

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

    .header-link-label::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: -0.3rem;
        height: 2px;
        border-radius: 999px;
        background: var(--teal-primary);
        transform: scaleX(0);
        transform-origin: center;
        transition: transform 0.25s ease;
    }

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

@media (max-width: 575.98px) {
    .header-shell {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .logo-container {
        max-width: calc(100% - 60px);
    }

    .school-name {
        font-size: 1.1rem;
    }

    .school-subtitle {
        display: block;
        font-size: 0.68rem;
        line-height: 1.2;
        white-space: normal;
    }

    .logo-main {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }
}
