/* =========================================================================
   Site header (markup in includes/header.php)
   Desktop: logo · links with dropdown panels · search · cart · bell · account
   Up to 1100px: logo · search · cart · bell · menu button → slide-in drawer
   Note: style.css forces square buttons with !important, so rounded buttons here use !important too.
   ========================================================================= */
/* Colours are shared with the drawer, which lives outside the <nav>. */
.bnav,
.bnav-drawer {
    --bnav-navy: #021A54;
    --bnav-navy-2: #0b2f86;
    --bnav-orange: #f97316;
    --bnav-orange-2: #ea580c;
    --bnav-ink: #0f172a;
    --bnav-muted: #64748b;
    --bnav-line: #e2e8f0;
    --bnav-soft: #f8fafc;
    --bnav-hover: #eef2ff;
}

.bnav {
    --bnav-navy: #021A54;
    --bnav-navy-2: #0b2f86;
    --bnav-orange: #f97316;
    --bnav-orange-2: #ea580c;
    --bnav-ink: #0f172a;
    --bnav-muted: #64748b;
    --bnav-line: #e2e8f0;
    --bnav-soft: #f8fafc;
    --bnav-hover: #eef2ff;
    --bnav-h: 68px;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid transparent;
    box-shadow: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.bnav.is-scrolled {
    border-bottom-color: var(--bnav-line);
    box-shadow: 0 10px 28px -18px rgba(2, 26, 84, 0.35);
}

.bnav__bar {
    display: flex;
    align-items: center;
    gap: 24px;
    width: min(100% - 32px, 1320px);
    height: var(--bnav-h);
    margin: 0 auto;
}

.bnav__logo {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.bnav__logo .site-logo,
.bnav-drawer__head .site-logo {
    display: block;
    width: auto;
    height: 34px;
    max-width: 160px;
    object-fit: contain;
}

/* ---------- Desktop links ---------- */
.bnav__links {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bnav__links > li {
    position: relative;
}

.bnav .bnav__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 12px;
    border: none;
    border-radius: 10px !important;
    background: transparent;
    color: #334155;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.bnav .bnav__link i {
    font-size: 10px;
    color: #94a3b8;
    transition: transform 0.2s ease;
}

.bnav .bnav__link:hover,
.bnav__dd.is-open > .bnav__link {
    background: var(--bnav-soft);
    color: var(--bnav-navy);
}

.bnav__dd.is-open > .bnav__link i {
    transform: rotate(180deg);
}

.bnav .bnav__link.is-active {
    color: var(--bnav-navy);
}

.bnav .bnav__link.is-active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -14px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--bnav-orange);
}

.bnav__links > li > .bnav__link.is-active {
    position: relative;
}

/* Dropdown panels */
.bnav__dd {
    position: relative;
}

.bnav__panel {
    position: absolute;
    top: calc(100% + 10px);
    left: -8px;
    z-index: 20;
    display: grid;
    gap: 2px;
    min-width: 300px;
    padding: 8px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--bnav-line);
    box-shadow: 0 24px 48px -20px rgba(2, 26, 84, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

/* Invisible bridge so the pointer can move from the button to the panel. */
.bnav__panel::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -12px;
    height: 12px;
}

.bnav__dd.is-open > .bnav__panel {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.bnav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    transition: background 0.12s ease;
}

.bnav-item:hover,
.bnav-item:focus-visible {
    background: var(--bnav-soft);
    outline: none;
}

.bnav-item__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border-radius: 10px;
    background: var(--bnav-hover);
    color: var(--bnav-navy);
    font-size: 14px;
}

.bnav-item:hover .bnav-item__icon {
    background: var(--bnav-navy);
    color: #fff;
}

.bnav-item__text {
    display: grid;
    min-width: 0;
}

.bnav-item__text strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--bnav-ink);
}

.bnav-item__text small {
    font-size: 12px;
    color: var(--bnav-muted);
}

/* ---------- Right-hand actions ---------- */
.bnav__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.bnav .bnav__search {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 260px;
    height: 42px;
    padding: 0 8px 0 14px;
    border: 1px solid var(--bnav-line);
    border-radius: 12px !important;
    background: var(--bnav-soft);
    color: var(--bnav-muted);
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.bnav .bnav__search:hover {
    border-color: #cbd5e1;
    background: #fff;
}

.bnav__search span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bnav__search kbd {
    padding: 2px 6px;
    border: 1px solid var(--bnav-line);
    border-radius: 6px;
    background: #fff;
    color: var(--bnav-muted);
    font-family: inherit;
    font-size: 11px;
}

.bnav .bnav__icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    border-radius: 12px !important;
    background: transparent;
    color: #334155;
    font-size: 17px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.bnav .bnav__icon:hover,
.bnav .bnav__icon.is-active {
    background: var(--bnav-soft);
    color: var(--bnav-navy);
}

.bnav .bnav__icon--search {
    display: none;
}

.bnav__badge {
    position: absolute;
    top: 4px;
    right: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.bnav__badge[hidden] {
    display: none !important;
}

.bnav__badge--cart {
    background: var(--bnav-orange);
}

/* Account button + panel */
.bnav .bnav__user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    margin-left: 4px;
    padding: 0 10px 0 4px;
    border: 1px solid var(--bnav-line);
    border-radius: 999px !important;
    background: #fff;
    color: var(--bnav-ink);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bnav .bnav__user:hover,
.bnav__dd--account.is-open .bnav__user {
    border-color: #cbd5e1;
    box-shadow: 0 6px 16px -10px rgba(2, 26, 84, 0.4);
}

.bnav__user i {
    font-size: 10px;
    color: #94a3b8;
}

.bnav__user-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bnav__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bnav-navy), var(--bnav-navy-2));
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.bnav__avatar--lg {
    width: 42px;
    height: 42px;
    font-size: 16px;
}

.bnav__panel--account {
    left: auto;
    right: 0;
    min-width: 270px;
    padding: 0;
    gap: 0;
    overflow: hidden;
}

.bnav__account-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    border-bottom: 1px solid var(--bnav-line);
}

.bnav__account-head > span:last-child {
    display: grid;
    min-width: 0;
}

.bnav__account-head strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    color: var(--bnav-ink);
}

.bnav__account-head small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--bnav-muted);
}

.bnav__group {
    display: grid;
    padding: 6px;
    border-bottom: 1px solid #f1f5f9;
}

.bnav__group-title {
    padding: 6px 10px 4px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.bnav__group a,
.bnav__logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    color: #334155;
    font-size: 14px;
    text-decoration: none;
}

.bnav__group a i,
.bnav__logout i {
    width: 16px;
    text-align: center;
    color: var(--bnav-muted);
}

.bnav__group a:hover {
    background: var(--bnav-soft);
    color: var(--bnav-navy);
}

.bnav__logout {
    margin: 6px;
    color: #dc2626;
}

.bnav__logout i {
    color: #dc2626;
}

.bnav__logout:hover {
    background: #fef2f2;
}

/* Guest buttons */
.bnav__login {
    display: inline-flex;
    align-items: center;
    height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    color: var(--bnav-ink);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.bnav__login:hover {
    background: var(--bnav-soft);
}

.bnav__register {
    display: inline-flex;
    align-items: center;
    height: 42px;
    padding: 0 18px;
    border-radius: 12px;
    background: var(--bnav-orange);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 18px -10px rgba(249, 115, 22, 0.8);
    transition: background 0.15s ease;
}

.bnav__register:hover {
    background: var(--bnav-orange-2);
    color: #fff;
}

/* Menu (burger) button */
.bnav .bnav__burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    padding: 0 11px;
    border: none;
    border-radius: 12px !important;
    background: transparent;
    cursor: pointer;
}

.bnav .bnav__burger:hover {
    background: var(--bnav-soft);
}

.bnav__burger span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--bnav-ink);
}

.bnav__burger span:nth-child(2) {
    width: 70%;
}

/* ---------- Drawer ---------- */
.bnav-drawer[hidden] {
    display: none;
}

.bnav-drawer {
    position: fixed;
    inset: 0;
    z-index: 2500;
}

.bnav-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bnav-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    width: min(88vw, 360px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    box-shadow: -24px 0 48px -24px rgba(2, 26, 84, 0.45);
    transform: translateX(100%);
    transition: transform 0.22s ease;
}

.bnav-drawer.is-open .bnav-drawer__backdrop {
    opacity: 1;
}

.bnav-drawer.is-open .bnav-drawer__panel {
    transform: none;
}

body.bnav-drawer-open {
    overflow: hidden;
}

.bnav-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
    border-bottom: 1px solid var(--bnav-line);
}

.bnav-drawer .bnav-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50% !important;
    background: var(--bnav-soft);
    color: var(--bnav-ink);
    font-size: 17px;
    cursor: pointer;
}

.bnav-drawer__user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 14px 6px;
    padding: 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, #021A54, #0b2f86);
    color: #fff;
    text-decoration: none;
}

.bnav-drawer__user .bnav__avatar {
    background: rgba(255, 255, 255, 0.18);
}

.bnav-drawer__user > span:nth-child(2) {
    display: grid;
    flex: 1;
    min-width: 0;
}

.bnav-drawer__user strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
}

.bnav-drawer__user small {
    font-size: 12px;
    color: #c7d2fe;
}

.bnav-drawer__auth {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 14px 14px 6px;
}

.bnav-drawer__auth .bnav__login {
    justify-content: center;
    border: 1px solid var(--bnav-line);
}

.bnav-drawer__auth .bnav__register {
    justify-content: center;
}

.bnav-drawer__nav {
    display: grid;
    padding: 6px 10px 10px;
}

.bnav-drawer__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 10px;
    border-radius: 12px;
    color: #1e293b;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    list-style: none;
}

.bnav-drawer__link::-webkit-details-marker {
    display: none;
}

.bnav-drawer__link > i:first-child {
    width: 20px;
    text-align: center;
    color: var(--bnav-muted);
}

.bnav-drawer__link:hover {
    background: var(--bnav-soft);
}

.bnav-drawer__link.is-active {
    background: var(--bnav-hover);
    color: var(--bnav-navy);
}

.bnav-drawer__link.is-active > i:first-child {
    color: var(--bnav-navy);
}

.bnav-drawer__chev {
    margin-left: auto;
    font-size: 11px;
    color: #94a3b8;
    transition: transform 0.2s ease;
}

.bnav-drawer__group[open] .bnav-drawer__chev {
    transform: rotate(180deg);
}

.bnav-drawer__sub {
    display: grid;
    margin: 0 0 6px 30px;
    padding-left: 12px;
    border-left: 2px solid var(--bnav-line);
}

.bnav-drawer__sub a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    color: #475569;
    font-size: 14px;
    text-decoration: none;
}

.bnav-drawer__sub a i {
    width: 16px;
    text-align: center;
    color: #94a3b8;
}

.bnav-drawer__sub a:hover {
    background: var(--bnav-soft);
    color: var(--bnav-navy);
}

.bnav-drawer__label {
    margin: 12px 10px 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.bnav-drawer__logout {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: auto 14px calc(14px + env(safe-area-inset-bottom));
    padding: 12px;
    border-radius: 12px;
    background: #fef2f2;
    color: #dc2626;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
    .bnav .bnav__search {
        width: 200px;
    }

    .bnav__search kbd {
        display: none;
    }
}

@media (max-width: 1100px) {
    .bnav {
        --bnav-h: 60px;
    }

    .bnav__links,
    .bnav .bnav__search,
    .bnav__dd--account,
    .bnav__actions > .bnav__login,
    .bnav__actions > .bnav__register {
        display: none !important;
    }

    .bnav .bnav__icon--search,
    .bnav .bnav__burger {
        display: inline-flex;
    }
}

@media (max-width: 640px) {
    .bnav__bar {
        gap: 8px;
        width: calc(100% - 20px);
    }

    .bnav__logo .site-logo {
        height: 30px;
    }

    .bnav__actions {
        gap: 0;
    }

    .bnav .bnav__icon,
    .bnav .bnav__burger {
        width: 40px;
        height: 40px;
        font-size: 17px;
    }

    /* The bottom bar already has Alerts and Cart on phones. */
    .bnav .bnav__icon--bell {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bnav__panel,
    .bnav-drawer__panel,
    .bnav-drawer__backdrop {
        transition: none;
    }
}

/* Height of the pinned header, for other sticky elements to sit below it. */
:root {
    --bnav-offset: 68px;
}

@media (max-width: 1100px) {
    :root {
        --bnav-offset: 60px;
    }
}

/* The header cart (with its count) replaces the old floating cart button. */
.cart-fab {
    display: none !important;
}

.bnav-drawer .bnav-drawer__close {
    border: none !important;
}

.bnav-drawer .bnav-drawer__close:focus-visible,
.bnav .bnav__icon:focus-visible,
.bnav .bnav__link:focus-visible,
.bnav .bnav__user:focus-visible,
.bnav .bnav__search:focus-visible {
    outline: 2px solid var(--bnav-navy, #021A54);
    outline-offset: 2px;
}

/* =========================================================================
   Support chat (button + panel, markup in includes/footer.php)
   Overrides the older .chat-* rules in style.css.
   ========================================================================= */
.chat-toggle-btn {
    right: 24px !important;
    bottom: 24px !important;
    gap: 10px;
    width: auto !important;
    height: 52px !important;
    padding: 0 20px 0 16px !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, #021A54 0%, #0b2f86 100%) !important;
    color: #fff;
    font-family: inherit;
    font-size: 15px !important;
    font-weight: 700;
    box-shadow: 0 14px 30px -12px rgba(2, 26, 84, 0.6) !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.chat-toggle-btn i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f97316;
    font-size: 14px;
}

.chat-toggle-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 18px 34px -12px rgba(2, 26, 84, 0.7) !important;
}

.chat-toggle-btn .chat-notification-badge {
    top: -4px;
    right: -2px;
    border-radius: 999px;
}

/* While the panel is open the button turns into a small close button. */
.chat-widget.show ~ .chat-toggle-btn .chat-toggle-btn__label {
    display: none;
}

.chat-widget.show ~ .chat-toggle-btn {
    width: 52px !important;
    padding: 0 !important;
    justify-content: center;
}

.chat-widget.show ~ .chat-toggle-btn i {
    background: transparent;
}

.chat-widget.show ~ .chat-toggle-btn i::before {
    content: "\f00d";
}

.chat-widget {
    right: 24px !important;
    bottom: 88px !important;
    width: 360px !important;
    height: min(520px, calc(100vh - 140px)) !important;
    border-radius: 18px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 30px 60px -20px rgba(2, 26, 84, 0.45) !important;
}

.chat-widget.show {
    animation: support-pop 0.18s ease;
}

@keyframes support-pop {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.chat-widget-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 14px 14px 16px !important;
    background: linear-gradient(135deg, #021A54 0%, #0b2f86 100%) !important;
    color: #fff !important;
}

.chat-widget-title {
    display: flex !important;
    align-items: center;
    gap: 10px !important;
    flex: 1;
    min-width: 0;
}

.chat-widget-title__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #f97316;
    color: #fff;
    font-size: 16px;
}

.chat-widget-title__text {
    display: grid;
    min-width: 0;
    line-height: 1.25;
}

.chat-widget-title__text strong {
    font-size: 15px;
    color: #fff;
}

.chat-widget-title__text small {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #c7d2fe;
}

.chat-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.chat-widget-open-full,
.chat-widget .chat-widget-close {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 34px !important;
    height: 34px !important;
    border: none !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
    font-size: 14px;
    text-decoration: none;
}

.chat-widget-open-full:hover,
.chat-widget .chat-widget-close:hover {
    background: rgba(255, 255, 255, 0.24) !important;
}

.chat-widget-body {
    background: #f8fafc !important;
}

.chat-message.support .message-avatar {
    background: #021A54 !important;
    color: #fff !important;
}

.chat-message.support .message-text {
    border-radius: 4px 14px 14px 14px !important;
    background: #fff !important;
    border: 1px solid #e2e8f0;
    color: #0f172a !important;
}

.chat-message.user .message-text {
    border-radius: 14px 4px 14px 14px !important;
    background: #021A54 !important;
    color: #fff !important;
}

.chat-widget-footer {
    border-top: 1px solid #e2e8f0 !important;
    background: #fff !important;
}

.chat-widget #chatInput {
    border-radius: 999px !important;
    font-size: 15px;
}

.chat-widget .chat-send-btn {
    border-radius: 50% !important;
    background: #f97316 !important;
    color: #fff !important;
}

.chat-widget .chat-send-btn:hover {
    background: #ea580c !important;
}

/* Phones: round icon button sitting above the bottom bar; the panel fills the width. */
@media (max-width: 768px) {
    .chat-toggle-btn {
        right: 14px !important;
        bottom: calc(80px + env(safe-area-inset-bottom)) !important;
        width: 52px !important;
        padding: 0 !important;
        justify-content: center;
    }

    .chat-toggle-btn .chat-toggle-btn__label {
        display: none;
    }

    .chat-toggle-btn i {
        width: auto;
        height: auto;
        background: transparent;
        font-size: 19px;
    }

    .chat-widget {
        right: 10px !important;
        left: 10px !important;
        bottom: calc(142px + env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-width: none !important;
        height: min(480px, calc(100vh - 230px)) !important;
    }
}
