/* ===== MOBILE OPTIMIZATIONS SUMMARY ===== */

/* This file contains additional mobile-specific optimizations */
/* Include this file after the main stylesheets for enhanced mobile experience */

/* Mobile-First Approach */
@media (max-width: 768px) {
    /* Improved Touch Targets */
    button, .btn, a, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better Text Readability */
    body {
        font-size: 16px;
        line-height: 1.5;
    }
    
    /* Improved Form Elements */
    input, select, textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 16px;
        border-radius: 8px;
        border: 2px solid #e0e0e0;
    }
    
    /* Enhanced Button Styles */
    .btn, button {
        padding: 14px 20px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    /* Improved Modal for Mobile */
    .modal-content {
        width: 95vw;
        max-height: 90vh;
        margin: 5vh auto;
        border-radius: 12px;
    }
    
    /* Better Product Cards */
    .product-card {
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    
    .product-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* Enhanced Navigation */
    .nav-link {
        padding: 12px 16px;
        font-size: 16px;
        text-align: center;
        border-radius: 8px;
        margin: 4px 8px;
    }
    
    /* Improved Cart Items */
    .cart-item {
        padding: 16px;
        border-radius: 12px;
        margin-bottom: 12px;
        background: white;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    /* Better Spacing */
    .container {
        padding: 0 16px;
    }
    
    section {
        padding: 40px 0;
    }
    
    /* Enhanced Typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    
    /* Improved Loading States */
    .loading {
        opacity: 0.6;
        pointer-events: none;
    }
    
    /* Better Error States */
    .error-message {
        background: #fee;
        color: #c33;
        padding: 12px 16px;
        border-radius: 8px;
        margin: 12px 0;
        border-left: 4px solid #c33;
    }
    
    /* Enhanced Success States */
    .success-message {
        background: #efe;
        color: #363;
        padding: 12px 16px;
        border-radius: 8px;
        margin: 12px 0;
        border-left: 4px solid #363;
    }
}

/* Extra Small Screens */
@media (max-width: 480px) {
    /* Even Better Touch Targets */
    button, .btn, a {
        min-height: 48px;
        padding: 16px 20px;
    }
    
    /* Larger Text for Readability */
    body {
        font-size: 17px;
    }
    
    /* Better Form Elements */
    input, select, textarea {
        font-size: 17px;
        padding: 16px;
    }
    
    /* Enhanced Product Grid */
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
    }
    
    /* Better Modal */
    .modal-content {
        width: 98vw;
        margin: 1vh auto;
    }
    
    /* Improved Typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    /* Better Spacing */
    .container {
        padding: 0 12px;
    }
    
    section {
        padding: 30px 0;
    }
}

/* Landscape Orientation Optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: 70vh;
        padding: 40px 20px;
    }
    
    .navbar {
        padding: 8px 15px;
    }
    
    .nav-links {
        padding: 8px 0;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .product-card:hover {
        transform: none;
    }
    
    .nav-link:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    /* Add active states for better feedback */
    .product-card:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    .nav-link:active {
        background: rgba(255, 107, 107, 0.2);
    }
}

/* High DPI Display Optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure crisp images on retina displays */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    /* Better icon rendering */
    .fas, .fab, .far {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    /* This can be expanded based on requirements */
    .modal-content {
        background: #1a1a1a;
        color: white;
    }
}

/* Print Optimizations */
@media print {
    .header, .footer, .nav-actions, .mobile-menu-toggle {
        display: none !important;
    }
    
    .product-card {
        break-inside: avoid;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
}

/* Performance Optimizations */
.product-image, .hero, .category-card {
    will-change: transform;
}

.product-card {
    contain: layout style paint;
}

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

/* Better Focus Indicators */
*:focus {
    outline: 2px solid #FF6B6B;
    outline-offset: 2px;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #FF6B6B;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideInFromTop 0.3s ease-out;
}

.notification.error {
    background: #dc3545;
}

.notification.warning {
    background: #ffc107;
    color: #333;
}

/* Mobile-Specific Utilities */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* Safe Area Insets for iOS */
@supports (padding: max(0px)) {
    .header {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
    
    .footer {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}