/* Phase 1 · Release 07 — shared premium Web GIS presentation layer. */
:root {
    --s7-map-navy: #10233f;
    --s7-map-blue: #2563eb;
    --s7-map-cyan: #0891b2;
    --s7-map-green: #16805b;
    --s7-map-amber: #f5a623;
    --s7-map-red: #d14343;
    --s7-map-surface: rgba(255, 255, 255, .96);
    --s7-map-soft: #f4f7fb;
    --s7-map-line: #d7e1ee;
    --s7-map-ink: #172033;
    --s7-map-muted: #667085;
    --s7-map-shadow: 0 14px 38px rgba(16, 35, 63, .18);
}

.s7-map-host {
    position: relative !important;
    isolation: isolate;
    min-height: 320px;
    border: 1px solid var(--s7-map-line) !important;
    border-radius: 18px !important;
    overflow: hidden;
    background: #e9eff6;
    box-shadow: 0 14px 34px rgba(16, 35, 63, .1);
}

.s7-map-host:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: 3px;
}

.s7-map-host .leaflet-container,
.s7-map-host.leaflet-container {
    color: var(--s7-map-ink);
    font-family: inherit;
    cursor: grab;
}
.s7-map-host.leaflet-dragging { cursor: grabbing; }
.s7-map-host.is-s7-tool-active { cursor: crosshair; }

.s7-map-toolbar {
    position: absolute;
    z-index: 900;
    inset-block-start: .75rem;
    inset-inline: .75rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .6rem;
    pointer-events: none;
}

.s7-map-search,
.s7-map-actions {
    pointer-events: auto;
    border: 1px solid rgba(203, 216, 232, .92);
    border-radius: 14px;
    background: var(--s7-map-surface);
    box-shadow: var(--s7-map-shadow);
    backdrop-filter: blur(14px);
}

.s7-map-search { position: relative; width: min(420px, calc(100% - 250px)); }
.s7-map-search-field { display: flex; align-items: center; gap: .55rem; min-height: 46px; padding-inline: .75rem; }
.s7-map-search-field svg { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; color: var(--s7-map-blue); }
.s7-map-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--s7-map-ink);
    background: transparent;
    font: inherit;
    font-size: .86rem;
}
.s7-map-search input::placeholder { color: #77859a; }
.s7-map-search-hint { display: block; padding: 0 .8rem .62rem; color: var(--s7-map-muted); font-size: .68rem; }
.s7-map-search-results {
    position: absolute;
    inset-inline: 0;
    top: calc(100% + .4rem);
    max-height: 260px;
    margin: 0;
    padding: .4rem;
    list-style: none;
    overflow: auto;
    border: 1px solid var(--s7-map-line);
    border-radius: 13px;
    background: var(--s7-map-surface);
    box-shadow: var(--s7-map-shadow);
}
.s7-map-search-results[hidden] { display: none; }
.s7-map-search-result {
    display: block;
    width: 100%;
    padding: .65rem .7rem;
    border: 0;
    border-radius: 9px;
    color: var(--s7-map-ink);
    background: transparent;
    text-align: start;
    font: inherit;
    font-size: .8rem;
    cursor: pointer;
}
.s7-map-search-result:hover,
.s7-map-search-result[aria-selected="true"] { color: #174f91; background: #edf5ff; }
.s7-map-search-result strong,
.s7-map-search-result small { display: block; }
.s7-map-search-result small { margin-block-start: .15rem; color: var(--s7-map-muted); }

.s7-map-actions { display: flex; gap: .25rem; padding: .3rem; }
.s7-map-action {
    display: grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 10px;
    color: #33445c;
    background: transparent;
    cursor: pointer;
}
.s7-map-action:hover,
.s7-map-action[aria-pressed="true"] { color: #174f91; background: #eaf3ff; }
.s7-map-action svg { width: 1.15rem; height: 1.15rem; }

.s7-map-status {
    position: absolute;
    z-index: 880;
    inset-inline-start: 50%;
    bottom: 1rem;
    max-width: calc(100% - 2rem);
    padding: .55rem .8rem;
    transform: translateX(-50%);
    border: 1px solid var(--s7-map-line);
    border-radius: 999px;
    color: var(--s7-map-ink);
    background: var(--s7-map-surface);
    box-shadow: 0 8px 22px rgba(16,35,63,.14);
    font-size: .76rem;
    font-weight: 700;
    pointer-events: none;
}
[dir="rtl"] .s7-map-status { transform: translateX(50%); }
.s7-map-status[data-state="success"] { color: #0e6849; border-color: #b8dfcf; background: #effaf5; }
.s7-map-status[data-state="warning"] { color: #8a5205; border-color: #f0d69c; background: #fff8e8; }

.s7-map-loading {
    position: absolute;
    z-index: 850;
    inset: 0;
    display: grid;
    place-items: center;
    color: #41526a;
    background: linear-gradient(110deg, #e8eef5 18%, #f7f9fc 34%, #e8eef5 50%);
    background-size: 220% 100%;
    animation: s7-map-shimmer 1.25s linear infinite;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
}
.s7-map-loading.is-ready { opacity: 0; visibility: hidden; }
.s7-map-loading span { padding: .7rem 1rem; border-radius: 999px; background: rgba(255,255,255,.82); font-size: .8rem; font-weight: 750; }
@keyframes s7-map-shimmer { to { background-position-x: -220%; } }

.s7-layer-panel,
.s7-legend-panel {
    position: absolute;
    z-index: 920;
    top: 4.6rem;
    inset-inline-end: .75rem;
    width: min(330px, calc(100% - 1.5rem));
    max-height: calc(100% - 6rem);
    overflow: auto;
    border: 1px solid var(--s7-map-line);
    border-radius: 16px;
    color: var(--s7-map-ink);
    background: var(--s7-map-surface);
    box-shadow: var(--s7-map-shadow);
    backdrop-filter: blur(14px);
}
.s7-layer-panel[hidden], .s7-legend-panel[hidden] { display: none; }
.s7-panel-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .8rem; border-bottom: 1px solid var(--s7-map-line); background: inherit; }
.s7-panel-head strong { font-size: .88rem; }
.s7-panel-close { width: 32px; height: 32px; border: 0; border-radius: 8px; color: inherit; background: transparent; cursor: pointer; }
.s7-panel-close:hover { background: #edf3fa; }
.s7-layer-tools { display: grid; grid-template-columns: 1fr auto; gap: .45rem; padding: .7rem; }
.s7-layer-search { min-width: 0; min-height: 38px; padding-inline: .65rem; border: 1px solid #cfdbe9; border-radius: 9px; color: inherit; background: #fff; font: inherit; font-size: .78rem; }
.s7-toggle-all { min-height: 38px; padding-inline: .65rem; border: 1px solid #cfdbe9; border-radius: 9px; color: #28527f; background: #f4f8fd; font: inherit; font-size: .72rem; font-weight: 750; cursor: pointer; }
.s7-layer-groups { padding: 0 .65rem .7rem; }
.s7-layer-group { border-top: 1px solid #e6ecf3; }
.s7-layer-group:first-child { border-top: 0; }
.s7-layer-group summary { padding: .65rem .25rem; color: #42536a; font-size: .75rem; font-weight: 800; cursor: pointer; list-style-position: inside; }
.s7-layer-group-body { display: grid; gap: .25rem; padding-block-end: .5rem; }
.s7-layer-row { display: flex !important; align-items: center; gap: .55rem; padding: .48rem .55rem !important; border-radius: 9px; font-size: .78rem; cursor: pointer; }
.s7-layer-row:hover { background: #f2f6fb; }
.s7-layer-row input { width: 17px; height: 17px; accent-color: var(--s7-map-blue); }
.s7-layer-description { display: block; margin-inline-start: 1.55rem; color: var(--s7-map-muted); font-size: .65rem; }

.s7-legend-content { display: grid; gap: .55rem; padding: .75rem; }
.s7-legend-item { display: grid; grid-template-columns: 14px minmax(0, 1fr); align-items: start; gap: .6rem; padding: .45rem; border-radius: 9px; }
.s7-legend-item:hover { background: #f4f7fb; }
.s7-legend-swatch { width: 12px; height: 12px; margin-block-start: .18rem; border: 2px solid #fff; border-radius: 50%; background: var(--legend-color, var(--s7-map-blue)); box-shadow: 0 0 0 1px rgba(16,35,63,.25); }
.s7-legend-item strong, .s7-legend-item small { display: block; }
.s7-legend-item strong { font-size: .76rem; }
.s7-legend-item small { color: var(--s7-map-muted); font-size: .66rem; }
.s7-legend-panel.is-compact .s7-legend-item small { display: none; }
.s7-legend-mode { border: 0; color: var(--s7-map-blue); background: transparent; font: inherit; font-size: .7rem; font-weight: 750; cursor: pointer; }

.s7-map-host .leaflet-top { top: 4.4rem; }
.s7-map-host .leaflet-control-zoom,
.s7-map-host .leaflet-control-scale-line,
.s7-map-host .leaflet-control-attribution,
.s7-map-host .leaflet-bar {
    border: 1px solid var(--s7-map-line) !important;
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(16,35,63,.15) !important;
}
.s7-map-host .leaflet-control-zoom a,
.s7-map-host .leaflet-bar a { width: 38px; height: 38px; line-height: 38px; color: #24364e; background: var(--s7-map-surface); }
.s7-map-host .leaflet-control-zoom a:hover,
.s7-map-host .leaflet-bar a:hover { color: #174f91; background: #edf5ff; }
.s7-map-host .leaflet-control-scale-line { color: #34465d; background: var(--s7-map-surface); font-weight: 700; }
.s7-map-host .leaflet-control-attribution { color: #536176; background: rgba(255,255,255,.88); font-size: .62rem; }
.s7-map-host .leaflet-control-layers { display: none !important; }

.s7-map-host .leaflet-popup-content-wrapper,
.s7-map-host .leaflet-popup-tip {
    color: var(--s7-map-ink);
    background: var(--s7-map-surface);
}
.s7-map-host .leaflet-popup-content-wrapper { overflow: hidden; border: 1px solid var(--s7-map-line); border-radius: 17px; box-shadow: 0 18px 48px rgba(16,35,63,.24); }
.s7-map-host .leaflet-popup-content { width: min(310px, calc(100vw - 4rem)) !important; margin: 0; font-family: inherit; }
.s7-map-host .leaflet-popup-close-button { z-index: 3; display: grid; width: 34px !important; height: 34px !important; place-items: center; border-radius: 50%; color: #263850 !important; background: rgba(255,255,255,.92) !important; box-shadow: 0 4px 14px rgba(16,35,63,.16); }
.s7-map-host .property-search-popup,
.s7-map-host .map-popup { min-width: 0; }
.s7-map-host .property-search-popup-image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #edf1f6; }
.s7-map-host .property-search-popup-body,
.s7-map-host .map-popup { padding: .9rem; }
.s7-map-host .property-search-popup-body > strong,
.s7-map-host .map-popup > strong { display: block; color: var(--s7-map-ink); font-size: .95rem; line-height: 1.35; }
.s7-map-host .property-search-popup-body > b { display: block; margin-block: .35rem; color: #174f91; font-size: 1.05rem; }
.s7-map-host .property-search-popup dl,
.s7-map-host .map-popup dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; margin-block: .65rem; }
.s7-map-host .property-search-popup dl > div,
.s7-map-host .map-popup dl > div { padding: .45rem; border-radius: 8px; background: #f3f6fa; }
.s7-map-host .property-search-popup dt,
.s7-map-host .map-popup dt { color: var(--s7-map-muted); font-size: .62rem; }
.s7-map-host .property-search-popup dd,
.s7-map-host .map-popup dd { margin: 0; color: var(--s7-map-ink); font-size: .72rem; font-weight: 750; }
.s7-map-popup-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; margin-block-start: .65rem; }
.s7-map-popup-actions .btn { min-height: 36px; padding-inline: .35rem; font-size: .67rem; }

.s7-map-host .leaflet-marker-icon { transition: transform .16s ease, filter .16s ease; }
.s7-map-host .leaflet-marker-icon:hover,
.s7-map-host .leaflet-marker-icon.is-s7-selected,
.s7-map-host .is-search-active-marker { z-index: 1000 !important; filter: drop-shadow(0 5px 8px rgba(16,35,63,.35)); transform: scale(1.14); }
.s7-map-host .marker-cluster { transition: transform .16s ease; }
.s7-map-host .marker-cluster:hover { transform: scale(1.08); }
.s7-map-host .marker-cluster div { border: 2px solid rgba(255,255,255,.9); color: #fff; background: linear-gradient(145deg, #2563eb, #174f91); box-shadow: 0 7px 18px rgba(16,35,63,.25); }

.s7-tool-button,
.property-search-toolbar [data-search-tool],
.leaflet-draw-toolbar a { min-width: 42px; min-height: 40px; border-radius: 10px !important; }
.property-search-toolbar [data-search-tool][aria-pressed="true"] { color: #fff; border-color: #174f91; background: #174f91; }

.gis-control-panel.s7-custom-layer-panel { position: relative; }
.s7-custom-layer-tools { display: grid; grid-template-columns: 1fr auto; gap: .5rem; margin-block-end: .75rem; }
.s7-custom-layer-tools input { min-width: 0; min-height: 42px; padding-inline: .7rem; border: 1px solid var(--s7-map-line); border-radius: 10px; color: var(--s7-map-ink); background: #fff; }
.s7-custom-layer-group { margin-block: .5rem; border: 1px solid var(--s7-map-line); border-radius: 12px; overflow: hidden; }
.s7-custom-layer-group summary { padding: .7rem; color: #3f5068; background: #f4f7fb; font-size: .76rem; font-weight: 800; cursor: pointer; }
.s7-custom-layer-group-body { display: grid; gap: .2rem; padding: .4rem; }

:is([data-bs-theme="dark"], [data-theme="dark"]) {
    --s7-map-surface: rgba(19, 31, 50, .97);
    --s7-map-soft: #121e30;
    --s7-map-line: #40516a;
    --s7-map-ink: #eef5ff;
    --s7-map-muted: #aebdd0;
}
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-map-host { background: #0e1827; }
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-map-host .leaflet-tile-pane { filter: brightness(.68) contrast(1.12) saturate(.78); }
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-map-search-result:hover,
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-map-search-result[aria-selected="true"],
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-map-action:hover,
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-map-action[aria-pressed="true"],
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-layer-row:hover,
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-legend-item:hover { color: #cce4ff; background: #213650; }
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-map-action { color: #d7e6f7; }
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-layer-search,
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-custom-layer-tools input { color: #edf5ff; border-color: #40516a; background: #17263b; }
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-toggle-all { color: #cce4ff; border-color: #40516a; background: #1c3049; }
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-map-host .leaflet-control-zoom a,
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-map-host .leaflet-bar a { color: #dce9f8; background: #17263b; }
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-map-host .leaflet-control-attribution { color: #b6c7da; background: rgba(15,26,42,.9); }
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-map-host .property-search-popup-body > b { color: #82b8ff; }
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-map-host .property-search-popup dl > div,
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-map-host .map-popup dl > div { background: #1d2d43; }
:is([data-bs-theme="dark"], [data-theme="dark"]) .s7-custom-layer-group summary { color: #dce9f8; background: #1d2d43; }

.s7-map-host:fullscreen { width: 100vw !important; height: 100vh !important; min-height: 100vh; border: 0 !important; border-radius: 0 !important; }

@media (max-width: 991.98px) {
    .s7-map-host { min-height: 400px; }
    .s7-map-search { width: min(360px, calc(100% - 205px)); }
    .s7-map-action { width: 36px; height: 40px; }
}

@media (max-width: 575.98px) {
    .s7-map-host { min-height: 430px; border-radius: 14px !important; }
    .s7-map-toolbar { inset-block-start: .5rem; inset-inline: .5rem; align-items: stretch; flex-direction: column; }
    .s7-map-search { width: 100%; }
    .s7-map-search-hint { display: none; }
    .s7-map-actions { align-self: flex-end; }
    .s7-map-host .leaflet-top { top: 7.2rem; }
    .s7-map-host .leaflet-control-zoom a,
    .s7-map-host .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; }
    .s7-layer-panel, .s7-legend-panel { top: 7.2rem; inset-inline: .5rem; width: auto; max-height: calc(100% - 8rem); }
    .s7-map-status { bottom: 1.8rem; white-space: normal; text-align: center; }
    .s7-map-popup-actions { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .s7-map-host *, .s7-map-host *::before, .s7-map-host *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (forced-colors: active) {
    .s7-map-search, .s7-map-actions, .s7-layer-panel, .s7-legend-panel, .s7-map-host .leaflet-control-zoom { border: 1px solid CanvasText !important; }
    .s7-legend-swatch { border: 2px solid CanvasText; }
}

@media print {
    .s7-map-toolbar, .s7-layer-panel, .s7-legend-panel, .s7-map-status { display: none !important; }
    .s7-map-host { min-height: 420px; box-shadow: none; }
}


/* Production thematic legend shapes */
.s7-legend-swatch.is-cluster {
    width: 18px;
    height: 18px;
    margin-inline-start: -3px;
    border-width: 3px;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--legend-color) 22%, transparent);
}

.s7-legend-swatch.is-subject,
.s7-legend-swatch.is-selected {
    width: 14px;
    height: 14px;
    border-radius: 4px 50% 50% 50%;
    transform: rotate(45deg);
}

.s7-legend-swatch.is-area {
    border-radius: 3px;
    background: color-mix(in srgb, var(--legend-color) 28%, transparent);
    outline: 2px dashed var(--legend-color);
    outline-offset: 2px;
}

.s7-legend-swatch.is-heat {
    border: 0;
    background: var(--legend-color);
    box-shadow: 0 0 9px color-mix(in srgb, var(--legend-color) 70%, transparent);
}
