/**
 * Frontend styles for Car Locations Map
 */

/* Map Container */
.car-locations-map-container {
    position: relative;
    margin: 20px 0;
}

.car-locations-map {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f9f9f9;
}

.car-locations-map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    background-color: #f9f9f9;
    color: #666;
    font-size: 16px;
}

.car-locations-map-loading p {
    margin: 0;
}

.car-locations-map-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    background-color: #fff5f5;
    color: #d63384;
    font-size: 16px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

.car-locations-map-error p {
    margin: 0;
}

.car-locations-map-notice {
    padding: 15px;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    color: #856404;
    margin: 20px 0;
}

/* Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.car-location-popup {
    max-width: 280px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.car-location-popup .popup-image {
    margin-bottom: 12px;
}

.car-location-popup .popup-image img {
    width: 100%;
    height: auto;
    max-height: 150px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.car-location-popup .popup-content {
    padding: 0;
}

.car-location-popup .vehicle-name {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #000000 !important;
    line-height: 1.3;
}

.car-location-popup .address {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #000000 !important;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.car-location-popup .address-icon {
    font-size: 12px;
    margin-top: 2px;
    flex-shrink: 0;
}

.car-location-popup .description {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #000000 !important;
    line-height: 1.4;
}

.car-location-popup .popup-actions {
    margin-top: 12px;
}

.car-location-popup .learn-more-btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: #0000FF;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.car-location-popup .learn-more-btn:hover {
    background-color: #0A1E4B;
    color: white;
    text-decoration: none;
}

.car-location-popup .learn-more-btn:focus {
    outline: 2px solid #0A1E4B;
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .car-locations-map-container {
        margin: 15px 0;
    }
    
    .car-location-popup {
        max-width: 250px;
    }
    
    .car-location-popup .vehicle-name {
        font-size: 16px;
    }
    
    .car-location-popup .address,
    .car-location-popup .description {
        font-size: 13px;
    }
    
    .car-location-popup .learn-more-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .car-locations-map {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .car-location-popup {
        max-width: 220px;
    }
    
    .car-location-popup .popup-image img {
        max-height: 120px;
    }
}

/* Leaflet Control Customization */
.car-locations-map .leaflet-control-zoom {
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.car-locations-map .leaflet-control-zoom a {
    background-color: white;
    border: 1px solid #ccc;
    color: #333;
    font-weight: bold;
}

.car-locations-map .leaflet-control-zoom a:hover {
    background-color: #f4f4f4;
    border-color: #999;
}

.car-locations-map .leaflet-control-attribution {
    background-color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
}

/* Loading Animation */
.car-locations-map-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility Improvements */
.car-location-popup .learn-more-btn:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .car-locations-map {
        border-color: #000;
    }
    
    .car-location-popup .learn-more-btn {
        background-color: #000;
        border: 2px solid #000;
    }
    
    .car-location-popup .learn-more-btn:hover {
        background-color: #333;
        border-color: #333;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .car-location-popup .learn-more-btn {
        transition: none;
    }
    
    .car-locations-map-loading::after {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .car-locations-map-container {
        break-inside: avoid;
    }
    
    .car-locations-map {
        border: 2px solid #000;
        background: white;
    }
    
    .leaflet-control-zoom,
    .leaflet-control-attribution {
        display: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .car-locations-map {
        border-color: #555;
        background-color: #2a2a2a;
    }
    
    .car-locations-map-loading {
        background-color: #2a2a2a;
        color: #ccc;
    }
    
    .car-locations-map-notice {
        background-color: #3a3a2a;
        border-color: #5a5a2a;
        color: #e6d700;
    }
    
    .car-location-popup .vehicle-name {
        color: #fff;
    }
    
    .car-location-popup .address {
        color: #ccc;
    }
    
    .car-location-popup .description {
        color: #ddd;
    }
}

/* Widget Compatibility */
.widget .car-locations-map-container {
    margin: 10px 0;
}

.widget .car-locations-map {
    min-height: 250px;
}

/* Theme Compatibility */
.entry-content .car-locations-map-container,
.post-content .car-locations-map-container,
.page-content .car-locations-map-container {
    clear: both;
}

/* RTL Support */
.rtl .car-location-popup .address {
    flex-direction: row-reverse;
}

.rtl .car-location-popup .address-icon {
    margin-left: 6px;
    margin-right: 0;
}
