/*
 * Bus Stop Map CSS - External stylesheet for enhanced maintainability
 */

/* Line Number Circle Styles - Ensure perfect circles */
.line-number-circle {
    border-radius: 50% !important;
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: bold !important;
    color: white !important;
    flex-shrink: 0 !important;
    min-width: 28px !important;
    min-height: 28px !important;
    box-sizing: border-box !important;
}

/* User Location Marker Popup Positioning Fix */
.user-location-marker .leaflet-popup-tip {
    background: white !important;
    border: 1px solid #ccc !important;
}

.user-location-marker-precise {
    position: relative !important;
}

.user-location-marker-precise .leaflet-popup-tip {
    background: white !important;
    border: 1px solid #ccc !important;
}

.custom-popup .leaflet-popup-content-wrapper {
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.custom-popup .leaflet-popup-tip {
    background: white !important;
    border: 1px solid #ccc !important;
}

/* Map Container Styles */
#map {
    height: 500px;
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid #e9ecef;
    position: relative;
    overflow: hidden;
}

#map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    text-align: center;
}

/* Search Container Styles */
.search-container {
    position: relative;
    margin-bottom: 20px;
}

#stationSearch {
    width: 100%;
    padding: 12px 45px 12px 15px !important;
    border: 2px solid #dee2e6 !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    transition: all 0.3s ease !important;
    background-color: #ffffff !important;
    color: #333 !important;
}

#stationSearch:focus {
    outline: none !important;
    border-color: #28a745 !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2) !important;
}

#clearSearchBtn {
    background: #000000 !important;
    border: 1px solid #000000 !important;
    color: white !important;
    font-size: 14px !important;
    cursor: pointer !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
    width: 100% !important;
}

#clearSearchBtn:hover {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
    transform: translateY(-1px) !important;
}

#mapSearchBtn {
    background: #000000 !important;
    border: 1px solid #000000 !important;
    color: white !important;
    transition: all 0.2s ease !important;
    font-size: 14px !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    width: 100% !important;
}

#mapSearchBtn:hover {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
    transform: translateY(-1px) !important;
}

/* Suggestions Dropdown */
#suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s ease;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
    background-color: #f8f9fa;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.suggestion-details {
    font-size: 12px;
    color: #6c757d;
}

.suggestion-match {
    background-color: #fff3cd;
    color: #856404;
    font-weight: bold;
}

/* Control Buttons - Black with Green Hover */
.controls-section {
    margin-bottom: 20px;
}

.btn-controls {
    margin-right: 8px;
    margin-bottom: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

/* Primary buttons - Black background with green hover */
.btn-primary {
    background: #333333 !important;
    border: 1px solid #333333 !important;
    color: white !important;
    transition: all 0.2s ease !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3) !important;
}

/* Outline buttons - Black outline with green hover */
.btn-outline-primary {
    background: transparent !important;
    border: 1px solid #333333 !important;
    color: #333333 !important;
    transition: all 0.2s ease !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3) !important;
}

/* Secondary buttons - keep existing style but ensure consistency */
.btn-secondary {
    background: #6c757d !important;
    border: 1px solid #6c757d !important;
    color: white !important;
    transition: all 0.2s ease !important;
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active {
    background: #545b62 !important;
    border-color: #545b62 !important;
    color: white !important;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #545b62 0%, #3d4449 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border: none;
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #a71e2a 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* Map Markers */
.vasteras-bus-stop-icon {
    transition: all 0.2s ease;
}

.vasteras-bus-stop-icon:hover {
    transform: scale(1.2);
}

.user-location-marker {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Custom Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 16px 18px 14px 18px;
    line-height: 1.5;
}

.custom-popup .leaflet-popup-content-wrapper {
    background: #ffffff;
    border: 1px solid #e9ecef;
}

.custom-popup .leaflet-popup-tip {
    background: #ffffff;
    border: 1px solid #e9ecef;
}

/* Transport Mode Icons */
.transport-icon {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    color: white;
    min-width: 28px;
    text-align: center;
}

.transport-bus {
    background-color: #007bff;
}

.transport-train {
    background-color: #28a745;
}

.transport-metro {
    background-color: #dc3545;
}

.transport-tram {
    background-color: #ffc107;
    color: #333;
}

.transport-ship {
    background-color: #17a2b8;
}

.transport-default {
    background-color: #6c757d;
}

/* Modal Enhancements */
.modal-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-radius: 8px 8px 0 0;
}

.modal-content {
    border-radius: 8px;
    border: none;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.modal-body {
    padding: 20px;
}

/* Loading Animation */
.spinner-border {
    width: 1.5rem;
    height: 1.5rem;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Alert Styles */
.alert {
    border-radius: 8px;
    border: none;
    padding: 12px 16px;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

/* Responsive Design */
@media (max-width: 768px) {
    #map {
        height: 400px;
        border-radius: 8px;
    }
    
    .btn-controls {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .modal-dialog {
        margin: 10px;
    }
    
    #stationSearch {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 576px) {
    #map {
        height: 350px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .suggestion-item {
        padding: 10px 12px;
    }
}

/* Print Styles */
@media print {
    #map {
        height: 400px;
        border: 1px solid #000;
    }
    
    .btn-controls,
    .search-container {
        display: none;
    }
}

/* Accessibility Improvements */
.btn:focus,
#stationSearch:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.suggestion-item:focus {
    outline: 2px solid #007bff;
    outline-offset: -2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    #map {
        border: 3px solid #000;
    }
    
    .btn-primary {
        background: #0000ff;
        border: 2px solid #000;
    }
    
    .btn-secondary {
        background: #666;
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .user-location-marker {
        animation: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .modal-content {
        background-color: #2d3748;
        color: #e2e8f0;
    }
    
    .modal-header {
        background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    }
    
    #suggestions {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .suggestion-item:hover,
    .suggestion-item.highlighted {
        background-color: #4a5568;
    }
    
    #stationSearch {
        background-color: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
}

/* Refresh button animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spin {
    animation: spin 1s linear infinite !important;
}

/* Departure refresh button styles */
.departure-refresh-btn {
    font-size: 10px !important;
    color: #007bff !important;
    cursor: pointer !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
}

.departure-refresh-btn:hover {
    background-color: #f0f8ff !important;
    color: #0056b3 !important;
}
