* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f3f4f6;
    color: #111827;
    line-height: 1.5;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success { border-left-color: #10b981; }
.toast.success .toast-icon { color: #10b981; }
.toast.error { border-left-color: #ef4444; }
.toast.error .toast-icon { color: #ef4444; }
.toast.warning { border-left-color: #f59e0b; }
.toast.warning .toast-icon { color: #f59e0b; }
.toast.info { border-left-color: #3b82f6; }
.toast.info .toast-icon { color: #3b82f6; }

.toast-icon { font-size: 24px; }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; margin-bottom: 4px; }
.toast-message { font-size: 0.875rem; color: #6b7280; }
.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #9ca3af;
    padding: 0 4px;
}

/* Connection Status */
.connection-status {
    position: fixed;
    top: 20px;
    left: 20px;
    background: white;
    padding: 8px 16px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 999;
    font-size: 0.875rem;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-indicator.online {
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 2s infinite;
}

.status-indicator.offline {
    background: #ef4444;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    width: 90%;
    max-width: 600px;
    border-radius: 20px;
    animation: slideDown 0.3s;
    max-height: 90%;
    overflow-y: auto;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    color: #111827;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #9ca3af;
    line-height: 1;
}

.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.return-vehicle-info {
    background: #f9fafb;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.return-vehicle-info p { margin: 8px 0; }
.return-vehicle-info strong { color: #111827; }

/* Battery Components */
.battery-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.battery-input-group input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    -webkit-appearance: none;
}

.battery-input-group input[type="range"]:focus { outline: none; }

.battery-input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #dc2626;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.battery-percentage {
    font-weight: 600;
    min-width: 50px;
    color: #374151;
}

.battery-status { margin-top: 8px; }
.battery-bar {
    width: 100%;
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.battery-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444);
    transition: width 0.3s ease;
    border-radius: 12px;
}

/* Main Container */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #fe0505 0%, #ee0505 100%);
    color: white;
    padding: 24px 32px;
    border-radius: 20px;
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.logo-area h1 {
    font-size: 1.75rem;
    margin-bottom: 4px;
    font-weight: 700;
}

.logo-area p {
    font-size: 0.875rem;
    opacity: 0.8;
}

.stats {
    background: rgba(255,255,255,0.1);
    padding: 12px 24px;
    border-radius: 16px;
    text-align: center;
}

.stats .number {
    font-size: 2rem;
    font-weight: 700;
}

.stats .label {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Dashboard Cards */
.dashboard {
    background: white;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.dashboard h2 {
    color: #111827;
    margin-bottom: 20px;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.loan-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.loan-card {
    background: #f9fafb;
    border-radius: 12px;
    padding: 16px;
    display: grid;
    grid-template-columns: 2fr 2fr 1fr 1fr auto;
    align-items: center;
    gap: 16px;
    border-left: 4px solid #10b981;
    transition: all 0.2s;
}

.loan-card:hover {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.loan-card.overdue {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.loan-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #111827;
}

.loan-info p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 4px 0;
}

.loan-battery {
    display: inline-block;
    padding: 2px 8px;
    background: #e5e7eb;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-top: 4px;
}

.return-date {
    display: inline-block;
    padding: 2px 8px;
    background: #dbeafe;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-top: 4px;
    margin-left: 4px;
}

.return-date.overdue {
    background: #fee2e2;
    color: #dc2626;
}

.loan-actions {
    justify-self: end;
}

.btn-checkin {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-checkin:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
}

/* Desktop Grid Layout */
.desktop-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    margin-bottom: 32px;
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Fleet Section */
.fleet-section {
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.fleet-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #111827;
}

.fleet-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    flex: 1;
    padding: 20px;
    border-radius: 16px;
    text-align: left;
    color: white;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card h3 {
    font-size: 1.75rem;
    margin-bottom: 8px;
    font-weight: 700;
}

.stat-card p {
    font-size: 0.875rem;
    opacity: 0.9;
    margin: 0;
}

.stat-card.available { background: #10b981; }
.stat-card.loaned { background: #ef4444; }
.stat-card.maintenance { background: #f59e0b; }

.vehicle-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.vehicle-card {
    background: #f9fafb;
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid;
    transition: all 0.2s;
    border-top: 1px solid grey !important;
    border-bottom: 1px solid grey !important;
    border-right: 1px solid gray !important;
}  

.vehicle-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.vehicle-card h3 {
    color: #111827;
    margin-bottom: 12px;
    font-size: 1rem;
    font-weight: 600;
}

.vehicle-card p {
    margin-bottom: 6px;
    font-size: 0.875rem;
    color: #6b7280;
}

.vehicle-card.available { border-color: #10b981; }
.vehicle-card.loaned { border-color: #ef4444; }
.vehicle-card.maintenance { border-color: #f59e0b; }

.vehicle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.vehicle-title {
    font-weight: 600;
    font-size: 1rem;
    color: #111827;
}

.vehicle-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-available { background: #dcfce7; color: #166534; }
.badge-loaned { background: #fee2e2; color: #991b1b; }
.badge-maintenance { background: #fed7aa; color: #92400e; }

.vehicle-details {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 8px;
}

.vehicle-details p { margin: 4px 0; }

/* Checkout Form */
.checkout-form {
    position: sticky;
    top: 20px;
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    height: fit-content;
}

.checkout-form h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f3f4f6;
    color: #111827;
}

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.form-group label.required:after {
    content: " *";
    color: #ef4444;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Signature Pad */
.signature-area {
    margin-bottom: 24px;
}

.signature-area label {
    font-weight: 600;
    color: #374151;
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.signature-pad canvas {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: white;
    width: 100%;
    height: 180px;
    cursor: crosshair;
}

.signature-buttons {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.btn-clear {
    background: #f3f4f6;
    color: #374151;
    border: none;
    padding: 8px 16px;
    border-radius: 40px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-clear:hover {
    background: #e5e7eb;
}

.btn-submit {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-submit:hover {
    background: #2563eb;
    transform: scale(1.02);
}

.btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Fleet Intelligence */
.fleet-intelligence {
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.fleet-intelligence > h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: #111827;
}

.fi-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
}

.fi-search,
.fi-filter {
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.875rem;
}

.fi-search {
    flex: 1;
}

.fi-filter {
    width: 200px;
}

.fi-analytics {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
}

.fi-card {
    flex: 1;
    background: #f9fafb;
    padding: 20px;
    border-radius: 16px;
    text-align: left;
}

.fi-card h3 {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 500;
}

.fi-card p {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.fi-vehicles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.fi-vehicle-card {
    background: #f9fafb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
}

.fi-vehicle-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.fi-img {
    height: 140px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
}

.fi-img::after {
    content: "🚗";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
}

.fi-info {
    padding: 16px;
}

.fi-info h4 {
    margin-bottom: 4px;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.fi-info p {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 8px;
}

.status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status.available {
    background: #dcfce7;
    color: #166534;
}

.status.loaned {
    background: #fee2e2;
    color: #991b1b;
}

.fi-damage h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #111827;
}

.damage-item {
    padding: 12px 16px;
    border-radius: 10px;
    margin-top: 8px;
    font-size: 0.875rem;
}

.damage-item.minor {
    background: #fef9c3;
}

.damage-item.severe {
    background: #fee2e2;
}

.damage-item p strong {
    color: #111827;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 32px;
    padding: 20px;
    color: #9ca3af;
    font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .desktop-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .checkout-form {
        position: static;
    }
    
    .vehicle-cards {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .fi-vehicles {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    body { padding: 0; }
    .app-container { padding: 12px; }
    
    .header { flex-direction: column; text-align: center; }
    
    .loan-card {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .loan-actions { justify-self: center; }
    
    .fleet-stats { flex-direction: column; }
    
    .fi-analytics { flex-direction: column; }
    
    .fi-controls { flex-direction: column; }
    
    .fi-filter { width: 100%; }
    
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .connection-status {
        top: 10px;
        left: 10px;
    }
    
    .modal-content { margin: 10% auto; width: 95%; }
}
