/* =====================
   Karten- und Leaflet-Styles
   ===================== */

/* 1. Karten-Container und Leaflet-Basis */
#map {
    background-color: var(--background-color-map);
    flex: 1;
    min-height: 0;
    position: relative;
    width: 100%;
}

#maps-page {
    height: 100%;
}

.leaflet-container {
    height: 100%;
    width: 100%;
}

/* 2. Map Controls (Container und Layout) */
.map-controls {
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    width: 90%;
}

/* 3. Control Groups */
.control-group {
}

/* 4. Zoom Info */
.zoom-info {
    background-color: var(--background-color-map);
    border-radius: 16px;
    color: var(--button-color-text);
    font-size: 0.85rem;
    margin: 0.5rem auto;
    padding: 0.75rem;
}

#zoom-level, #coordinates-display {
    font-family: var(--font-monospace);
    font-weight: normal;
}

/* 5. Selection Control Buttons */
.object-bulk-controls {
    display: flex;
    flex-direction: row;
    gap: 8px;
    justify-content: space-between;
}

.selection-button {
    background-color: var(--button-selection-color);
    border: 1px solid var(--button-selection-border);
    color: var(--button-color-text);
    cursor: pointer;
    flex-grow: 1;
    font-size: 0.8rem;
    margin: 0.25em 0;
    padding: 0.5em 0;
}
.selection-button:hover {
    background-color: var(--button-selection-color-hover);
}
.selection-button:active {
    position: relative;
    top: 1px;
}

.button-icon {
    margin-right: 0.5em;
    font-size: 1.5em;
    line-height: 0;
}

/* 6. Object Controls */
.object-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.object-type-control {
    background-color: var(--background-color-map);
    border-radius: 16px;
    color: var(--text-color-main);
    display: flex;
    justify-content: space-between;
    margin: 0.25em 0;
    padding: 7px 12px;
}

.object-type-control input[type="checkbox"] {
    cursor: pointer;
    margin: 0;
}

.object-type-control label {
    cursor: pointer;
    font-size: 0.9rem;
    text-transform: capitalize;
    user-select: none;
}

.object-type-label {
    align-items: left;
    display: flex;
    flex-grow: 1;
    line-height: 1.1;
    margin-left: 0.5rem;
}

.object-count {
    color: var(--button-color-text-neutral);
    font-weight: normal;
    margin-left: 0.25rem;
}

.color-sample {
    align-self: center;
    border: 1px solid var(--text-color-main);
    border-radius: 50%;
    display: inline-block;
    height: 1rem;
    width: 1rem;
}

/* 7. Marker und Popup Styles */
.map-object-icon {
    border-radius: 50%;
}
.object-icon {
    border-radius: 50%;
    border: 2px solid var(--text-color-main);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    height: 20px;
    transform-origin: center center;
    transition: transform 0.2s ease-in-out;
    width: 20px;
    z-index: 100;
}

/* Custom Icon Styles */
.object-icon.custom-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.object-icon.custom-icon:hover {
    transform: scale(1.1);
}

.object-icon.custom-icon img {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
    transform-origin: center center;
    transition: transform 0.2s ease;
}


.object-popup {
    padding: 0.2rem;
}
.object-popup p {
    font-size: 1rem;
    margin: 0.2rem !important;
}
.object-type {
    background-color: var(--button-color-text-neutral);
    border-radius: 4px;
    color: var(--text-color-main);
    display: inline-block;
    font-size: 1rem;
    font-weight: bold;
    padding: 4px 8px;
    text-transform: capitalize;
}

/* Spezifische Objekttyp-Labels */
.map-object-icon.garage + .leaflet-popup .object-type {
    background-color: #E74C3C;
}
.map-object-icon.secret_room + .leaflet-popup .object-type {
    background-color: #8E44AD;
}
.map-object-icon.glider + .leaflet-popup .object-type {
    background-color: #3498DB;
}
.map-object-icon.bear_cave + .leaflet-popup .object-type {
    background-color: #D35400;
}
.map-object-icon.bunker + .leaflet-popup .object-type {
    background-color: #27AE60;
}
.map-object-icon.lab_camp + .leaflet-popup .object-type {
    background-color: #F1C40F;
}
.map-object-icon.jump_tower + .leaflet-popup .object-type {
    background-color: #1ABC9C;
}
.map-object-icon.revive_station + .leaflet-popup .object-type {
    background-color: #95A5A6;
}

/* 8. Leaflet Controls und Attribution */
.leaflet-control-container {
    position: absolute;
    z-index: 1000;
}
.leaflet-top.leaflet-left {
    display: none; /* Verstecke die originale Position */
}
.leaflet-control-zoom {
    display: none;
}

/* 9. Place name labels */
.map-place-label {
    pointer-events: none; /* non-interactive */
    position: relative; /* anchor for absolute child */
}
.map-place-label .place-label-text {
    color: var(--text-color-main);
    font-size: 1rem;
    font-family: var(--font-sans-serif);
    font-weight: 500;
    left: 0;
    opacity: 0.75;
    padding: 0.1rem 0.25rem;
    position: absolute;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    top: 0;
    transform: translate(-50%, -50%); /* center on coordinate */
    user-select: none;
    white-space: nowrap;
    transform-origin: center center;
    transition: transform 0.2s ease-in-out;
    z-index: 80;
}

/* Inner span for zoom-only scaling so base factor composes */
.map-place-label .place-label-zoom {
    display: inline-block;
    transform-origin: center center;
    transition: transform 0.2s ease-in-out;
}

.place-label-zoom {
    line-height: 1.2;
}

/* Adjust the marker size based on zoom level */
.leaflet-container.zoom-1 .map-place-label .place-label-zoom {
    transform: scale(0.5);
}

.leaflet-container.zoom-2 .map-place-label .place-label-zoom {
    transform: scale(0.75);
}

.leaflet-container.zoom-1 .map-object-icon .object-icon {
    transform: scale(0.66);
}
