/* Modern Inter Font Global Styles */
* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* Custom CSS Variables for Modern Design */
:root {
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --secondary-gradient: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --dark-gradient: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    --light-bg: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.95);
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.3);
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: rgba(255, 255, 255, 0.95);
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-strong: 0 25px 50px rgba(0, 0, 0, 0.15);
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* General Styles */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--light-bg);
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
}

main {
    flex: 1;
    background: transparent;
    position: relative;
    z-index: 1;
    padding-top: 2rem;
}

/* Modern Header Styles */
.modern-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
    padding: 2.5rem 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.modern-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.02) 50%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.header-content {
    position: relative;
    z-index: 2;
}

.header-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.5rem;
}

.header-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    margin-bottom: 1rem;
}

.header-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.badge-ml {
    background: var(--success-gradient);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 500;
    box-shadow: var(--shadow-soft);
}

.badge-weather {
    background: var(--warning-gradient);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 500;
    box-shadow: var(--shadow-soft);
}

.badge-traffic {
    background: var(--secondary-gradient);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 500;
    box-shadow: var(--shadow-soft);
}

.header-controls {
    display: flex;
    align-items: center;
    position: relative;
    z-index: 2;
}

.language-selector {
    position: relative;
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-strong);
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 1000;
    margin-top: 0.5rem;
}

.language-selector:hover .language-dropdown,
.language-dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #333;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--border-radius-sm);
    margin: 0.25rem;
}

.language-option:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.flag-icon {
    width: 20px;
    height: 15px;
    margin-right: 0.5rem;
    border-radius: 2px;
}

.logo-container {
    width: 60px;
    height: 60px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: var(--shadow-soft);
}

/* Modern Card Styles */
.card {
    background: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-strong);
}

.card-header {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-header.bg-info {
    background: var(--success-gradient);
    color: var(--text-light);
}

.card-header.bg-primary {
    background: var(--primary-gradient);
    color: var(--text-light);
}

.card-header.bg-secondary {
    background: var(--dark-gradient);
    color: var(--text-light);
}

.card-body {
    padding: 1.5rem;
    background: white;
    color: var(--text-primary);
}

/* Modern Button Styles */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-strong);
}

.btn-success {
    background: var(--success-gradient);
    color: white;
    box-shadow: var(--shadow-soft);
}

.btn-outline-light {
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

/* Map Styles */
#map {
    width: 100%;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    z-index: 0;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Controllo informazioni sulla mappa */
.custom-map-info {
    padding: 12px;
    border-radius: 6px;
    max-width: 280px;
    box-shadow: 0 3px 14px rgba(0,0,0,0.4);
    z-index: 1000;
}

.map-marker-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(0, 123, 255, 0.9);
    color: white;
    width: 36px;
    height: 36px;
    font-weight: bold;
    border: 3px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.map-marker-icon:hover {
    transform: scale(1.1);
    z-index: 1000 !important;
}

.map-depot-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background-color: rgba(220, 53, 69, 0.9);
    color: white;
    width: 42px;
    height: 42px;
    font-size: 18px;
    border: 3px solid white;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4);
    transition: all 0.2s ease;
}

.map-depot-icon:hover {
    transform: scale(1.1);
    z-index: 1000 !important;
}

.stop-number {
    font-weight: bold;
    font-size: 14px;
}

/* Weather Icon Styles */
.weather-icon {
    width: 50px;
    height: 50px;
}

/* Custom Stop Form */
.stop-item {
    position: relative;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.25rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.stop-item:hover {
    background-color: rgba(0, 0, 0, 0.1);
    border-color: var(--bs-primary);
    transform: translateY(-2px);
}

.stop-number {
    background-color: var(--bs-primary);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.stop-item .stop-number {
    position: absolute;
    top: -10px;
    left: 10px;
}

.remove-stop-btn {
    position: absolute;
    top: 5px;
    right: 5px;
}

/* Marker evidenziato */
.highlighted-marker {
    transform: scale(1.2) !important;
    z-index: 1000 !important;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8) !important;
    border-width: 4px !important;
}

/* Marker pulsante */
.pulsing-marker {
    z-index: 1000;
}

.pulsing-marker .pulse {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(var(--bs-primary-rgb), 0.6);
    border: 2px solid var(--bs-primary);
    box-shadow: 0 0 8px var(--bs-primary);
    animation: pulse 1.5s infinite;
    left: -12px;
    top: -12px;
}

.pulsing-marker .marker {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--bs-primary);
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    left: -6px;
    top: -6px;
    z-index: 1001;
    font-weight: bold;
}

@keyframes pulse {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    70% {
        transform: scale(1.5);
        opacity: 0;
    }
    100% {
        transform: scale(0.5);
        opacity: 0;
    }
}

/* Stile tabella fermate */
#stops-table tr {
    cursor: pointer;
    transition: all 0.2s ease;
}

#stops-table tr:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
}

/* Progress Bars */
.progress {
    height: 0.75rem;
}

/* Google Maps Custom Controls */
.custom-map-control {
    margin: 10px;
}

/* Google Maps control buttons */
.custom-map-control button {
    background: white;
    border: none;
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: all 0.2s;
}

.custom-map-control button:hover {
    background: #f3f4f6;
}

.custom-map-control button.active {
    background: #3b82f6 !important;
    color: white !important;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #map {
        height: 350px !important;
    }
    
    .header-image, .footer-image {
        max-height: 30px !important;
    }
}

/* Weather Icon in Forecast */
.weather-forecast-icon {
    width: 30px;
    height: 30px;
}

/* Chart Containers */
canvas {
    width: 100% !important;
}

/* Fix date/time input transparency on focus */
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus {
    color: #212529 !important;
    background-color: #ffffff !important;
    opacity: 1 !important;
}

/* Fix model selector description text visibility */
#model-description {
    color: #1e3a8a !important;  /* Dark blue, fully opaque */
    opacity: 1 !important;
    font-weight: 500 !important;
}

#model-selector-container .text-muted {
    color: #1e3a8a !important;  /* Dark blue instead of gray */
    opacity: 1 !important;
}

/* Fix per tabelle Test Sperimentali - caratteri trasparenti */
.px-3.py-2.text-sm {
    color: #374151 !important;
    opacity: 1 !important;
}

.px-3.py-2.text-sm.text-gray-600 {
    color: #6b7280 !important;
    opacity: 1 !important;
}

.px-3.py-2.text-sm.font-medium {
    color: #1f2937 !important;
    opacity: 1 !important;
    font-weight: 500 !important;
}

/* Impact Visualization */
.impact-indicator {
    width: 15px;
    height: 15px;
    display: inline-block;
    border-radius: 50%;
    margin-right: 5px;
}

.impact-high {
    background-color: var(--bs-danger);
}

.impact-medium {
    background-color: var(--bs-warning);
}

.impact-low {
    background-color: var(--bs-success);
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 0.2em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
}

/* Developer Section Styles */
.developer-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    margin: 3rem 0;
    padding: 4rem 0;
    border-radius: var(--border-radius);
}

.developer-card {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius);
    padding: 3rem;
    box-shadow: var(--shadow-strong);
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.developer-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

.developer-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.12);
}

.developer-avatar {
    width: 100px;
    height: 100px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    margin: 0 auto 1.5rem;
    box-shadow: var(--shadow-soft);
    position: relative;
}

.developer-avatar::after {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    border: 2px solid rgba(79, 70, 229, 0.2);
    border-radius: 50%;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.2); opacity: 0; }
}

.developer-card h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.developer-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4f46e5;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.developer-description {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.developer-skills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.skill-badge {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    transition: var(--transition);
}

.skill-badge:hover {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-2px);
}

/* Modern Footer Styles */
.modern-footer {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    color: white;
    padding: 4rem 0 2rem;
    margin-top: 4rem;
    position: relative;
    overflow: hidden;
}

.modern-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="dots" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23dots)"/></svg>');
    opacity: 0.3;
}

.modern-footer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-gradient), var(--success-gradient), var(--warning-gradient));
}

.footer-brand {
    position: relative;
    z-index: 2;
}

.footer-brand h5 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.footer-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    font-weight: 300;
}

.footer-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    position: relative;
    z-index: 2;
}

.tech-badge {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition);
}

.tech-badge:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.footer-apis {
    position: relative;
    z-index: 2;
}

.footer-apis h6 {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.api-list {
    display: grid;
    gap: 0.75rem;
}

.api-badge {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    padding: 0.8rem 1.2rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.api-badge:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateX(5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.api-badge i {
    margin-right: 0.75rem;
    width: 16px;
    text-align: center;
}

.footer-divider {
    border-color: rgba(255, 255, 255, 0.15);
    margin: 3rem 0 1.5rem;
    position: relative;
    z-index: 2;
}

.footer-copyright {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    margin-bottom: 0;
    position: relative;
    z-index: 2;
    text-align: center;
    font-weight: 300;
}

/* Form Elements */
.form-control {
    border-radius: var(--border-radius-sm);
    border: 2px solid #e5e7eb;
    padding: 0.75rem 1rem;
    transition: var(--transition);
    background: white;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* Leaflet Popup Form Fixes */
.leaflet-popup-content .form-control {
    background: white !important;
    color: #1f2937 !important;
    border: 1px solid #d1d5db !important;
}

.leaflet-popup-content label {
    color: #1f2937 !important;
    font-weight: 500;
    margin-bottom: 4px;
    display: block;
}

.leaflet-popup-content .text-muted {
    color: #4b5563 !important;
    font-weight: 500;
    opacity: 1 !important;
}

.leaflet-popup-content .text-primary {
    color: #2563eb !important;
}

.leaflet-popup-content .input-group-text {
    background: #f3f4f6 !important;
    color: #1f2937 !important;
    border: 1px solid #d1d5db !important;
}

.form-control:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: white;
    color: #1f2937 !important;  /* Fix: mantieni il testo scuro quando l'input ha focus */
    outline: none;
}

.form-control::placeholder {
    color: var(--text-secondary);
}

.form-select {
    border-radius: var(--border-radius-sm);
    border: 2px solid #e5e7eb;
    background: white;
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

.form-select:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    color: #1f2937 !important;  /* Fix: mantieni il testo scuro quando il select ha focus */
    outline: none;
}

.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

/* Table Styles */
.table {
    background: white;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.table th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: none;
    font-weight: 600;
    color: var(--text-primary) !important;
    padding: 1rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    border: none;
    padding: 1rem;
    vertical-align: middle;
    color: var(--text-primary) !important;
    background: white !important;
    border-bottom: 1px solid #f1f5f9;
}

.table tbody tr {
    background: white !important;
}

.table tbody tr:hover {
    background: #f8fafc !important;
}

.table tbody tr:hover td {
    color: var(--text-primary) !important;
}

/* Badge Styles */
.badge {
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-weight: 500;
}

.badge.bg-primary {
    background: var(--primary-gradient) !important;
}

/* Progress Bar Enhancements */
.progress {
    height: 0.75rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    border-radius: 10px;
    transition: var(--transition);
}

.progress-bar.bg-danger {
    background: var(--secondary-gradient) !important;
}

.progress-bar.bg-info {
    background: var(--success-gradient) !important;
}

/* Modal Enhancements */
.modal-content {
    background: white;
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-strong);
}

.modal-header {
    border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 1.5rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-title {
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    color: var(--text-primary);
}

.modal-footer {
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Alert Enhancements */
.alert {
    border-radius: var(--border-radius-sm);
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 500;
}

.alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* Enhanced Stop Items for Route Creation */
.stop-item {
    background: white;
    border: 2px solid #f1f5f9;
    border-radius: var(--border-radius-sm);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: var(--transition);
    position: relative;
}

.stop-item:hover {
    border-color: #4f46e5;
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

/* Enhanced Input Groups */
.input-group .form-control {
    border-right: none;
}

.input-group .btn {
    border-left: none;
    border-color: #e5e7eb;
}

.input-group-text {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Enhanced Weather Display */
#weather-icon i {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

/* Enhanced Badge Components */
.badge.bg-primary {
    background: var(--primary-gradient) !important;
    box-shadow: var(--shadow-soft);
}

/* Enhanced Display Elements */
#prediction-time {
    font-weight: 700;
    background: var(--primary-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Enhanced Language Dropdown */
.language-dropdown {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: var(--shadow-strong);
}

.language-option:hover {
    background: #f8fafc;
    color: var(--text-primary);
}

/* Enhanced Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.6s ease-out;
}

.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.3s; }

/* Responsive Enhancements */
@media (max-width: 768px) {
    .header-title {
        font-size: 2rem;
    }
    
    .header-badges {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .api-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .language-dropdown {
        right: auto;
        left: 0;
    }
    
    #map {
        height: 350px !important;
    }
}

/* Navigation Links in Header */
.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link-header {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.nav-link-header:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

.nav-link-header.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(26, 35, 126, 0.3), rgba(74, 144, 226, 0.3));
    border-color: rgba(74, 144, 226, 0.5);
}

@media (max-width: 768px) {
    .nav-links {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .nav-link-header {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
}

/* ================================
   Leaflet Routing Machine Styles
   ================================ */

/* Dark theme compatibility for Leaflet Routing Machine */
.leaflet-routing-container {
    background: rgba(30, 41, 59, 0.95) !important;
    border: 1px solid rgba(71, 85, 105, 0.5) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.95) !important;
    font-family: 'Inter', sans-serif !important;
    z-index: 1000;
}

.leaflet-routing-container h2,
.leaflet-routing-container h3 {
    color: #ffffff !important;
    font-weight: 600;
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.leaflet-routing-alt {
    background: rgba(51, 65, 85, 0.7) !important;
    border: 1px solid rgba(71, 85, 105, 0.3) !important;
    border-radius: 8px;
    margin: 4px 0;
    transition: all 0.3s ease;
}

.leaflet-routing-alt:hover {
    background: rgba(59, 130, 246, 0.2) !important;
    border-color: rgba(59, 130, 246, 0.5) !important;
    transform: translateY(-1px);
}

.leaflet-routing-alt-first {
    background: rgba(59, 130, 246, 0.2) !important;
    border-color: rgba(59, 130, 246, 0.5) !important;
}

.leaflet-routing-instruction {
    color: rgba(255, 255, 255, 0.9) !important;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 500;
}

.leaflet-routing-instruction:hover {
    background: rgba(71, 85, 105, 0.3) !important;
}

.leaflet-routing-distance {
    color: rgba(34, 197, 94, 0.9) !important;
    font-weight: 600;
    background: rgba(34, 197, 94, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

.leaflet-routing-duration {
    color: rgba(59, 130, 246, 0.9) !important;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 4px;
}

/* Routing control buttons */
.leaflet-routing-container button {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
    border: 1px solid rgba(59, 130, 246, 0.5) !important;
    color: #ffffff !important;
    border-radius: 6px;
    padding: 6px 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.leaflet-routing-container button:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af) !important;
    border-color: rgba(37, 99, 235, 0.7) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Close button */
.leaflet-routing-close {
    background: rgba(239, 68, 68, 0.2) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: rgba(239, 68, 68, 0.9) !important;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.leaflet-routing-close:hover {
    background: rgba(239, 68, 68, 0.3) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
}

/* Routing line styles */
.leaflet-routing-line {
    stroke: #3b82f6 !important;
    stroke-width: 4px !important;
    stroke-opacity: 0.8 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}

.leaflet-routing-line-alternative {
    stroke: #6b7280 !important;
    stroke-width: 3px !important;
    stroke-opacity: 0.6 !important;
    stroke-dasharray: 10,5 !important;
}

/* Waypoint markers */
.leaflet-routing-marker {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border: 3px solid #ffffff !important;
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.4) !important;
}

/* Route summary panel */
.leaflet-routing-summary {
    background: rgba(16, 185, 129, 0.1) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
}

.leaflet-routing-summary h2,
.leaflet-routing-summary h3 {
    color: rgba(16, 185, 129, 0.9) !important;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

/* Enhanced visibility for mobile */
@media (max-width: 768px) {
    .leaflet-routing-container {
        max-width: calc(100vw - 40px) !important;
        font-size: 0.9rem;
    }
    
    .leaflet-routing-instruction {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    .leaflet-routing-container button {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
}

/* ================================
   Basic Routing Control Styles
   ================================ */

/* Custom routing markers */
.routing-marker {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(59, 130, 246, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.routing-marker:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.start-marker {
    border-color: rgba(16, 185, 129, 0.8) !important;
    background: rgba(16, 185, 129, 0.1) !important;
}

.end-marker {
    border-color: rgba(239, 68, 68, 0.8) !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

.waypoint-marker {
    border-color: rgba(245, 158, 11, 0.8) !important;
    background: rgba(245, 158, 11, 0.1) !important;
}

/* Routing instructions panel */
.routing-instructions {
    z-index: 1000 !important;
    max-width: 300px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.routing-instructions button:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.05);
}

/* Basic routing toggle button */
.leaflet-control-custom button {
    transition: all 0.3s ease;
}

.leaflet-control-custom button:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Routing line animations */
.leaflet-routing-line {
    animation: routingLineAnimation 2s ease-in-out infinite alternate;
}

@keyframes routingLineAnimation {
    0% {
        stroke-opacity: 0.6;
    }
    100% {
        stroke-opacity: 0.9;
    }
}

/* OSRM Error Message Styles */
.osrm-error-message {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001 !important;
    animation: slideUpFadeIn 0.4s ease-out;
}

@keyframes slideUpFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.osrm-error-message button {
    transition: all 0.2s ease;
}

.osrm-error-message button:hover {
    background: rgba(255, 255, 255, 0.4) !important;
    transform: scale(1.05);
}

/* Mobile responsive adjustments for basic routing */
@media (max-width: 768px) {
    .routing-instructions {
        max-width: calc(100vw - 60px);
        font-size: 0.8rem;
    }
    
    .routing-marker {
        transform: scale(0.8);
    }
    
    .leaflet-control-custom {
        margin: 5px !important;
    }
    
    .osrm-error-message {
        bottom: 10px;
        left: 10px;
        right: 10px;
        transform: none;
    }
}
