/* === NAVIGATION - SIDEBAR === */

/* Toggle button (mobile) */
.cw-nav-toggle {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: none;
}

/* Page layout wrapper */
.cw-page-wrapper {
    display: flex;
    height: calc(100vh - 80px);
    overflow: hidden;
}

/* Main sidebar container */
.cw-sidebar {
    width: 250px !important;
    flex-shrink: 0 !important;
    background: var(--cwh-white) !important;
    border-right: 1px solid var(--cwh-middle-blue) !important;
    overflow-y: auto !important;
    height: 100% !important;
    z-index: 10 !important;
    min-height: 0 !important;
}

/* Navigation wrapper */
.cw-sidebar-nav {
    padding: 8px 0 24px;
}

/* Section header */
.cw-sb-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--cwh-font-family);
    font-size: 10px;
    font-weight: var(--cwh-font-bold);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--cwh-dark-blue);
    padding: 16px 16px 6px;
}
/* Section header chevron icon */
.cw-sb-header .nav-chevron {
    font-size: 16px;
    transition: transform 0.2s ease;
}
/* Section header chevron - collapsed state */
.cw-sb-header.collapsed .nav-chevron {
    transform: rotate(-90deg);
}

/* Divider */
.cw-sb-divider {
    border-top: 1px solid var(--cwh-middle-blue);
    margin: 8px 0;
}

/* Nav items */
.cw-sb-item {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 9px 16px !important;
    color: var(--cwh-dark-blue) !important;
    font-family: var(--cwh-font-family) !important;
    font-size: 13px !important;
    font-weight: var(--cwh-font-medium) !important;
    cursor: pointer !important;
    text-decoration: none !important;
    transition: background .15s, color .15s !important;
    border-radius: 0 !important;
    border-left: 3px solid transparent !important;
    line-height: 1.4 !important;
}
/* Nav item - hover state */
.cw-sb-item:hover {
    background: var(--cwh-middle-blue) !important;
    color: var(--cwh-white) !important;
    text-decoration: none !important;
}
/* Nav item - active/selected state */
.cw-sb-item.cw-sb-active {
    background: var(--cwh-middle-blue) !important;
    color: var(--cwh-white) !important;
    font-weight: var(--cwh-font-bold) !important;
    border-left-color: var(--cwh-dark-blue) !important;
}
/* Nav item - deprecated state (legacy item scheduled for removal, still clickable) */
.cw-sb-item.cw-sb-deprecated {
    color: var(--cwh-light-grey) !important;
}
.cw-sb-item.cw-sb-deprecated:hover {
    background: var(--cwh-light-grey) !important;
    color: var(--cwh-white) !important;
}
/* Hidden nav item - kept in the DOM but removed from view.
   Needs two classes to out-specify .cw-sb-item's display:flex !important. */
.cw-sb-item.d-none {
    display: none !important;
}
/* Nav item icon */
.cw-sb-item i {
    font-size: 17px !important;
    width: 18px !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
}

/* Store selector — the vaccinator portal's first menu entry, showing the store the session is
   working for. Opens a pop-out to the right of the menu (a Bootstrap dropend), so the menu
   itself never moves. */
.cw-sb-store-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 14px 16px 10px;
    background: none;
    border: 0;
    text-align: left;
    cursor: pointer;
    font-family: var(--cwh-font-family);
    font-size: 14px;
    font-weight: var(--cwh-font-bold);
    color: var(--cwh-dark-blue);
    transition: background .15s;
}
/* Hover, and the open state Bootstrap marks with .show */
.cw-sb-store-toggle:hover,
.cw-sb-store-toggle.show {
    background: var(--cwh-light-blue);
}
/* A focus ring for the keyboard only -- a click leaves focus here, and the open state already shows */
.cw-sb-store-toggle:focus {
    outline: none;
}
.cw-sb-store-toggle:focus-visible {
    outline: 2px solid var(--cwh-open-blue);
    outline-offset: -2px;
}
/* Store icon + name, truncated so a long store name cannot push the chevron off the menu */
.cw-sb-store-current {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.cw-sb-store-current i,
.cw-sb-store-chevron {
    font-size: 18px;
    flex-shrink: 0;
}
.cw-sb-store-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The pop-out. position: fixed from the start, matching the Popper strategy Navigation hands
   Bootstrap, so the scrolling sidebar can never clip it. */
.cw-sb-store-menu {
    position: fixed;
    min-width: 240px;
    max-width: 320px;
    padding: 6px 0;
    z-index: 1050;
    font-family: var(--cwh-font-family);
    background: var(--cwh-white);
    border: 1px solid var(--cwh-border);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 51, 126, 0.10);
}
/* "Store you're working for" — styled like the menu's section labels */
.cw-sb-store-menu .dropdown-header {
    padding: 8px 16px 6px;
    font-size: 10px;
    font-weight: var(--cwh-font-bold);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--cwh-dark-blue);
}
/* One store per row. The others are submit buttons, so the button chrome goes. */
.cw-sb-store-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 16px;
    border: 0;
    background: none;
    text-align: left;
    white-space: normal;
    font-size: 13px;
    font-weight: var(--cwh-font-medium);
    color: var(--cwh-dark-blue);
    cursor: pointer;
}
.cw-sb-store-menu .dropdown-item:hover,
.cw-sb-store-menu .dropdown-item:focus {
    background: var(--cwh-middle-blue);
    color: var(--cwh-white);
}
/* The chosen store: marked like the active menu item, and inert -- choosing it again does nothing */
.cw-sb-store-menu .dropdown-item.active,
.cw-sb-store-menu .dropdown-item.active:hover {
    background: var(--cwh-middle-blue);
    color: var(--cwh-white);
    font-weight: var(--cwh-font-bold);
    cursor: default;
}
/* Check mark on the chosen store; an empty icon of the same width keeps the other names aligned */
.cw-sb-store-menu .dropdown-item i {
    width: 18px;
    font-size: 17px;
    flex-shrink: 0;
}

/* Top bar account menu — the signed-in person's name on the button, truncated so a long name
   cannot crowd the top bar; the dropdown repeats it in full with their email beneath */
.cw-account-label {
    display: inline-block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
.cw-account-dropdown {
    min-width: 220px;
    font-family: var(--cwh-font-family);
}
.cw-account-dropdown .cw-account-name {
    font-size: 14px;
    font-weight: var(--cwh-font-bold);
    color: var(--cwh-dark-blue);
    padding-top: 0;
    padding-bottom: 0;
}
.cw-account-dropdown .cw-account-email {
    font-size: 12px;
    color: var(--cwh-middle-blue);
    padding-top: 2px;
    word-break: break-all;
}
/* Another account signed in on this device (FLG-391): a transfer icon, the name, and a small muted
   email beneath it. Used in the account menu, its Sign out dialog and the sign-out card. */
.cw-account-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--cwh-font-family);
    color: var(--cwh-dark-blue);
}
.cw-account-switch i {
    font-size: 17px;
    flex-shrink: 0;
}
.cw-account-switch .cw-account-switch-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.cw-account-switch .cw-account-switch-name {
    font-weight: var(--cwh-font-medium);
}
.cw-account-switch .cw-account-switch-email {
    font-size: 12px;
    color: var(--cwh-middle-blue);
    word-break: break-all;
}
/* The accounts to carry on as, in the Sign out dialog and on the sign-out card: one bordered button each */
.cw-account-pick {
    padding: 10px 14px;
    border: 1px solid var(--cwh-border);
    border-radius: 10px;
    background: var(--cwh-white);
    text-align: left;
}
.cw-account-pick:hover,
.cw-account-pick:focus {
    border-color: var(--cwh-middle-blue);
}

/* Main content area */
.cw-main-area {
    flex: 1;
    overflow-y: auto;
    background: var(--cwh-white);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Body content grows to push footer down on short pages, but won't shrink on long pages */
#body {
    flex: 1 0 auto;
}

/* Scrollbars */
.cw-sidebar::-webkit-scrollbar,
.cw-main-area::-webkit-scrollbar {
    width: 6px;
}
/* Scrollbar track */
.cw-sidebar::-webkit-scrollbar-track,
.cw-main-area::-webkit-scrollbar-track {
    background: transparent;
}
/* Scrollbar thumb */
.cw-sidebar::-webkit-scrollbar-thumb,
.cw-main-area::-webkit-scrollbar-thumb {
    background: var(--cwh-light-grey);
    border-radius: 3px;
}

/* Footer — override theme absolute positioning so it flows naturally inside the scrollable main area */
.cw-main-area .footer {
    position: static !important;
    bottom: auto !important;
    left:   auto !important;
    right:  auto !important;
}

/* Mobile */
@media (max-width: 992px) {
    .cw-nav-toggle {
        display: block !important;
    }
    .cw-page-wrapper {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }
    .cw-sidebar {
        width: 100% !important;
        height: auto !important;
        max-height: 0 !important;
        overflow: hidden !important;
        border-right: none !important;
        border-bottom: 1px solid var(--cwh-middle-blue) !important;
        transition: max-height .3s ease !important;
    }
    .cw-sidebar.cw-sidebar-open {
        max-height: 600px !important;
        overflow-y: auto !important;
    }
    .cw-main-area {
        height: auto !important;
        overflow-y: visible !important;
    }
}

/* ── Breadcrumb — shared "trail" pill look (system-wide) ─────────────────────
   Pill-chip breadcrumb: a white rounded strip with chevron separators, ghost
   chips for past crumbs (clickable links) that fill on hover, and a dark-blue
   gradient "current" pill for the last (or .active) crumb.

   This targets the plain Bootstrap `.breadcrumb` class so EVERY breadcrumb in
   the system gets the same look with no markup change — the `.cwh-breadcrumb`
   marker class is no longer required (kept harmless where present). Container
   selector is `ol.breadcrumb` so it always wins over Bootstrap's base rule.

       <ol class="breadcrumb m-0">
         <li class="breadcrumb-item"><a onclick="...">Groups</a></li>
         <li class="breadcrumb-item"><a onclick="...">Chemist Warehouse</a></li>
         <li class="breadcrumb-item active">CW – Ringwood</li>
       </ol>
*/
ol.breadcrumb {
    --bs-breadcrumb-divider: "";
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    row-gap: 8px;
    background: var(--cwh-white);
    border: 1px solid var(--cwh-border);
    border-radius: 999px;
    padding: 6px 10px;
    box-shadow: 0 4px 16px rgba(0, 51, 126, 0.06);
    font-family: var(--cwh-font-family);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    list-style: none;
}

.breadcrumb .breadcrumb-item {
    display: inline-flex;
    align-items: center;
    padding: 0;
    min-width: 0;
    max-width: 100%;
}

.breadcrumb .breadcrumb-item + .breadcrumb-item {
    padding-left: 0;
}

/* Chevron separator between crumbs */
.breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: "\203A";
    color: var(--cwh-light-grey);
    font-size: 1.15rem;
    line-height: 1;
    padding: 0 6px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    float: none;
}

/* Ghost chip — past crumbs (clickable links) */
.breadcrumb .breadcrumb-item a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    font-family: var(--cwh-font-family);
    font-weight: var(--cwh-font-medium);
    font-size: clamp(0.8rem, 0.76rem + 0.18vw, 0.9rem);
    color: var(--cwh-middle-blue);
    background: transparent;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    transition: background 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb .breadcrumb-item a:hover,
.breadcrumb .breadcrumb-item a:focus {
    background: var(--cwh-light-blue);
    color: var(--cwh-dark-blue);
    transform: translateY(-1px);
    text-decoration: none;
}

.breadcrumb .breadcrumb-item a:focus-visible {
    outline: 2px solid var(--cwh-open-blue);
    outline-offset: 2px;
}

/* Current crumb — last <li>, or any <li> marked .active. Gradient pill on the
   <li> itself so it works whether the inner content is plain text or an <a>. */
.breadcrumb .breadcrumb-item:last-child,
.breadcrumb .breadcrumb-item.active {
    background: linear-gradient(135deg, var(--cwh-dark-blue) 0%, #0e4d92 100%);
    color: var(--cwh-white);
    font-family: var(--cwh-font-family);
    font-weight: var(--cwh-font-bold);
    font-size: clamp(0.8rem, 0.76rem + 0.18vw, 0.9rem);
    border-radius: 999px;
    padding: 8px 16px;
    box-shadow: 0 2px 8px rgba(0, 51, 126, 0.18);
}

.breadcrumb .breadcrumb-item:last-child a,
.breadcrumb .breadcrumb-item.active a {
    padding: 0;
    background: transparent;
    color: var(--cwh-white);
    font-weight: var(--cwh-font-bold);
    transform: none;
    box-shadow: none;
}

.breadcrumb .breadcrumb-item:last-child a:hover,
.breadcrumb .breadcrumb-item:last-child a:focus,
.breadcrumb .breadcrumb-item.active a:hover,
.breadcrumb .breadcrumb-item.active a:focus {
    background: transparent;
    color: var(--cwh-white);
    transform: none;
}

@media (max-width: 768px) {
    ol.breadcrumb { padding: 5px 8px; gap: 4px; row-gap: 6px; }
    .breadcrumb .breadcrumb-item a,
    .breadcrumb .breadcrumb-item:last-child,
    .breadcrumb .breadcrumb-item.active { padding: 7px 14px; font-size: 0.82rem; }
    .breadcrumb .breadcrumb-item + .breadcrumb-item::before { width: 14px; font-size: 1rem; padding: 0 4px; }
}

@media (max-width: 520px) {
    ol.breadcrumb { padding: 5px 6px; gap: 3px; row-gap: 5px; }
    .breadcrumb .breadcrumb-item a,
    .breadcrumb .breadcrumb-item:last-child,
    .breadcrumb .breadcrumb-item.active { padding: 6px 12px; font-size: 0.78rem; max-width: 75vw; }
    .breadcrumb .breadcrumb-item + .breadcrumb-item::before { width: 12px; font-size: 0.9rem; padding: 0 3px; }
}
