/**
 * Charging Stations Interactive Map Styles
 */

/* Map Container */
.charging-stations-map-container {
    max-width: 100%;
    margin: 2rem 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Alerts */
#map-alerts {
    margin-bottom: 1rem;
}

.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.3s ease-out;
}

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-icon {
    font-size: 1.5rem;
}

.alert-message {
    flex: 1;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Map Controls */
.map-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.controls-left,
.controls-right {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.filter-btn,
.btn-locate,
.btn-route,
.btn-navigate {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.938rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
    transform: translateY(-1px);
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: white;
    color: #495057;
    border: 2px solid #dee2e6;
    padding: 0.5rem 1rem;
}

.filter-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.filter-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Map Layout */
.map-layout {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.map-layout.with-sidebar {
    grid-template-columns: 1fr 380px;
}

@media (max-width: 1024px) {
    .map-layout.with-sidebar {
        grid-template-columns: 1fr;
    }
}

/* Map Wrapper */
.map-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#charging-stations-map {
    width: 100%;
    border-radius: 12px;
}

/* Map Legend */
.map-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    max-width: 200px;
    z-index: 1000;
}

.map-legend h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.938rem;
    font-weight: 600;
    color: #212529;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.813rem;
    color: #495057;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-icon.user-icon {
    background: #007bff;
    border: 2px solid white;
    box-shadow: 0 0 0 1px #007bff;
}

/* Stations Sidebar */
.stations-sidebar {
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 600px;
}

.sidebar-header {
    padding: 1.5rem;
    background: white;
    border-bottom: 1px solid #dee2e6;
}

.sidebar-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    color: #212529;
}

.station-count {
    margin: 0;
    font-size: 0.875rem;
    color: #6c757d;
}

.stations-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Custom Scrollbar */
.stations-list::-webkit-scrollbar {
    width: 8px;
}

.stations-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.stations-list::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

.stations-list::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #6c757d;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* Station Cards */
.station-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    cursor: pointer;
}

.station-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.station-card:last-child {
    margin-bottom: 0;
}

.station-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.station-card-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    flex: 1;
}

.station-distance-badge {
    background: #007bff;
    color: white;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.station-card-body {
    font-size: 0.875rem;
}

.station-meta {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-dc {
    background: #fff0f0;
    color: #dc3545;
    border: 1px solid #f5c6cb;
}

.badge-ac {
    background: #e7f3ff;
    color: #007bff;
    border: 1px solid #bee5eb;
}

.badge-power {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.station-address {
    margin: 0 0 0.75rem 0;
    color: #6c757d;
    font-size: 0.813rem;
    line-height: 1.4;
}

.station-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-locate,
.btn-route {
    flex: 1;
    min-width: 100px;
    padding: 0.5rem 0.75rem;
    background: #007bff;
    color: white;
    font-size: 0.813rem;
}

.btn-locate:hover,
.btn-route:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-navigate {
    flex: 1;
    min-width: 100px;
    padding: 0.5rem 0.75rem;
    background: #28a745;
    color: white;
    font-size: 0.813rem;
}

.btn-navigate:hover {
    background: #218838;
    transform: translateY(-1px);
}

/* Station Popup (for map markers) */
.station-popup h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: #212529;
}

.station-distance {
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: #e7f3ff;
    border-radius: 4px;
    font-size: 0.875rem;
}

.station-info p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.station-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.btn-directions {
    flex: 1;
    padding: 0.5rem 1rem;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-directions:hover {
    background: #0056b3;
}

/* Instructions */
.map-instructions {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.map-instructions h4 {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    color: #212529;
}

.map-instructions ol {
    margin: 0;
    padding-left: 1.5rem;
}

.map-instructions li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
    color: #495057;
}

.map-instructions li:last-child {
    margin-bottom: 0;
}

.map-instructions strong {
    color: #212529;
}

/* Responsive Design */
@media (max-width: 768px) {
    .map-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls-left,
    .controls-right {
        width: 100%;
        justify-content: center;
    }
    
    .filter-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .map-legend {
        position: static;
        margin-top: 1rem;
        max-width: 100%;
    }
    
    .station-card-actions {
        flex-direction: column;
    }
    
    .btn-locate,
    .btn-route,
    .btn-navigate {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .charging-stations-map-container {
        margin: 1rem -1rem;
    }
    
    .map-controls {
        border-radius: 0;
        padding: 0.75rem;
    }
    
    .map-wrapper {
        border-radius: 0;
    }
    
    #charging-stations-map {
        border-radius: 0;
    }
    
    .stations-sidebar {
        border-radius: 0;
    }
    
    .btn-primary,
    .btn-secondary,
    .filter-btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
}

/* Leaflet Specific Adjustments */
.leaflet-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

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

.leaflet-popup-content {
    margin: 1rem;
    min-width: 250px;
}

/* Google Maps Specific Adjustments */
.gm-style .gm-style-iw-c {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gm-style .gm-style-iw-d {
    overflow: auto !important;
}

/* Print Styles */
@media print {
    .map-controls,
    .stations-sidebar,
    .map-legend {
        display: none;
    }
    
    #charging-stations-map {
        height: 600px !important;
        page-break-inside: avoid;
    }
}

/* Accessibility */
.btn-primary:focus,
.btn-secondary:focus,
.filter-btn:focus,
.btn-locate:focus,
.btn-route:focus,
.btn-navigate:focus {
    outline: 3px solid #007bff;
    outline-offset: 2px;
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    .charging-stations-map-container {
        color: #e9ecef;
    }
    
    .map-controls,
    .stations-sidebar,
    .map-instructions {
        background: #212529;
        border-color: #495057;
    }
    
    .station-card,
    .sidebar-header,
    .map-legend {
        background: #343a40;
        color: #e9ecef;
    }
    
    .station-card-header h4,
    .sidebar-header h3,
    .map-instructions h4 {
        color: #f8f9fa;
    }
    
    .station-address,
    .station-count,
    .map-instructions li {
        color: #adb5bd;
    }
}