/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
}

header h1 {
    margin-bottom: 1rem;
    text-align: center;
}

nav {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.nav-btn {
    padding: 0.5rem 1.5rem;
    border: 2px solid white;
    background: transparent;
    color: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.2);
}

.nav-btn.active {
    background: white;
    color: #667eea;
}

/* Main content */
main {
    padding: 2rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
}

.form-section h2 {
    margin-bottom: 1rem;
    color: #667eea;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.input-group input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.input-group button,
.primary-btn {
    padding: 0.75rem 1.5rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.input-group button:hover,
.primary-btn:hover {
    background: #5a6fd8;
}

.primary-btn {
    display: block;
    margin: 2rem auto;
    font-size: 1.1rem;
    padding: 1rem 2rem;
}

/* Items lists */
.items-list {
    display: grid;
    gap: 1rem;
}

.item {
    padding: 1rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.item-address {
    color: #666;
    font-size: 0.9rem;
}

.item-coords {
    color: #888;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.remove-btn {
    padding: 0.5rem 1rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.remove-btn:hover {
    background: #c82333;
}

/* Status messages */
.status {
    padding: 0.75rem;
    margin-top: 1rem;
    border-radius: 4px;
    font-weight: bold;
}

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

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

.status.loading {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Assignment interface */
.auto-assign-controls {
    margin-bottom: 2rem;
}

.auto-assign-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.auto-assign-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.clear-assign-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.clear-assign-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.manual-assignment {
    margin-top: 2rem;
}

.driver-assignment {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

.driver-assignment h3, .driver-assignment h4 {
    margin-bottom: 1rem;
    color: #667eea;
}

.pickup-checkboxes {
    display: grid;
    gap: 0.5rem;
}

.pickup-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid #eee;
    border-radius: 4px;
}

.pickup-checkbox input[type="checkbox"] {
    margin: 0;
}

/* Route results */
.driver-route {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

.driver-route h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.route-info {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.route-summary {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    border-left: 4px solid #667eea;
}

.pickup-times {
    margin-top: 1rem;
}

.pickup-time {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
}

/* Map */
#mapContainer {
    margin-top: 2rem;
    height: 500px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

#map {
    height: 100%;
    width: 100%;
}

/* Custom Leaflet marker styles */
.custom-marker {
    background: white;
    border: 2px solid #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.destination-marker {
    border-color: #FF0000;
    background: #FFE6E6;
}

.driver-marker {
    border-color: #0066CC;
    background: #E6F3FF;
}

.pickup-marker {
    border-color: #28a745;
    background: #E6F7E6;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255,255,255,0.3);
    border-top: 5px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* Responsive design */
@media (max-width: 768px) {
    .container {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
    
    header {
        padding: 1rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group input {
        min-width: auto;
    }
    
    nav {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .nav-btn {
        width: 100%;
    }
    
    #mapContainer {
        height: 300px;
    }
}

/* Utility classes */
.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

.text-success {
    color: #28a745;
}

.text-error {
    color: #dc3545;
}

.text-warning {
    color: #ffc107;
}

/* Provider badges and traffic information */
.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.provider-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.provider-badge.google-maps {
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
}

.provider-badge.osrm {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
}

.provider-badge.mock {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.provider-badge.unknown {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.traffic-info {
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid;
}

.traffic-info.traffic-light {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.traffic-info.traffic-moderate {
    background-color: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.traffic-info.traffic-heavy {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.traffic-info.traffic-unavailable {
    background-color: #e2e3e5;
    border-color: #6c757d;
    color: #495057;
}

.route-directions {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.directions-summary {
    margin-top: 0.5rem;
}

.leg-summary {
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background-color: white;
    border-radius: 4px;
    border-left: 3px solid #007bff;
}

.leg-summary:last-child {
    margin-bottom: 0;
}

.leg-summary small {
    color: #6c757d;
    display: block;
    margin-top: 0.25rem;
}

/* Mobile responsiveness for new elements */
@media (max-width: 768px) {
    .route-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .provider-badge {
        align-self: center;
    }
    
    .traffic-info {
        padding: 0.75rem;
    }
    
    .route-directions {
        padding: 0.75rem;
    }
    
    .leg-summary {
        padding: 0.5rem;
    }
}

/* Routing configuration styles */
.routing-config {
    margin-top: 1rem;
}

.config-group {
    margin-bottom: 1rem;
}

.config-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.help-text {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #007bff;
}

.help-text small {
    line-height: 1.4;
}

.help-text a {
    color: #007bff;
    text-decoration: none;
}

.help-text a:hover {
    text-decoration: underline;
}

#googleMapsApiKey {
    font-family: 'Courier New', monospace;
    background-color: #f8f9fa;
}

.status.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    padding: 0.75rem;
    border-radius: 4px;
    margin: 0.5rem 0;
}
}