:root {
    --ex-topbar-height: 52px;
    --ex-sidebar-width: 320px;
    --ex-navy: #0f2a4a;
}

html,
body.explore-body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}

.explore-topbar {
    height: var(--ex-topbar-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    background: var(--ex-navy);
    color: #fff;
}

.explore-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.explore-brand:hover {
    color: #fff;
}

.explore-brand .brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .15);
}

.explore-shell {
    position: relative;
    display: flex;
    height: calc(100% - var(--ex-topbar-height));
}

.explore-sidebar {
    width: var(--ex-sidebar-width);
    flex: 0 0 var(--ex-sidebar-width);
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid #dee2e6;
    transition: margin-left .2s ease;
    z-index: 2;
}

.explore-sidebar.is-collapsed {
    margin-left: calc(-1 * var(--ex-sidebar-width));
}

.explore-sidebar .accordion-button {
    font-weight: 600;
    font-size: .92rem;
}

.explore-map-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

#exMap {
    position: absolute;
    inset: 0;
}

.explore-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, .6);
    z-index: 5;
    font-weight: 600;
}

.explore-loader.d-none {
    display: none !important;
}

.explore-credit {
    font-size: .72rem;
    color: #6c757d;
    padding: 10px 14px 16px;
    margin: 0;
}

/* Layer list */
.ex-service {
    border-bottom: 1px solid #f1f3f5;
    padding: 4px 2px;
}

.ex-service > label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    margin: 0;
}

.ex-sublayers {
    margin: 4px 0 4px 22px;
}

.ex-sublayer-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .8rem;
    margin-bottom: 3px;
}

.ex-sublayer-row img,
.ex-legend-item img {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

.ex-legend {
    margin: 0 0 6px 26px;
}

.ex-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .76rem;
    color: #495057;
    margin-bottom: 2px;
}

label.ex-legend-item {
    cursor: pointer;
}

label.ex-legend-item input {
    flex: 0 0 auto;
}

/* Right-click menu */
.ex-context-menu {
    position: absolute;
    z-index: 10;
    min-width: 250px;
    max-width: 320px;
    padding: 4px 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 42, 74, .18);
    font-size: .85rem;
}

.ex-context-head {
    padding: 6px 12px 8px;
    border-bottom: 1px solid #f1f3f5;
    margin-bottom: 4px;
}

.ex-context-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 12px;
    border: 0;
    background: none;
    text-align: left;
    color: #212529;
}

.ex-context-menu button:hover {
    background: #eef4ff;
}

.ex-context-menu button i {
    width: 16px;
    color: var(--ex-navy);
    text-align: center;
}

/* Saved places */
.ex-saved-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 4px;
    border-bottom: 1px solid #f1f3f5;
}

.ex-saved-go {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: none;
    padding: 0;
    text-align: left;
    font-size: .82rem;
}

.ex-saved-go small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* MRSAC satellite basemap gallery */
.ex-sat-panel {
    width: 420px;
    max-width: 90vw;
}

.ex-sat-panel .ex-sat-header {
    padding: 10px 12px;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid #e0e0e0;
}

.ex-sat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 10px;
    max-height: 340px;
    overflow-y: auto;
}

.ex-sat-tile {
    border: 1px solid #d5d5d5;
    border-radius: 4px;
    background: #fafafa;
    cursor: pointer;
    text-align: center;
    padding: 6px;
    font-size: 11px;
    line-height: 1.25;
}

.ex-sat-tile:hover {
    border-color: #0079c1;
    background: #eef7fc;
}

.ex-sat-tile.is-active {
    border: 2px solid #0079c1;
    background: #e2f1fb;
}

.ex-sat-tile img {
    width: 100%;
    height: 46px;
    object-fit: cover;
    border-radius: 3px;
    margin-bottom: 5px;
    display: block;
}

.ex-measure-panel {
    width: 270px;
    padding: 10px;
}

@media (max-width: 767.98px) {
    :root {
        --ex-sidebar-width: 280px;
    }

    .explore-sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        box-shadow: 0 0 18px rgba(0, 0, 0, .2);
    }
}
