/* PWA Mobile-First Responsive Design */
@media (max-width: 768px) {
    .navbar-brand { 
        font-size: 1.1rem; 
    }
    
    .nav-link { 
        padding: 0.8rem 1rem; 
        font-size: 0.9rem; 
    }
    
    .btn { 
        min-height: 44px; 
        display: flex; 
        align-items: center; 
        justify-content: center; 
    }
    
    /* Mobile table improvements */
    .table-responsive { 
        font-size: 0.8rem; 
    }
    
    .table td, .table th { 
        padding: 0.5rem; 
    }
    
    /* Mobile card improvements */
    .card-body { 
        padding: 1rem; 
    }
    
    /* Mobile QR scanner */
    #reader { 
        min-height: 250px; 
    }
    
    #reader video { 
        border-radius: 10px; 
        width: 100% !important; 
    }
}

/* Prevent zoom on form inputs iOS */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    select,
    textarea,
    input {
        font-size: 16px !important;
    }
}

/* PWA app-like feel */
@media all and (display-mode: standalone) {
    .navbar { 
        padding-top: env(safe-area-inset-top); 
    }
    
    body { 
        padding-bottom: env(safe-area-inset-bottom);
        background-color: #f8f9fa;
    }
    
    /* Hide browser UI elements in standalone mode */
    .container { 
        max-width: 100%; 
    }
}

/* Touch-friendly improvements */
.btn, .nav-link {
    min-height: 44px;
    min-width: 44px;
}

/* Install prompt styling */
#installPrompt {
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    border-radius: 10px;
    max-width: 400px;
}

/* PWA Standalone Mode Enhancements */
.pwa-standalone {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Safe area handling for notched devices */
@supports(padding: max(0px)) {
    .pwa-standalone .navbar {
        padding-top: max(env(safe-area-inset-top), 1rem);
    }
    
    .pwa-standalone .container {
        padding-left: max(env(safe-area-inset-left), 1rem);
        padding-right: max(env(safe-area-inset-right), 1rem);
    }
}

/* Mobile-specific form improvements */
.mobile-form input,
.mobile-form select,
.mobile-form textarea {
    font-size: 16px !important; /* Prevents zoom on iOS */
}

/* Better mobile scrolling */
.mobile-scroll {
    -webkit-overflow-scrolling: touch;
}

/* PWA loading states */
.pwa-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ffc107;
    color: #000;
    text-align: center;
    padding: 5px;
    z-index: 1060;
    font-size: 0.9rem;
}