/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
}

html {
    height: 100%;
}

body {
    background-color: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

/* Header */
header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.8rem;
}

/* Layout */
.container {
    display: flex;
    gap: 20px;
    padding: 20px;
    max-width: 100%;
    height: calc(100vh - 80px);
}

.left-column {
    flex: 1;
    min-width: 350px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.right-column {
    flex: 2;
    min-width: 600px;
    display: flex;
    flex-direction: column;
}

section {
    background: white;
    padding: 1.5rem;
    margin-bottom: 0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Fixed chatbox section */
.chatbox-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.chatbox {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* Fixed chat input container */
.chat-input-container {
    display: flex;
    gap: 10px;
    padding-top: 1rem;
    margin-top: auto;
    flex-shrink: 0;
    background: white;
    position: relative;
    z-index: 10;
}

#chatInput {
    flex: 1;
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
}

.map-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#map {
    flex: 1;
    width: 100%;
    border-radius: 8px;
    border: 1px solid #ddd;
}

/* Typography */
h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

label {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

/* Upload Section */
.upload-section {
    margin-bottom: 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    position: relative;
}

.upload-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 8px 8px 0 0;
}

.upload-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

input[type="file"] {
    flex: 1;
    padding: 0.75rem;
    border: 2px dashed #ddd;
    border-radius: 4px;
    background: #fafafa;
    transition: all 0.3s ease;
}

/* Buttons */
button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* Enhanced Vehicle Popup Styles */
.vehicle-popup {
    min-width: 320px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    padding: 5px;
}

.vehicle-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    margin-top: 4px;
}

.status-available {
    background: #e8f5e8;
    color: #27ae60;
}

.status-in-transit {
    background: #fff3cd;
    color: #e67e22;
}

.vehicle-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
}

.detail-label {
    font-weight: bold;
    color: #666;
    font-size: 12px;
}

.detail-value {
    font-size: 12px;
    color: #333;
    text-align: right;
}

/* Popup Button Styles */
.popup-btn {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.2s;
    text-align: center;
}

.popup-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    opacity: 0.9;
}

.popup-btn:active {
    transform: translateY(0);
}

.popup-btn-danger {
    background: #e74c3c;
    color: white;
}

.popup-btn-success {
    background: #27ae60;
    color: white;
}

/* Button Container */
.popup-button-container {
    margin-top: 15px;
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

/* Warehouse Popup Styles */
.warehouse-popup {
    min-width: 200px;
    font-family: Arial, sans-serif;
}

.warehouse-popup b {
    color: #2c3e50;
    font-size: 14px;
}

.warehouse-popup small {
    color: #7f8c8d;
    font-size: 11px;
}

/* Route Popup Styles */
.route-popup {
    min-width: 200px;
    font-family: Arial, sans-serif;
}

.route-popup b {
    color: #2c3e50;
    font-size: 14px;
}

.route-popup small {
    color: #7f8c8d;
    font-size: 11px;
}

/* Status Messages */
#uploadStatus {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 4px solid transparent;
}

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

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

/* Map Controls */
.map-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.map-type-selector {
    display: flex;
    gap: 10px;
}

.map-control-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.map-control-btn.active {
    background-color: #2980b9;
}

.map-control-btn:hover {
    background-color: #2980b9;
}

#clearMapBtn {
    background-color: #dc3545;
}

#clearMapBtn:hover {
    background-color: #c82333;
}

/* Chat Messages */
.chatbox .message {
    margin-bottom: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-radius: 20px;
    max-width: 85%;
    line-height: 1.4;
    word-wrap: break-word;
}

.chatbox .system-message {
    background: #e9ecef;
    color: #2c3e50;
    align-self: flex-start;
}

.chatbox .user-message {
    background: #3498db;
    color: white;
    align-self: flex-end;
}

.chatbox .bot-message {
    background: #28a745;
    color: white;
    align-self: flex-start;
}

/* Enhanced Section Headers */
.section-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
    border-radius: 8px 8px 0 0;
}

.section-header h3 {
    color: white;
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
    margin-right: 5px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Progress Bars */
.progress-bar {
    display: inline-block;
    width: 60px;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    margin-right: 8px;
    vertical-align: middle;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-fill.fuel {
    background: #27ae60;
}

.progress-fill.route {
    background: #3498db;
}

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

.leaflet-popup-content {
    margin: 8px 12px;
    line-height: 1.4;
    min-height: 250px;
    display: flex;
    flex-direction: column;
}

.leaflet-popup-tip {
    background: white;
}

/* Ensure popup is large enough to show buttons */
.leaflet-popup {
    bottom: 20px !important;
}

/* Color coding for specific values */
.eta-value {
    color: #e74c3c;
    font-weight: bold;
}

.duration-value {
    color: #2c3e50;
    font-weight: bold;
}

.mileage-value {
    color: #9b59b6;
    font-weight: bold;
}

.cost-value {
    color: #27ae60;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 80px);
    }
    .left-column, .right-column {
        min-width: 100%;
    }
    .map-controls {
        flex-direction: column;
        gap: 1rem;
    }
    .map-type-selector {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 768px) {
    .chat-input-container {
        flex-direction: column;
    }
    #chatInput {
        width: 100%;
    }
    
    .upload-controls {
        flex-direction: column;
    }
    
    .section-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .map-type-selector {
        flex-wrap: wrap;
    }
    
    .vehicle-popup {
        min-width: 280px;
    }
    
    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .detail-value {
        text-align: left;
    }
    
    .popup-btn {
        font-size: 12px;
        padding: 8px 10px;
    }
    
    .leaflet-popup-content-wrapper {
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
        gap: 15px;
    }
    
    section {
        padding: 1rem;
    }
    
    .vehicle-popup {
        min-width: 260px;
    }
    
    .popup-button-container {
        flex-direction: column;
    }
    
    .popup-btn {
        width: 100%;
    }
}

/* Animation for smooth transitions */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* Scrollbar styling for webkit browsers */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus states for accessibility */
button:focus,
input:focus,
textarea:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .chat-input-container,
    .map-controls,
    .upload-controls {
        display: none;
    }
    
    .container {
        flex-direction: column;
        height: auto;
    }
}

/* AUTH MODAL FIXES */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.4s ease;
    display: flex;
    flex-direction: column;
}

.auth-container {
    display: flex;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

/* Left Side - Branding */
.auth-branding {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 500px;
}

.auth-branding::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" opacity="0.1"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="2" fill="white"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
}

.brand-logo {
    margin-bottom: 2rem;
    position: relative;
    z-index: 2;
}

.brand-logo h2 {
    font-size: 2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo h2::before {
    content: '🚚';
    font-size: 2.2rem;
}

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

.brand-content h1 {
    font-size: 2.2rem;
    margin-bottom: 1.2rem;
    font-weight: 800;
    line-height: 1.1;
}

.brand-content p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.feature-item:last-child {
    border-bottom: none;
}

.feature-item span {
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Right Side - Forms */
.auth-forms {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
    background: #f8fafc;
    max-height: 100%;
    min-height: 500px;
}

.auth-forms::-webkit-scrollbar {
    width: 6px;
}

.auth-forms::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.auth-forms::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.auth-forms::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.form-tabs {
    display: flex;
    background: white;
    border-radius: 12px;
    padding: 6px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 10;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 1rem 1.2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    color: #64748b;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.auth-form {
    display: none;
    min-height: 0;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 0.9rem 1.1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
    color: #94a3b8;
}

.auth-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
    color: #64748b;
    font-weight: 500;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
}

.auth-divider span {
    background: #f8fafc;
    padding: 0 1.2rem;
}

.demo-btn {
    width: 100%;
    padding: 1rem;
    background: white;
    color: #1e293b;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.demo-btn:hover {
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.demo-btn::before {
    content: '🎮';
    font-size: 1.1rem;
}

/* Subscription Info */
.subscription-info {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e2e8f0;
}

.subscription-info h4 {
    margin-bottom: 1.2rem;
    color: #1e293b;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
}

.plan-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.2rem;
}

.plan-card {
    padding: 1.5rem 1.2rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
    position: relative;
    overflow: hidden;
}

.plan-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.plan-card.freemium::before {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.plan-card.premium::before {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.plan-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.plan-card h5 {
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
}

.plan-card .price {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 1.2rem;
}

.plan-card.freemium .price {
    color: #667eea;
}

.plan-card.premium .price {
    color: #f59e0b;
}

.plan-card ul {
    list-style: none;
    text-align: left;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.plan-card li {
    margin-bottom: 0.6rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.plan-card li:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Upgrade Modal */
.upgrade-modal {
    max-width: 480px;
    text-align: center;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.upgrade-header {
    padding: 2.5rem 2rem 1.5rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    position: relative;
}

.upgrade-header::before {
    content: '🚀';
    font-size: 3rem;
    display: block;
    margin-bottom: 0.8rem;
}

.upgrade-header h2 {
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
    font-weight: 800;
}

.upgrade-header p {
    font-size: 1rem;
    opacity: 0.9;
}

.upgrade-content {
    padding: 2rem 1.5rem;
}

.limit-info {
    margin-bottom: 2rem;
}

.limit-badge {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.limit-badge .current {
    color: #ef4444;
}

.limit-badge .divider {
    color: #cbd5e1;
    font-weight: 400;
}

.limit-badge .max {
    color: #64748b;
}

.limit-info p {
    color: #64748b;
    font-size: 1rem;
    font-weight: 500;
}

.premium-features {
    text-align: left;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 4px solid #f59e0b;
}

.premium-features h4 {
    margin-bottom: 1.2rem;
    color: #1e293b;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
}

.premium-features ul {
    list-style: none;
}

.premium-features li {
    margin-bottom: 0.8rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 500;
    color: #1e293b;
    font-size: 0.9rem;
}

.premium-features li:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.premium-features li::before {
    content: '✅';
    font-size: 1rem;
    background: #dcfce7;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.upgrade-actions {
    padding: 1.5rem;
    display: flex;
    gap: 0.8rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.upgrade-actions .btn-primary {
    flex: 2;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.upgrade-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

.upgrade-actions .btn-secondary {
    flex: 1;
    background: white;
    color: #64748b;
    border: 2px solid #e2e8f0;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upgrade-actions .btn-secondary:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

/* User Info in Header */
.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    color: white;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.user-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.4rem 0.8rem;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.user-badge.premium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.logout-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Warehouse Limit Display */
.warehouse-limit {
    margin-top: 1.2rem;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px;
    color: white;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.limit-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
}

.limit-count {
    font-weight: 700;
    font-size: 1rem;
}

.upgrade-link {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.upgrade-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.limit-indicator.premium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.limit-indicator.premium .limit-count {
    color: #fef3c7;
}

/* Responsive Design for Auth */
@media (max-width: 968px) {
    .auth-container {
        flex-direction: column;
        min-height: auto;
    }
    
    .auth-branding {
        min-height: 300px;
        padding: 2rem;
        text-align: center;
    }
    
    .brand-content h1 {
        font-size: 1.8rem;
    }
    
    .auth-forms {
        min-height: 400px;
        padding: 2rem;
        max-height: 50vh;
    }
    
    .plan-cards {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
}

@media (max-width: 640px) {
    .modal {
        padding: 10px;
        align-items: flex-start;
    }
    
    .modal-content {
        max-height: 95vh;
        margin: 10px 0;
        border-radius: 16px;
    }
    
    .auth-branding {
        min-height: 250px;
        padding: 1.5rem;
    }
    
    .auth-forms {
        padding: 1.5rem;
        min-height: 350px;
    }
    
    .brand-content h1 {
        font-size: 1.6rem;
    }
    
    .form-tabs {
        flex-direction: column;
        gap: 0.4rem;
    }
    
    .upgrade-actions {
        flex-direction: column;
    }
    
    .user-info {
        flex-direction: column;
        gap: 0.4rem;
        text-align: right;
    }
}

@media (max-height: 700px) {
    .auth-branding {
        min-height: 200px;
        padding: 1.2rem;
    }
    
    .auth-forms {
        min-height: 300px;
        padding: 1.2rem;
    }
    
    .brand-content h1 {
        font-size: 1.4rem;
        margin-bottom: 0.8rem;
    }
    
    .feature-item {
        font-size: 0.9rem;
        padding: 0.4rem 0;
    }
}

/* Loading States */
.btn-loading {
    display: none;
}

.auth-btn.loading .btn-text {
    display: none;
}

.auth-btn.loading .btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-btn.loading .btn-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Keyframes for animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    .modal {
        -webkit-overflow-scrolling: touch;
    }
    
    .auth-forms {
        -webkit-overflow-scrolling: touch;
    }
}


.google-signin-btn {
    width: 100%;
    padding: 1rem;
    background: white;
    color: #333;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.google-signin-btn:hover {
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}


.alternative-route-marker {
    background: transparent !important;
    border: none !important;
}

.route-popup .leaflet-popup-content-wrapper {
    background: #fefefe;
    border-left: 4px solid #e74c3c;
}

.alternative-route-popup {
    background: #fff3cd;
    border-left: 4px solid #e67e22;
}


/* Vehicle Dashboard Styles */
.vehicle-dashboard {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    border: 2px solid #3498db;
    overflow: hidden;
    display: none;
    max-height: 500px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.dashboard-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2980b9;
}

.dashboard-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.vehicle-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.dashboard-content {
    padding: 0;
}

.vehicle-card {
    padding: 15px 20px;
    border-bottom: 1px solid #ecf0f1;
    background: white;
}

.vehicle-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.vehicle-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.vehicle-type {
    background: #3498db;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.vehicle-status {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 8px;
}

.status-available { color: #27ae60; }
.status-in-transit { color: #f39c12; }
.status-maintenance { color: #e74c3c; }

.vehicle-progress {
    margin: 8px 0;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #ecf0f1;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #7f8c8d;
    margin-top: 4px;
}

.vehicle-details {
    margin-top: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
}

.detail-label {
    color: #7f8c8d;
    font-weight: 500;
}

.detail-value {
    color: #2c3e50;
    font-weight: 600;
}

.stop-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 12px;
}

.stop-btn:hover {
    background: #c0392b;
}

.dashboard-controls {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #ecf0f1;
}

.nav-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-right: 8px;
}

.nav-btn:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-1px);
}

.nav-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.close-dashboard {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.close-dashboard:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.no-vehicles {
    padding: 40px 20px;
    text-align: center;
    color: #7f8c8d;
}

.no-vehicles i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.vehicle-route {
    font-size: 11px;
    color: #3498db;
    margin-top: 4px;
    font-weight: 500;
}

.alternative-route-badge {
    background: #e74c3c;
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    margin-left: 8px;
}

/* Animation for dashboard */
@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.vehicle-dashboard[style*="display: block"] {
    animation: slideInUp 0.3s ease-out;
}

.dashboard-toggle {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: #3498db;
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 999;
    transition: all 0.3s ease;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-toggle:hover {
    background: #2980b9;
    transform: scale(1.1);
}

/* Hub-specific styles */
.hub-marker {
    background: transparent !important;
    border: none !important;
}

.hub-popup {
    min-width: 200px;
    font-family: Arial, sans-serif;
}

.hub-popup b {
    color: #9b59b6;
    font-size: 14px;
}

/* Route Legend */
.route-legend {
    background: white;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    font-family: Arial, sans-serif;
    max-width: 250px;
}

.route-legend h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #2c3e50;
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 5px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    font-size: 12px;
}

.legend-color {
    width: 20px;
    height: 4px;
    margin-right: 8px;
    border-radius: 2px;
}

/* Multiple route colors */
.route-color-1 { background-color: #3498db; }
.route-color-2 { background-color: #e74c3c; }
.route-color-3 { background-color: #f39c12; }
.route-color-4 { background-color: #2ecc71; }
.route-color-5 { background-color: #1abc9c; }
.route-color-6 { background-color: #9b59b6; }
.route-color-7 { background-color: #34495e; }

/* Enhanced vehicle dashboard for multiple routes */
.vehicle-route-info {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
}

.route-type-badge {
    background: #3498db;
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    margin-left: 8px;
}

.route-type-hub {
    background: #9b59b6;
}

.route-type-alternative {
    background: #e74c3c;
}

/* Alternative route styles */
.alternative-route-marker {
    background: transparent !important;
    border: none !important;
}

.route-popup .leaflet-popup-content-wrapper {
    background: #fefefe;
    border-left: 4px solid #e74c3c;
}

.alternative-route-popup {
    background: #fff3cd;
    border-left: 4px solid #e67e22;
}

/* Hub connection styles */
.hub-connection-popup {
    background: #f0e6ff;
    border-left: 4px solid #9b59b6;
}

/* Vehicle status for different route types */
.vehicle-status-hub {
    color: #9b59b6;
    font-weight: bold;
}

.vehicle-status-alternative {
    color: #e74c3c;
    font-weight: bold;
}

/* Enhanced map controls */
.map-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 10px;
}

.map-type-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.map-control-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.map-control-btn.active {
    background-color: #2980b9;
}

.map-control-btn:hover {
    background-color: #2980b9;
}

#clearMapBtn {
    background-color: #dc3545;
}

#clearMapBtn:hover {
    background-color: #c82333;
}

/* Route management buttons */
.route-management {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.route-management-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.3s;
}

.route-management-btn:hover {
    background-color: #5a6268;
}

/* Responsive design improvements */
@media (max-width: 768px) {
    .route-legend {
        max-width: 200px;
        font-size: 11px;
    }
    
    .legend-item {
        font-size: 10px;
    }
    
    .map-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .map-type-selector {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Animation for smooth route transitions */
.route-fade-in {
    animation: routeFadeIn 0.5s ease-in;
}

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

/* Enhanced popup styles for hub information */
.hub-info-popup {
    min-width: 250px;
    max-width: 300px;
}

.hub-connections {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ecf0f1;
}

.hub-connections h5 {
    margin: 0 0 5px 0;
    font-size: 12px;
    color: #7f8c8d;
}

.connection-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 150px;
    overflow-y: auto;
}

.connection-list li {
    padding: 3px 0;
    border-bottom: 1px solid #f8f9fa;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
}

.connection-list li:last-child {
    border-bottom: none;
}

/* Loading states for hub operations */
.hub-loading {
    opacity: 0.7;
    pointer-events: none;
}

.hub-loading::after {
    content: ' 🔄';
    animation: spin 1s linear infinite;
}

/* Success and error states */
.hub-success {
    color: #27ae60;
}

.hub-error {
    color: #e74c3c;
}

/* Vehicle assignment highlights */
.vehicle-assigned {
    border-left: 4px solid #27ae60;
}

.vehicle-available {
    border-left: 4px solid #3498db;
}

.vehicle-busy {
    border-left: 4px solid #e74c3c;
}


