/* styles.css */
body { 
    background-color: #f8f9fa; 
}
#map { 
    height: 740px; 
    border-radius: 8px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
    cursor: crosshair; 
    background-color: #000000 !important;
    position: relative !important;
}
.panel { 
    background: #def3e1; 
    padding: 25px; 
    border-radius: 8px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid #adb5bd !important;
}
.history-item { 
    cursor: pointer; 
    transition: background 0.2s; 
}
.history-item:hover { 
    background-color: #f1f3f5 !important; 
}
.custom-x-marker {
    color: #e74c3c;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
    text-align: center;
    line-height: 1;
}

.custom-purple-x-marker {
    color: #9b59b6;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 1px 1px 2px black, -1px -1px 2px black, 1px -1px 2px black, -1px 1px 2px black;
    text-align: center;
    line-height: 1;
}

.layer-category-title { 
    font-size: 0.85rem; 
    font-weight: bold; 
    color: #495057; 
    border-bottom: 2px solid #dee2e6; 
    padding-bottom: 3px; 
    margin-top: 15px; 
    margin-bottom: 10px; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

/* RENDERING NITIDO E TRASPARENTE PER CATASTRO E CAPE WMS SOPRA IL SATELLITARE */
.leaflet-catastroPane-pane img {
    mix-blend-mode: normal !important;
}

.leaflet-bgWmsPane-pane img {
    mix-blend-mode: multiply !important;
}

.btn-brown {
    background-color: #795548 !important;
    border-color: #5d4037 !important;
    color: #ffffff !important;
    border: 1px solid #5d4037;
}
.btn-brown:hover {
    background-color: #6d4c41 !important;
    border-color: #4e342e !important;
    color: #ffffff !important;
}

.btn-brown-active {
    background-color: #3e2723 !important;
    border-color: #271c19 !important;
    color: #ffe0b2 !important;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.5) !important;
}
.btn-brown-active:hover {
    background-color: #271c19 !important;
    border-color: #1a100e !important;
    color: #ffffff !important;
}

#map-status-bar {
    min-height: 95px !important;
    padding: 5px 10px !important;
    background: #fdf2e9 !important;
}

#navbar-admin-icons {
    margin-left: 15px;
}

@media (min-width: 992px) {
    .map-sticky-container {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 8px !important;
        align-self: flex-start !important;
        z-index: 100;
    }
    #map {
        height: calc(100vh - 175px) !important;
        min-height: 480px !important;
    }
    .map-layer-icons-row {
        width: auto !important;
        margin-top: 0 !important;
        border-top: none !important;
        padding-top: 0 !important;
        padding-left: 20px !important;
    }
}

@media (max-width: 991.98px) {
    #map {
        height: 60vh !important;
        min-height: 320px;
    }
    .map-sticky-container {
        position: static !important;
    }
    .map-top-bar {
        padding: 8px 10px !important;
    }
    #navbar-admin-icons {
        justify-content: flex-end !important;
        gap: 10px !important;
        margin-left: auto !important;
        padding-right: 6px !important;
    }
    .map-layer-icons-row {
        width: 100% !important;
        justify-content: flex-end !important;
        gap: 0px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.15) !important;
        padding-top: 5px !important;
        margin-top: 5px !important;
        border-left: none !important;
        padding-left: 0 !important;
    }
    .status-text-col {
        width: 100% !important;
        flex: 0 0 100% !important;
    }
    .status-zoom-col {
        display: none !important;
    }
    #map-status-bar {
        min-height: auto !important;
    }
    .panel {
        padding: 15px !important;
    }
}

.ruler-label-popup .leaflet-popup-content-wrapper {
    background-color: transparent !important;
    background: transparent !important;
    color: #ffffff !important;
    font-weight: bold !important;
    font-size: 0.72rem !important;
    border-radius: 4px !important;
    padding: 1px 1px !important;
    box-shadow: none !important;
    text-shadow: 1px 1px 2px #000000, -1px -1px 2px #000000, 1px -1px 2px #000000, -1px 1px 2px #000000, 0 0 5px #000000 !important;
}
.ruler-label-popup .leaflet-popup-content {
    margin: 4px 8px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
}
.ruler-label-popup .leaflet-popup-tip-container {
    display: none !important;
}

.ruler-drawing-active .ruler-label-popup {
    pointer-events: none !important;
}

.leaflet-container a.leaflet-popup-close-button {
    color: #000000 !important;
    font-size: 18px !important;
    font-weight: bold !important;
    opacity: 1.0 !important;
    padding: 6px 6px 0 0 !important;
}
.leaflet-container a.leaflet-popup-close-button:hover {
    color: #ff3333 !important;
}

.custom-panel-container {
    background-color: #f8f9fa !important;
    border: 1px solid #adb5bd !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05) !important;
    padding: 15px !important;
    margin-bottom: 16px !important;
}

.utmgrid-icon-css {
    display: inline-grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 2px !important;
    width: 16px !important;
    height: 16px !important;
    vertical-align: middle !important;
    cursor: pointer !important;
    opacity: 0.5;
    transition: opacity 0.2s;
}
.utmgrid-icon-css div {
    background-color: currentColor !important;
    border-radius: 1px !important;
}

.text-secondary {
    color: #000000 !important;
}

.layer-btn-active {
    border: 2px solid #ffffff !important;
    border-radius: 6px !important;
    box-shadow: 0 0 5px rgba(255,255,255,0.8) !important;
}

.top-layer-icon {
    display: inline-block;
    padding: 2px 4px;
    border-radius: 6px;
    border: 2px solid transparent;
    transition: border-color 0.2s, background-color 0.2s, opacity 0.2s;
}

.top-layer-icon.layer-btn-active {
    border: 2px solid #ffffff !important;
    border-radius: 6px !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
}

#map-satellite-loader {
    position: absolute !important;
    bottom: 25px !important;
    left: 20px !important;
    z-index: 99999 !important;
    width: 54px !important;
    height: 54px !important;
    background-color: rgba(0, 0, 0, 0.80) !important;
    border: 2px solid #ffffff !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.6) !important;
    pointer-events: none !important;
    transition: opacity 0.25s ease, transform 0.25s ease !important;
    opacity: 0;
    visibility: hidden;
}

#map-satellite-loader.active {
    opacity: 1 !important;
    visibility: visible !important;
}

#map-satellite-loader #satellite-loader-icon, .satellite-spin {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 34px !important;
    height: 34px !important;
    margin-top: -17px !important;
    margin-left: -17px !important;
    font-size: 26px !important;
    line-height: 34px !important;
    text-align: center !important;
    display: inline-block !important;
    -webkit-transform-origin: center center !important;
    transform-origin: center center !important;
    -webkit-animation: satelliteRotate 2s linear infinite !important;
    animation: satelliteRotate 2s linear infinite !important;
    will-change: transform !important;
}

#map-satellite-loader #satellite-loader-text {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    -webkit-transform: translate(-50%, -50%) !important;
    z-index: 10 !important;
    color: #f1c40f !important;
    font-weight: 900 !important;
    font-size: 11px !important;
    font-family: monospace, sans-serif !important;
    text-shadow: 1px 1px 2px #000, -1px -1px 2px #000, 1px -1px 2px #000, -1px 1px 2px #000, 0 0 4px #000 !important;
    text-align: center !important;
    line-height: 1 !important;
    pointer-events: none !important;
}

@-webkit-keyframes satelliteRotate {
    0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
    100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}

@keyframes satelliteRotate {
    0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
    100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}

#map-mobile-3d-btn {
    position: absolute;
    top: 25px;
    right: 20px;
    z-index: 1000;
    width: 54px;
    height: 54px;
    background-color: rgba(0, 0, 0, 0.80);
    border: 2px solid #ffffff;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#map-mobile-3d-btn span {
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

#map-mobile-pointer-btn {
    position: absolute;
    bottom: 25px;
    right: 20px;
    z-index: 1000;
    width: 54px;
    height: 54px;
    background-color: rgba(0, 0, 0, 0.80);
    border: 2px solid #ffffff;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#map-mobile-pointer-btn span {
    font-size: 26px;
    line-height: 1;
}