/**
 * Mobile CSS - Responsive Design
 * Mobile-first responsive styles
 */

/* ============================================================================
   MOBILE BREAKPOINTS
   ========================================================================= */

/* Small devices (phones, up to 768px) */
@media (max-width: 768px) {
    
    /* Header */
    .header-content {
        flex-direction: column;
        height: auto;
        padding: var(--space-3) 0;
    }
    
    .logo {
        font-size: var(--text-xl);
    }
    
    .nav {
        width: 100%;
        justify-content: space-around;
        gap: var(--space-2);
        margin-top: var(--space-3);
    }
    
    .nav-link {
        flex-direction: column;
        padding: var(--space-2);
        font-size: var(--text-xs);
        gap: var(--space-1);
    }
    
    .nav-link .iconify {
        font-size: var(--text-lg);
    }
    
    /* Main content */
    .main-content {
        padding: var(--space-4) 0;
    }
    
    /* Filter bar */
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
        min-width: auto;
    }
    
    .filter-group label {
        min-width: 80px;
    }
    
    /* Calendar */
    .calendar-container {
        padding: var(--space-2);
    }
    
    .fc .fc-toolbar {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .fc .fc-toolbar-chunk {
        width: 100%;
        justify-content: center;
    }
    
    .fc .fc-button {
        font-size: var(--text-sm);
        padding: var(--space-2) var(--space-3);
    }
    
    .fc .fc-toolbar-title {
        font-size: var(--text-lg);
    }
    
    /* Default to day view on mobile */
    .fc .fc-timeGridWeek-view,
    .fc .fc-dayGridMonth-view {
        display: none;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Modal */
    .modal {
        padding: 0;
    }
    
    .modal-content {
        max-height: 100vh;
        border-radius: 0;
        height: 100%;
    }
    
    .modal-header,
    .modal-body {
        padding: var(--space-4);
    }
    
    .modal-footer {
        flex-direction: column-reverse;
        position: sticky;
        bottom: 0;
        background-color: var(--bg-primary);
        padding: var(--space-4);
        border-top: 1px solid var(--border);
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Cards */
    .card {
        padding: var(--space-4);
    }
    
    /* Vehicle legend */
    .legend-items {
        gap: var(--space-2);
    }
    
    .legend-item {
        flex: 1 1 auto;
        min-width: 45%;
    }
}

/* ============================================================================
   TABLET (768px - 1024px)
   ========================================================================= */

@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        max-width: 768px;
    }
    
    .nav {
        gap: var(--space-4);
    }
    
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================================
   MOBILE-SPECIFIC COMPONENTS
   ========================================================================= */

/* Touch-friendly buttons */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        padding: var(--space-3) var(--space-5);
    }
    
    .btn-sm {
        min-height: 36px;
    }
    
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    textarea.form-control {
        min-height: 120px;
    }
    
    /* Larger checkboxes for touch */
    input[type="checkbox"] {
        min-width: 24px;
        min-height: 24px;
    }
}

/* ============================================================================
   QR CHECK-IN PAGE (Mobile Optimized)
   ========================================================================= */

@media (max-width: 768px) {
    .checkin-container {
        padding: var(--space-3);
    }
    
    .vehicle-header {
        padding: var(--space-5) var(--space-4);
    }
    
    .vehicle-header h1 {
        font-size: var(--text-xl);
    }
    
    .booking-info {
        padding: var(--space-4);
    }
    
    .info-row {
        flex-direction: column;
        gap: var(--space-1);
    }
    
    .checklist-item {
        padding: var(--space-3);
    }
    
    .checklist-item label {
        font-size: var(--text-sm);
    }
    
    .photo-upload-area {
        padding: var(--space-6);
    }
    
    .photo-preview {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .photo-preview img {
        height: 80px;
    }
    
    .action-buttons {
        padding: var(--space-4);
    }
}

/* ============================================================================
   LANDSCAPE ORIENTATION
   ========================================================================= */

@media (max-width: 768px) and (orientation: landscape) {
    .vehicle-header {
        padding: var(--space-4) var(--space-4);
    }
    
    .vehicle-header h1 {
        font-size: var(--text-lg);
    }
    
    .modal-content {
        max-height: 95vh;
    }
}

/* ============================================================================
   HOVER STATES (Disabled on touch devices)
   ========================================================================= */

@media (hover: none) {
    .btn:hover {
        transform: none;
    }
    
    .nav-link:hover {
        transform: none;
    }
    
    .card:hover {
        box-shadow: var(--shadow-sm);
    }
}

/* ============================================================================
   PRINT STYLES
   ========================================================================= */

@media print {
    .header,
    .nav,
    .filter-bar,
    .theme-toggle,
    .modal,
    .action-buttons,
    .btn {
        display: none !important;
    }
    
    body {
        background-color: white;
        color: black;
    }
    
    .calendar-container {
        box-shadow: none;
    }
}

/* ============================================================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================================================= */

/* Focus indicators */
@media (max-width: 768px) {
    a:focus,
    button:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline: 3px solid var(--accent);
        outline-offset: 2px;
    }
    
    /* Skip to content link */
    .skip-to-content {
        position: absolute;
        top: -100px;
        left: 0;
        background: var(--accent);
        color: white;
        padding: var(--space-3);
        z-index: 100;
        text-decoration: none;
    }
    
    .skip-to-content:focus {
        top: 0;
    }
}

/* ============================================================================
   SAFE AREA (iOS Notch Support)
   ========================================================================= */

@supports (padding: max(0px)) {
    .header,
    .main-content,
    .modal-content {
        padding-left: max(var(--space-4), env(safe-area-inset-left));
        padding-right: max(var(--space-4), env(safe-area-inset-right));
    }
    
    .action-buttons {
        padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
    }
}

/* ============================================================================
   REDUCED MOTION
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
