/* PWA Mobile Optimizations */

/* Hide elements when in standalone mode (PWA) */
@media all and (display-mode: standalone) {
    .hide-in-pwa {
        display: none !important;
    }
    
    /* Add safe area padding for notched devices */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
    /* Improve touch targets */
    button, a, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Optimize font sizes for mobile */
    body {
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
    }
    
    /* Prevent zoom on input focus */
    input, select, textarea {
        font-size: 16px;
    }
    
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Optimize images for mobile */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Mobile navigation */
    .mobile-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    /* Product grid optimization */
    .product-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 15px;
    }
    
    /* Card optimization */
    .product-card {
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    /* Button optimization */
    .btn-primary {
        padding: 14px 24px;
        border-radius: 25px;
        font-weight: 600;
        text-align: center;
        display: block;
        width: 100%;
    }
    
    /* Form optimization */
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-control {
        width: 100%;
        padding: 12px 16px;
        border-radius: 8px;
        border: 1px solid #ddd;
        font-size: 16px;
    }
    
    /* Cart optimization */
    .cart-item {
        display: flex;
        gap: 15px;
        padding: 15px;
        border-bottom: 1px solid #eee;
    }
    
    .cart-item-image {
        width: 80px;
        height: 80px;
        object-fit: cover;
        border-radius: 8px;
    }
    
    /* Checkout optimization */
    .checkout-summary {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 20px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
}

/* Landscape mode optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Pull-to-refresh indicator */
.ptr-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: white;
    padding: 10px 20px;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
    z-index: 9999;
}

.ptr-indicator.active {
    transform: translateX(-50%) translateY(0);
}

/* 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;
    }
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ff9800;
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 14px;
    z-index: 10000;
    transform: translateY(-100%);
    transition: transform 0.3s;
}

.offline-indicator.show {
    transform: translateY(0);
}

/* Bottom sheet */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s;
    z-index: 9999;
    max-height: 80vh;
    overflow-y: auto;
}

.bottom-sheet.active {
    transform: translateY(0);
}

.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 9998;
}

.bottom-sheet-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Floating action button */
.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #000;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 999;
    transition: transform 0.2s;
}

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

/* Snackbar notification */
.snackbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #323232;
    color: white;
    padding: 14px 24px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 10000;
    transition: transform 0.3s;
    max-width: 90%;
}

.snackbar.show {
    transform: translateX(-50%) translateY(0);
}

/* Haptic feedback simulation */
@keyframes haptic {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

.haptic {
    animation: haptic 0.1s;
}

/* iOS-style bounce scroll */
.bounce-scroll {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

/* Material ripple effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

