/* MapLibre Custom Control Styles */

/* CSS-based fullscreen mode for map container */
/* Uses CSS positioning instead of native Fullscreen API so dialogs remain visible */
.maplibre-fullscreen-active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    min-width: 100vw !important;
    min-height: 100vh !important;
    z-index: 9999 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* Prevent body scroll when map is in CSS fullscreen mode */
body.maplibre-fullscreen-body {
    overflow: hidden !important;
}

/* Override Radzen's transform that breaks position:fixed */
body.maplibre-fullscreen-body .rz-body {
    transform: none !important;
}

/* Ensure Radzen dialogs appear above fullscreen map */
body.maplibre-fullscreen-body .rz-dialog-wrapper {
    z-index: 10000 !important;
}

/* Fullscreen control button styling */
.maplibregl-ctrl-fullscreen {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    cursor: pointer;
}

.maplibregl-ctrl-fullscreen svg {
    stroke: #333;
}

.maplibregl-ctrl-fullscreen:hover svg {
    stroke: #000;
}

/* Active state for toggle controls (Lasso, PointCollector) */
.maplibregl-ctrl-icon.lasso-control.active,
.maplibregl-ctrl-icon.point-collector-control.active {
    background-color: rgba(51, 136, 255, 0.2);
}

.maplibregl-ctrl-icon.lasso-control:hover,
.maplibregl-ctrl-icon.point-collector-control:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.maplibregl-ctrl-icon.lasso-control.active:hover,
.maplibregl-ctrl-icon.point-collector-control.active:hover {
    background-color: rgba(51, 136, 255, 0.3);
}

/* Ensure SVG icons display correctly */
.maplibregl-ctrl-icon.lasso-control,
.maplibregl-ctrl-icon.point-collector-control {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    cursor: pointer;
}

.maplibregl-ctrl-icon.lasso-control svg,
.maplibregl-ctrl-icon.point-collector-control svg {
    stroke: #333;
}

.maplibregl-ctrl-icon.lasso-control:hover svg,
.maplibregl-ctrl-icon.point-collector-control:hover svg {
    stroke: #000;
}

.maplibregl-ctrl-icon.lasso-control.active svg,
.maplibregl-ctrl-icon.point-collector-control.active svg {
    stroke: #3388ff;
}

/* LayerSwitcher Control */
.maplibre-layer-switcher {
    position: relative;
}

.maplibre-layer-switcher .layer-switcher-toggle {
    width: 29px;
    height: 29px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: none;
    border: none;
}

.maplibre-layer-switcher .layer-switcher-toggle svg {
    stroke: #333;
}

.maplibre-layer-switcher .layer-switcher-toggle:hover svg {
    stroke: #000;
}

.maplibre-layer-switcher .layer-switcher-content {
    display: none;
    position: absolute;
    top: 0;
    right: 29px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
    padding: 8px;
    min-width: 150px;
    white-space: nowrap;
    z-index: 1;
}

.maplibre-layer-switcher.expanded .layer-switcher-toggle {
    display: flex;
}

.maplibre-layer-switcher.expanded .layer-switcher-content {
    display: block;
}

.maplibre-layer-switcher .layer-switcher-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
}

.maplibre-layer-switcher .layer-switcher-title {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.maplibre-layer-switcher .layer-switcher-close {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0 4px;
    margin: -4px -4px -4px 8px;
}

.maplibre-layer-switcher .layer-switcher-close:hover {
    color: #000;
}

.maplibre-layer-switcher .layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #333;
    border-radius: 3px;
}

.maplibre-layer-switcher .layer-item:hover {
    background: #f0f0f0;
}

.maplibre-layer-switcher .layer-item input[type="radio"],
.maplibre-layer-switcher .layer-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.maplibre-layer-switcher .layer-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid black;
}

.maplibre-layer-switcher .layer-name {
    flex: 1;
}

.maplibre-layer-switcher .layer-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 6px 0;
}
