/* Map view (spec 11.5), public/js/feedus-map.js. */

.feedus-map { width: 100%; height: 420px; border-radius: 0.75rem; overflow: hidden; z-index: 0; background: #e5e7eb; }
.feedus-map.is-tall { height: calc(100vh - 17rem); min-height: 420px; }
.feedus-map.is-small { height: 300px; }

.feedus-map-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-bottom: 0.75rem; font-size: 0.875rem; }
.feedus-map-bar .fi-input-wrp { min-width: 14rem; }
.feedus-map-check { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }

/* Unit multi-select of customer users. */
.feedus-map-units { position: relative; }
.feedus-map-units-button {
    display: inline-flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-width: 14rem;
    padding: 0.375rem 0.75rem; border-radius: 0.5rem; background: #fff; color: inherit;
    box-shadow: 0 0 0 1px rgb(156 163 175 / 0.35), 0 1px 2px rgb(0 0 0 / 0.05); text-align: left;
}
.dark .feedus-map-units-button { background: rgb(255 255 255 / 0.05); box-shadow: 0 0 0 1px rgb(255 255 255 / 0.15); }
.feedus-map-units-button svg { width: 1.1rem; height: 1.1rem; opacity: 0.6; flex: 0 0 auto; }
.feedus-map-units-panel {
    position: absolute; z-index: 1000; top: calc(100% + 0.35rem); left: 0; width: max(100%, 18rem); max-width: calc(100vw - 2rem);
    padding: 0.5rem; border-radius: 0.6rem; background: #fff; box-shadow: 0 10px 25px rgb(0 0 0 / 0.18), 0 0 0 1px rgb(156 163 175 / 0.3);
}
.dark .feedus-map-units-panel { background: rgb(24 24 27); box-shadow: 0 10px 25px rgb(0 0 0 / 0.5), 0 0 0 1px rgb(255 255 255 / 0.12); }
.feedus-map-units-search {
    width: 100%; margin-bottom: 0.4rem; padding: 0.35rem 0.6rem; border-radius: 0.4rem; font-size: 0.875rem;
    border: 1px solid rgb(156 163 175 / 0.45); background: transparent; color: inherit;
}
.feedus-map-units-panel .feedus-map-check { display: flex; padding: 0.3rem 0.4rem; border-radius: 0.35rem; }
.feedus-map-units-panel .feedus-map-check:hover { background: rgb(156 163 175 / 0.12); }
.feedus-map-units-panel .feedus-map-units-all { border-bottom: 1px solid rgb(156 163 175 / 0.25); border-radius: 0; margin-bottom: 0.25rem; padding-bottom: 0.45rem; font-weight: 600; }
.feedus-map-units-list { max-height: 18rem; overflow-y: auto; }
.feedus-map-units-empty { padding: 0.3rem 0.4rem; color: rgb(107 114 128); }
.feedus-map-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-top: 0.75rem; font-size: 0.8rem; color: rgb(107 114 128); }
.feedus-map-legend > span { display: inline-flex; align-items: center; gap: 0.35rem; }
.feedus-map-note { margin-top: 0.5rem; font-size: 0.8rem; color: rgb(107 114 128); }
.feedus-map-note a { text-decoration: underline; margin-left: 0.25rem; }
.feedus-map-error { margin-top: 0.5rem; font-size: 0.8rem; color: rgb(220 38 38); }

.feedus-pin-wrap, .feedus-cluster-wrap { background: transparent; border: 0; }
.feedus-pin {
    display: block; width: 22px; height: 22px; border-radius: 50%;
    border: 3px solid #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 0.45); box-sizing: border-box;
}
.feedus-cluster {
    display: flex; align-items: center; justify-content: center; border-radius: 50%;
    color: #fff; font-weight: 700; font-size: 0.85rem; border: 3px solid #fff;
    box-shadow: 0 1px 5px rgb(0 0 0 / 0.45); box-sizing: border-box; text-shadow: 0 1px 1px rgb(0 0 0 / 0.35);
}
.feedus-dot { flex: 0 0 auto; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-top: 0.3em; }

.feedus-popup { font-size: 0.85rem; line-height: 1.35; min-width: min(200px, 55vw); }
/* A long screen list scrolls inside the popup (maxHeight set by fitPopup). */
.leaflet-popup-scrolled { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding-right: 4px; }
.feedus-popup a { color: #c2410c; text-decoration: none; font-weight: 600; }
.feedus-popup a:hover { text-decoration: underline; }
.feedus-popup-title { display: block; font-size: 0.95rem; margin-bottom: 0.15rem; }
.feedus-popup-muted { color: #6b7280; font-size: 0.8rem; }
.feedus-popup-empty { margin-top: 0.5rem; color: #6b7280; }
.feedus-popup-screen { display: flex; gap: 0.5rem; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid #e5e7eb; }

.feedus-location-help { margin-top: 0.4rem; font-size: 0.8rem; color: rgb(107 114 128); }

/* Leaflet's popups stay light; keep their text dark in Filament's dark mode. */
.dark .leaflet-popup-content-wrapper, .dark .leaflet-popup-tip { color: #111827; }

/* Unit CSV import preview. */
.feedus-import-counts { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: 0.9rem; }
.feedus-import-table-wrap { margin-top: 1rem; max-height: 60vh; overflow: auto; border: 1px solid rgb(156 163 175 / 0.3); border-radius: 0.5rem; }
.feedus-import-table { width: 100%; font-size: 0.85rem; border-collapse: collapse; }
.feedus-import-table th { position: sticky; top: 0; text-align: left; padding: 0.5rem 0.75rem; background: rgb(243 244 246); font-weight: 600; }
.dark .feedus-import-table th { background: rgb(31 41 55); }
.feedus-import-table td { padding: 0.4rem 0.75rem; border-top: 1px solid rgb(156 163 175 / 0.2); vertical-align: top; }
.feedus-import-table tr.is-new td { background: rgb(34 197 94 / 0.08); }
.feedus-import-table tr.is-update td { background: rgb(59 130 246 / 0.08); }
.feedus-import-table tr.is-same td { opacity: 0.6; }
.feedus-import-table tr.is-error td { background: rgb(239 68 68 / 0.1); }
