:root {
    --brand: #0066ff;
    --accent: #ff0000;
    --glass: rgba(0,0,0,.55);
    --border: rgba(255,255,255,.12);
    --text: #f5f5f7;
    --bg: #0b0c0f;
}

/* Scroll snap disabled */
#map-wrap {
    position: relative;
    height: 90dvh;
    overflow: hidden;
    background: var(--bg); 
    font-family: system-ui;
    overscroll-behavior: contain;
}

#business-map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Glassy overlapping sidebar */
#sidebar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 360px;
    background: var(--glass);
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid var(--border);
    color: var(--text);
    transform: translateX(-100%);
    transition: transform .3s ease;
    z-index: 2;
    display: flex;
    flex-direction: column;
    padding-top: 75px;
}

/* Show sidebar by default on desktop (768px and up) */
@media (min-width: 768px) {
    #sidebar {
        transform: translateX(0);
    }
}

/* On mobile, start with sidebar open */
@media (max-width: 767px) {
    #sidebar {
        transform: translateX(0);
    }
}

/* When sidebar-open class is present, always show sidebar */
#map-wrap.sidebar-open #sidebar {
    transform: translateX(0);
}

#sidebarTab {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    transition: transform .3s ease;
    padding: 0;
}

#sidebarTab svg {
    width: 16px;
    height: 16px;
    transition: transform .3s ease;
}

#map-wrap.sidebar-open #sidebarTab svg {
    transform: rotate(180deg);
}

.sb-header {
    padding: 8px;
    border-bottom: 1px solid var(--border);
}

.sb-title-hero {
    color: var(--brand);
    font-size: 36px !important;
    text-align: center !important;
    display: inline !important;
    margin: 0;
}

.sb-stats {
    font-size: 7px;
    color: #ccc;
}

.sb-search {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px 16px;
    border-bottom: 1px solid var(--border);
    align-items: stretch;
}

#searchBox {
    padding: 8px 10px;
    border-radius: 0;
    border: 1px solid #444;
    background: #111;
    color: #fff;
    width: 100%;
    margin-top: 16px;
}

#searchBox::placeholder {
    color: #fff !important;
    opacity: 1;
}

#searchBox::-webkit-input-placeholder {
    color: #fff !important;
    opacity: 1;
}

#searchBox::-moz-placeholder {
    color: #fff !important;
    opacity: 1;
}

#searchBox:-ms-input-placeholder {
    color: #fff !important;
    opacity: 1;
}

#buFilter {
    padding: 8px 10px;
    border-radius: 0;
    border: 1px solid #444;
    background: #111;
    color: #fff;
    min-width: 0;
    width: 100%;
}

#buFilter option {
    color: #fff !important;
    background: var(--accent) !important;
}

#buFilter option:hover {
    color: #000 !important;
    background: var(--accent) !important;
}

/* Tabbed filter styling */
.sb-tabs {
    display: flex;
    gap: 2px;
    margin-top: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
    padding: 2px;
}

.sb-tab {
    flex: 1;
    padding: 12px 16px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 4px !important;
    color: rgba(255,255,255,0.6) !important;
    cursor: pointer !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
    text-align: center !important;
    text-transform: none !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font: inherit !important;
    margin: 0 !important;
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    outline: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    min-height: 40px !important;
    box-shadow: none !important;
    line-height: 1.2 !important;
}

.sb-tab:hover {
    color: rgba(255,255,255,0.9) !important;
    background: rgba(255,255,255,0.08) !important;
}

.sb-tab.active {
    color: #fff !important;
    background: var(--accent) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    border-radius: 4px !important;
    text-transform: none !important;
}

.sb-list {
    list-style: none;
    margin: 0;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    overscroll-behavior: contain;
}

.sb-item {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 0;
    padding: 12px;
    margin: 0 0 8px 0;
    width: 100%;
    cursor: pointer;
    position: relative;
}

.sb-item:hover {
    background: rgba(255,255,255,.12);
}

.sb-title {
    margin: 0 0 8px;
    font-size: 14px;
    color: #fff;
}

.sb-meta {
    margin: 0;
    font-size: 13px;
    color: #e8eaed;
    line-height: 1.35;
}

.sb-line {
    display: block;
    margin: 4px 0;
}

.sb-link {
    color: #fff !important;
    text-decoration: underline !important;
    font-weight: 800;
}

.sb-link:hover {
    color: #fff;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    margin-right: 6px;
    margin-bottom: 4px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.18);
    color: var(--accent);
    word-wrap: break-word;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
}

/* Top-right controls */
#resetBtn,
#themeToggle {
    position: absolute;
    top: 12px;
    z-index: 4;
    border: 0;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

#resetBtn svg,
#themeToggle svg {
    width: 16px;
    height: 16px;
    display: block;
    overflow: visible;
}

#resetBtn {
    overflow: visible;
}

/* button colors per request */
#resetBtn {
    left: 60px;
    /* background removed - use custom class for styling */
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 3px;
    padding: 8px 12px;
    height: 42px;
    white-space: nowrap;
}

#themeToggle {
    left: calc(60px + 75px + 10px);
    /* background removed - use custom class for styling */
    height: 42px;
    width: 42px;
    padding: 0;
}

/* shift when sidebar opens so they don't overlap */
#map-wrap.sidebar-open #resetBtn {
    left: calc(60px + 360px);
}

#map-wrap.sidebar-open #themeToggle {
    left: calc(140px + 360px);
}

/* Mapbox +/- controls at top-left, also shift with sidebar */
#map-wrap .mapboxgl-ctrl-top-left {
    top: 62px;
    left: 12px;
}

#map-wrap.sidebar-open .mapboxgl-ctrl-top-left {
    left: calc(12px + 360px);
}

/* Sales manager items styling (in main list) */
.sb-item.sales-manager-item {
    background: rgba(255,255,255,.08) !important;
    border: 1px solid var(--accent) !important;
    transition: all 0.2s ease;
    overflow: hidden; /* Clear floats */
    min-height: 70px; /* Accommodate photo */
}

.sb-item.sales-manager-item:hover {
    background: rgba(255,255,255,.12) !important;
    border-color: var(--brand) !important;
    transform: translateX(4px);
}

.sb-item.sales-manager-item img {
    float: left;
    margin-right: 12px;
    margin-bottom: 8px;
}

.sb-item.sales-manager-item::after {
    content: "";
    display: table;
    clear: both;
}

.sb-item.sales-manager-item .sb-title {
    color: #fff !important;
    font-weight: 800 !important;
    padding: 0 8px !important;
}

/* Style +/- buttons to match brand */
.mapboxgl-ctrl-group {
    box-shadow: none;
    border: 0;
}

.mapboxgl-ctrl-group:not(:empty) {
    box-shadow: none;
}

.mapboxgl-ctrl-group button {
    background: var(--brand);
    color: #fff;
    border: 0;
}

.mapboxgl-ctrl-zoom-in,
.mapboxgl-ctrl-zoom-out {
    background: var(--brand) !important;
}

.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon,
.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon {
    filter: invert(1) brightness(2);
}

.mapboxgl-ctrl-group button:hover {
    background: var(--accent);
}

/* Popup styles */
.mapboxgl-popup-close-button {
    color: #fff !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
}

.mapboxgl-popup-content {
    padding: 0;
    border-radius: var(--card-border-radius, 12px);
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,.45);
    overflow: hidden;
    backdrop-filter: blur(6px);
}

.mapboxgl-popup-tip {
    border-color: var(--bg) !important;
}

/* Triangular popup arrow (override default diamond) */
.mapboxgl-popup-tip {
    background: transparent !important;
    width: 0 !important;
    height: 0 !important;
    border-style: solid !important;
    border-width: 10px !important;
    border-color: transparent !important;
}

/* Orient arrow color to match background by anchor */
.mapboxgl-popup-anchor-top .mapboxgl-popup-tip {
    border-bottom-color: var(--bg) !important;
}

.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip {
    border-top-color: var(--bg) !important;
}

.mapboxgl-popup-anchor-left .mapboxgl-popup-tip {
    border-right-color: var(--bg) !important;
}

.mapboxgl-popup-anchor-right .mapboxgl-popup-tip {
    border-left-color: var(--bg) !important;
}

.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip {
    border-bottom-color: var(--bg) !important;
}

.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip {
    border-top-color: var(--bg) !important;
}

.popup-cap {
    height: 10px;
    background: var(--brand);
}

.popup-inner {
    padding: 18px 22px 14px;
}

/* Inline video preview inside popup */
.popup-video {
    margin: 0 0 12px;
    cursor: default;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    pointer-events: none;
}

/* dark circular backdrop under the icon */
.popup-video::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 40px;
    height: 40px;
    transform: translate(-50%,-50%);
    background: rgba(0,0,0,.55);
    border-radius: 50%;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* center container for the icon (clickable) */
.popup-video .pv-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
    width: 40px;
    height: 40px;
    pointer-events: auto;
    cursor: pointer;
}

.popup-video .pv-icon::before {
    content: "\f065";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%) scale(1.12);
    color: #fff;
    opacity: .95;
}

.popup-video .pv-icon::after {
    content: "\f065";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
    color: #fff;
}

.popup-video .pv-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    display: block;
    background: #000 center/cover no-repeat;
}

.popup-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent);
    font-weight: 800;
    margin-bottom: 10px;
}

.popup-badge i {
    font-size: 18px;
}

.popup-title {
    margin: 4px 0 10px;
    font-size: 18px;
    line-height: 1.15;
    font-weight: 800;
    color: #fff;
}

.popup-address {
    margin: 0 0 12px;
    line-height: 1.4;
    color: #e8eaed;
}

.popup-sub {
    margin: 0 0 8px;
    color: #e8eaed;
}

.popup-section {
    margin: 0 0 6px;
    color: var(--accent);
    font-weight: 800;
}

.popup-label {
    color: var(--accent) !important;
    font-weight: 800 !important;
    display: inline !important;
    margin: 0 6px 0 0;
}

.popup-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #e8eaed;
    border-top: 1px solid var(--border);
    padding: 10px 16px 12px;
    background: var(--bg);
}

.popup-inner .badge {
    max-width: calc(100% - 12px);
    word-break: break-word;
    white-space: normal;
}

.popup-bottom .status {
    white-space: nowrap;
}

.popup-link {
    color: #fff !important;
    font-weight: 800;
    text-decoration: underline !important;
}

.popup-link:hover {
    color: #fff;
}

/* Popup animations */
@keyframes popupIn {
    0% {
        opacity: 0;
        transform: translateY(6px) scale(.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes popupOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(6px) scale(.98);
    }
}

.popup-enter {
    animation: popupIn .22s ease-out both;
}

.popup-exit {
    animation: popupOut .18s ease-in both;
}

/* Hover preview animation: fade up only (no scale) */
@keyframes fadeUp {
    0% {
        opacity: 0;
        transform: translateY(6px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.popup-fade {
    animation: fadeUp .18s ease-out both;
}

/* Sidebar status pop animation */
.status-holder {
    display: inline-block;
    opacity: .0;
    transform: translateY(4px);
    transition: opacity .28s ease, transform .28s ease;
}

.status-holder.pop-in {
    opacity: 1;
    transform: translateY(0);
}

/* Video overlay (lightbox) */
#videoOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.72);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#videoOverlay.open {
    display: flex;
    animation: fadeIn .18s ease-out both;
}

#videoOverlay .vo-modal {
    position: relative;
    width: min(92vw,1200px);
    aspect-ratio: 16/9;
    transform: scale(.96);
    opacity: 0;
    animation: zoomIn .22s ease-out .02s both;
}

#videoOverlay .vo-modal iframe {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 12px;
    background: #000;
}

#videoOverlay .vo-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,.7);
    border: none !important;
    outline: none !important;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#videoOverlay .vo-close:hover {
    background: rgba(0,0,0,.85);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#map-wrap .mapboxgl-ctrl-top-left {
    top: 75px;
    color: white !important;
    transition: .2s ease all !important;
}

.mapboxgl-ctrl .mapboxgl-ctrl-icon {
    filter: invert(1) !important;
    transition: .2s ease all !important;
}

#themeToggle {
    transition: .2s ease all !important;
}

#map-wrap.sidebar-open #resetBtn {
    left: calc(60px + 360px);
}

#map-wrap.sidebar-open #themeToggle {
    left: calc(60px + 75px + 10px + 360px) !important;
}

.mapboxgl-ctrl-group button {
    border-radius: 500px !important;
    background-color: var(--brand) !important;
    margin-bottom: 10px;
    border: none !important;
}

.mapboxgl-ctrl-group button:hover {
    background-color: var(--accent) !important;
}

.mapboxgl-ctrl-group {
    background-color: transparent;
}

#sidebar #list {
    padding: 0 !important;
}

.sb-item {
    padding: 20px !important;
    border-radius: 0 !important;
}

a.map-cta-btn,
button.map-cta-btn {
    border-radius: 0 !important;
    padding: 0px !important;
    width: 100%;
    display: block !important;
    background-color: var(--accent) !important;
    text-decoration: none !important;
    color: inherit !important;
    border: none !important;
    cursor: pointer;
}

a.map-cta-btn:hover,
button.map-cta-btn:hover {
    background-color: var(--brand) !important;
    text-decoration: none !important;
}

/* Sales Manager Popup Styles */
.region-sales-managers-popup .mapboxgl-popup-content {
    max-width: 400px;
    max-height: 500px;
    overflow-y: auto;
}

.region-sales-managers-popup .mapboxgl-popup-content h3 {
    margin: 0 0 16px 0;
    color: #fff;
    font-size: 1.2em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.sales-manager-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: background 0.2s;
}

.sales-manager-item:hover {
    background: rgba(255,255,255,0.08);
}

.sales-manager-item img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.sales-manager-item > div {
    flex: 1;
}

.sales-manager-item > div > div:first-child {
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.sales-manager-item a {
    color: #fff;
    text-decoration: underline;
    font-size: 0.9em;
}

.sales-manager-item a:hover {
    color: var(--accent);
}

