/* Vehicle Mobile Responsive Styles */
/* This file contains mobile-first responsive styles for all vehicle-related pages */

/* Base mobile styles */
@media (max-width: 768px) {
    /* Container adjustments */
    .container-fluid,
    .container {
        margin-top: 80px !important;
        padding-left: 5px;
        padding-right: 5px;
    }
    
    /* Header adjustments */
    h1.alert, h2.alert, h3.alert, h4.alert, h5.alert, h6.alert {
        font-size: 1.1rem;
        padding: 10px;
        margin: 10px 0;
    }
    
    /* Button container mobile */
    .button-container {
        margin-bottom: 15px;
    }
    
    .button {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Filter section mobile layout */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 15px;
    }
    
    .d-flex.align-items-center,
    .d-flex.align-items-center.flex-wrap {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
    }
    
    /* Form controls mobile */
    .form-control {
        width: 100% !important;
        margin-bottom: 10px;
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Dropdown mobile */
    .dropdown {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .dropdown-toggle {
        width: 100%;
        text-align: left;
    }
    
    .dropdown-menu {
        min-width: 200px;
        max-width: 90vw;
    }
    
    /* Input groups mobile */
    .input-group {
        width: 100% !important;
    }
    
    /* Totals display mobile */
    #route-totals .d-flex,
    #warehouse-totals .d-flex {
        flex-direction: column;
        gap: 10px;
    }
    
    .route-total-item .badge,
    .warehouse-total-item .badge {
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    /* Export button mobile */
    .btn-group {
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    /* Table responsive */
    .table-responsive {
        border: none;
        max-height: 70vh;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 8px 4px;
        white-space: nowrap;
    }
    
    /* Vehicle details mobile */
    .vehicle-detail {
        margin-bottom: 10px;
    }
    
    .event-times {
        flex-direction: column;
        gap: 4px;
    }
    
    .event-time {
        min-width: auto;
        width: 100%;
        justify-content: flex-start;
        padding: 4px 8px;
    }
    
    /* Vehicle allocation forms mobile */
    .vehicle-data-form .row {
        flex-direction: column;
    }
    
    .vehicle-data-form .col-md-3 {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .vehicle-data-form .d-flex.align-items-end {
        justify-content: center;
    }
    
    /* Modal mobile adjustments */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-xl {
        max-width: calc(100% - 20px);
    }
    
    /* Date picker mobile */
    .date-picker-content {
        width: 100%;
        max-width: 100%;
        margin: 10px;
        max-height: 95vh;
    }
    
    .date-picker-calendar {
        flex-direction: column;
        gap: 10px;
    }
    
    .calendar-month {
        width: 100%;
    }
    
    .date-picker-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Button sizing for touch */
    .btn {
        min-height: 44px;
        padding: 10px 15px;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 8px 12px;
    }
    
    /* Stack action buttons vertically on mobile */
    td:last-child {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    td:last-child .btn {
        width: 100%;
        margin-right: 0 !important;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 5px;
        margin-right: 0 !important;
    }
    
    /* Form mobile */
    .form-container {
        padding: 10px;
    }
    
    /* Form fields mobile */
    .form-group {
        margin-bottom: 15px;
    }
    
    .btn-block {
        width: 100%;
    }
    
    /* Form labels mobile */
    .form-label,
    label {
        font-size: 0.9rem;
        margin-bottom: 5px;
        display: block;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .container-fluid,
    .container {
        padding-left: 2px;
        padding-right: 2px;
    }
    
    h1.alert, h2.alert, h3.alert, h4.alert, h5.alert, h6.alert {
        font-size: 1rem;
        padding: 8px;
    }
    
    .table {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 6px 2px;
    }
    
    .badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    .form-control {
        padding: 10px;
        font-size: 14px;
    }
    
    .form-label,
    label {
        font-size: 0.85rem;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .date-picker-content {
        max-height: 80vh;
    }
    
    .date-picker-calendar {
        flex-direction: row;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn {
        min-height: 48px;
        padding: 12px 20px;
    }
    
    .btn-sm {
        min-height: 40px;
        padding: 10px 16px;
    }
    
    /* Improve dropdown touch targets */
    .dropdown-menu li a {
        padding: 15px 20px;
    }
    
    /* Improve table row touch targets */
    .table tbody tr {
        min-height: 48px;
    }
    
    /* Improve form input touch targets */
    .form-control {
        min-height: 48px;
        padding: 12px 16px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure crisp rendering on high DPI displays */
    .btn,
    .form-control,
    .table {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Accessibility improvements for mobile */
@media (max-width: 768px) {
    /* Ensure sufficient color contrast */
    .btn-primary {
        background-color: #0056b3;
        border-color: #0056b3;
    }
    
    .btn-secondary {
        background-color: #6c757d;
        border-color: #6c757d;
    }
    
    /* Improve focus indicators */
    .btn:focus,
    .form-control:focus {
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    }
    
    /* Ensure text is readable */
    .table th,
    .table td {
        line-height: 1.4;
    }
    
    /* Improve spacing for readability */
    .alert {
        line-height: 1.5;
    }
}
