/* Mobile-first responsive design */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Safe area support for iPhone X and newer */
@supports (padding-top: env(safe-area-inset-top)) {
    .mobile-layout {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .mobile-header {
        padding-top: calc(1rem + env(safe-area-inset-top));
    }
    
    .mobile-bottom-nav {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}

/* Touch-friendly button sizes */
.rz-button {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

/* Improved touch targets */
.mobile-nav-item {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

/* Prevent zoom on input focus */
input, select, textarea {
    font-size: 16px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Hide scrollbars but keep functionality */
.mobile-content::-webkit-scrollbar {
    display: none;
}

.mobile-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Card hover effects for mobile */
.rz-card {
    transition: all 0.2s ease;
}

.rz-card:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Loading states */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Pull to refresh indicator */
.pull-to-refresh {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.3s ease;
}

.pull-to-refresh.active {
    top: 20px;
}

/* Swipe gestures */
.swipeable {
    touch-action: pan-y;
}

/* Map container optimizations */
.mobile-map-container {
    position: relative;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* Bottom sheet animations */
.bottom-sheet {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-sheet.dragging {
    transition: none;
}

/* Floating action button */
.fab {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 100;
    transition: all 0.2s ease;
}

.fab:active {
    transform: scale(0.9);
}

/* Status bar colors */
.status-delivered {
    color: #4CAF50;
}

.status-pending {
    color: #FF9800;
}

.status-failed {
    color: #F44336;
}

/* Gradient backgrounds */
.gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-success {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.gradient-warning {
    background: linear-gradient(135deg, #FF9800 0%, #f57c00 100%);
}

.gradient-danger {
    background: linear-gradient(135deg, #F44336 0%, #d32f2f 100%);
}

/* Animation utilities */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .mobile-layout {
        background-color: #121212;
        color: #ffffff;
    }
    
    .rz-card {
        background-color: #1e1e1e;
        border-color: #333;
    }
    
    .mobile-bottom-nav {
        background-color: #1e1e1e;
        border-top-color: #333;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .rz-button {
        border: 2px solid currentColor;
    }
    
    .rz-card {
        border: 1px solid currentColor;
    }
}

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

/* Landscape orientation adjustments */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .mobile-header {
        padding: 0.5rem 1rem;
    }
    
    .mobile-bottom-nav {
        padding: 0.5rem 0;
    }
    
    .mobile-bottom-nav .nav-item {
        padding: 0.5rem;
    }
}

/* Large screen adjustments */
@media screen and (min-width: 768px) {
    .mobile-layout {
        max-width: 480px;
        margin: 0 auto;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
    }
}

/* Print styles */
@media print {
    .mobile-header,
    .mobile-bottom-nav,
    .fab {
        display: none !important;
    }
    
    .mobile-content {
        padding: 0 !important;
    }
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators */
.rz-button:focus,
.mobile-nav-item:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Error states */
.error-state {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.error-state .error-icon {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 1rem;
}

/* Success states */
.success-state {
    text-align: center;
    padding: 2rem;
    color: #4CAF50;
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.empty-state .empty-icon {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 1rem;
}
