/* Responsive Revamp CSS - Mobile First Approach */

/* Base Mobile Styles */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 70px; /* Space for mobile bottom nav */
}

/* Improved Touch Targets */
button, a, .clickable {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Navigation Improvements */
.mobile-nav-active {
    overflow: hidden;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Improved Search Experience */
.mobile-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.mobile-search-modal.active {
    transform: translateY(0);
}

.search-input-mobile {
    font-size: 16px !important; /* Prevents zoom on iOS */
}

/* Better Image Loading */
.lazy-img {
    background: #f0f0f0;
    background-image: linear-gradient(90deg, #f0f0f0 0%, #f8f8f8 50%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

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

/* Swipeable Cards */
.swipeable-container {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
}

.swipeable-card {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* Hide scrollbar but keep functionality */
.swipeable-container::-webkit-scrollbar {
    display: none;
}

.swipeable-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Product Grid Responsive */
.responsive-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, 1fr);
}

/* Sticky Add to Cart Button (Mobile) */
.sticky-cart-mobile {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    background: white;
    padding: 10px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 997;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.sticky-cart-mobile.show {
    transform: translateY(0);
}

/* Optimized Forms for Mobile */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
textarea,
select {
    font-size: 16px !important;
    padding: 12px !important;
    border-radius: 8px !important;
}

/* Better Modals on Mobile */
.modal-mobile-friendly {
    margin: 0;
    max-height: 100vh;
    overflow-y: auto;
}

.modal-mobile-friendly .modal-dialog {
    margin: 0;
    max-width: 100%;
    height: 100%;
}

.modal-mobile-friendly .modal-content {
    border-radius: 0;
    height: 100%;
}

/* Touch-friendly Dropdown */
.touch-dropdown {
    position: relative;
}

.touch-dropdown-menu {
    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 ease;
    z-index: 9999;
    max-height: 70vh;
    overflow-y: auto;
}

.touch-dropdown-menu.show {
    transform: translateY(0);
}

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

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

/* Pull to Refresh Indicator */
.pull-to-refresh {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: top 0.3s ease;
    z-index: 9999;
}

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

/* Tablet Styles */
@media (min-width: 576px) and (max-width: 767px) {
    .responsive-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    body {
        padding-bottom: 0;
    }
}

/* Small Desktop */
@media (min-width: 768px) and (max-width: 991px) {
    .responsive-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    body {
        padding-bottom: 0;
    }
    
    .hover-lift {
        transition: transform 0.3s ease;
    }
    
    .hover-lift:hover {
        transform: translateY(-5px);
    }
}

/* Desktop */
@media (min-width: 992px) {
    .responsive-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
    
    body {
        padding-bottom: 0;
    }
    
    /* Desktop hover effects */
    .hover-shadow:hover {
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    }
    
    .hover-scale:hover {
        transform: scale(1.05);
    }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .responsive-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Extra Large Desktop */
@media (min-width: 1400px) {
    .responsive-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* 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 Visible for Keyboard Navigation */
*:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --text-primary: #ffffff;
        --bg-secondary: #2a2a2a;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Print Styles */
@media print {
    .no-print,
    .mobile-nav,
    .floating-search,
    .sticky-cart-mobile {
        display: none !important;
    }
}

/* Performance Optimizations */
.will-change-transform {
    will-change: transform;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Utility Classes */
.touch-none {
    touch-action: none;
}

.touch-pan-y {
    touch-action: pan-y;
}

.touch-pan-x {
    touch-action: pan-x;
}

.select-none {
    user-select: none;
}

.overflow-touch {
    -webkit-overflow-scrolling: touch;
}

/* Safe Area Insets for iPhone X+ */
.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
}

.safe-area-top {
    padding-top: env(safe-area-inset-top);
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #555;
}