/* Custom Charging Station Marker Styles - Exact Template Match */

:root {
    --high-clr:#e6883d;
    --low-clr:#2ba859;
    --medium-clr:#0066cc;
    --medium-high-clr:#0891b2;
    --very-high-clr:#7c3aed;
    --ultra-clr:#c23333;
    --unknown-clr:#6b7280;
}
.custom-marker {
    
    --_border-width:2px;
    --_border-radius: 6px;
    --_font-size:11;
    position: relative;
    width: 45px;
    line-height: normal;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    box-shadow: 0 -6px 6px rgba(0, 0, 0, 0.1);
    border-radius: var(--_border-radius);
}

.custom-marker:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    z-index: 1000;
}

/* .marker-arrow {
    position: absolute;
    top: 97%;
    left: 0;
    width: 37px;
    height: 20px;
    clip-path: polygon(0% 98%, 0 0, 59% 0);
    z-index: 10;
} */

.custom-marker :is(.price, .power) {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .2em .5em .3em;
    font-size: calc(var(--_font-size) / 16 * 1rem);
    color: #ffffff;
}
.custom-marker .price {
    font-weight: 700;
    color: #333;
    background-color: #fff !important;
    border-top-left-radius: var(--_border-radius);
    border-top-right-radius: var(--_border-radius);
}

.custom-marker .power {
    border-bottom-left-radius: var(--_border-radius);
    border-bottom-right-radius: var(--_border-radius);
}

/* new classes*/

.custom-marker.power-high :is(.power, .marker-arrow, .price)  {
    background: var(--high-clr); 
}
.custom-marker.power-high .price  {
    border: var(--_border-width) solid var(--high-clr);
}
.custom-marker.power-low :is(.power, .marker-arrow, .price)  {
    background: var(--low-clr); 
}
.custom-marker.power-low .price  {
    border: var(--_border-width) solid var(--low-clr);
}

.custom-marker.power-medium :is(.power, .marker-arrow, .price)  {
    background: var(--medium-clr); 
}
.custom-marker.power-medium .price  {
    border: var(--_border-width) solid var(--medium-clr);
}

.custom-marker.power-medium :is(.power, .marker-arrow, .price)  {
    background: var(--medium-clr); 
}
.custom-marker.power-medium .price  {
    border: var(--_border-width) solid var(--medium-clr);
}

.custom-marker.power-medium-high :is(.power, .marker-arrow, .price)  {
    background: var(--medium-high-clr); 
}
.custom-marker.power-medium-high .price  {
    border: var(--_border-width) solid var(--medium-high-clr);
}

.custom-marker.power-very-high :is(.power, .marker-arrow, .price)  {
    background: var(--very-high-clr); 
}
.custom-marker.power-very-high .price  {
    border: var(--_border-width) solid var(--very-high-clr);
}

.custom-marker.power-ultra :is(.power, .marker-arrow, .price)  {
    background: var(--ultra-clr); 
}
.custom-marker.power-ultra .price  {
    border: var(--_border-width) solid var(--ultra-clr);
}

.custom-marker.power-unknown :is(.power, .marker-arrow, .price)  {
    background: var(--unknown-clr); 
}
.custom-marker.power-unknown .price  {
    border: var(--_border-width) solid var(--unknown-clr);
}

/* Responsive Größen */
@media (max-width: 768px) {
    .custom-marker :is(.price, .power) {
        --_font-size:10; 
    }
    .custom-marker {
        width: 60px;
    }
    .marker-arrow {
    width: 20px;
    height: 20px;
}
}

/* Animation beim Laden */
.custom-marker {
    animation: markerAppear 0.3s ease-out;
}

@keyframes markerAppear {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Spezielle Wrapper-Klasse für Leaflet DivIcon */
.custom-marker-wrapper {
    background: transparent !important;
    border: none !important;
    overflow: visible !important; /* WICHTIG: Damit Pfeile nicht abgeschnitten werden */
} 

/* Map Legend Styles */
.map-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    z-index: 1000;
    min-width: 240px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    opacity: 0.8 !important;
    transition: opacity 0.3s ease;
}

.map-legend h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

/* Grid Layout für zweispaltige Legende */
.legend-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.legend-column {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0;
}

.legend-color {
    width: 20px;
    height: 14px;
    border-radius: 3px;
    margin-right: 10px;
    flex-shrink: 0;
}

.legend-label {
    font-size: 13px;
    color: #374151;
    font-weight: 500;
}

/* Legend colors matching marker colors */
.legend-color.power-low {
    background: var(--low-clr);
}

.legend-color.power-medium {
    background: var(--medium-clr);
}

.legend-color.power-high {
    background: var(--medium-high-clr);
}

.legend-color.power-medium-high {
    background: var(--medium-high-clr);
}

.legend-color.power-very-high {
    background: var(--very-high-clr);
}

.legend-color.power-ultra {
    background: var(--ultra-clr);
}

/* Mobile Legend Toggle */
.map-legend-mobile-toggle {
    display: none;
    position: absolute;
    bottom: 4%;
    left: 4%;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 1001;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: #374151;
    transition: all 0.2s ease;
}

.map-legend-mobile-toggle:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

.map-legend-mobile-toggle:active {
    transform: scale(0.95);
}

/* Mobile optimization for legend */
@media (max-width: 768px) {
    .map-legend {
        bottom: 12%;
        left: 4%;
        padding: 12px;
        font-size: 12px;
        min-width: 85%;
        max-width: 90%;
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    }
    
    .map-legend.legend-visible {
        opacity: 0.8;
        visibility: visible;
        transform: translateY(0);
    }
    
    .legend-grid {
        gap: 8px;
    }
    
    .legend-column {
        gap: 4px;
    }
    
    .map-legend h4 {
        font-size: 13px;
        margin-bottom: 8px;
        text-align: center;
    }
    
    .legend-color {
        width: 14px;
        height: 10px;
        margin-right: 6px;
    }
    
    .legend-label {
        font-size: 11px;
    }
    
    .map-legend-mobile-toggle {
        display: flex;
    }
}

/* Desktop zeigt Legend immer an */
@media (min-width: 769px) {
    .map-legend {
        opacity: 0.8 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
    }
    
    .map-legend-mobile-toggle {
        display: none !important;
    }
}