/* ==========================================
   HOME PAGE MOBILE OPTIMIZATIONS
   Enhanced mobile experience for homepage
   ========================================== */

/* ==========================================
   1. SECTION HEADERS - Better Mobile Layout
   ========================================== */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
        margin-bottom: 1rem !important;
    }
    
    .section-header h2 {
        font-size: 1.5rem !important;
        margin-bottom: 0 !important;
        line-height: 1.3;
    }
    
    .view-all-btn {
        font-size: 0.875rem !important;
        padding: 0.5rem 1rem !important;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        text-decoration: none !important;
        border: 1px solid var(--amazon-blue, #146eb4);
        border-radius: 4px;
        color: var(--amazon-blue, #146eb4) !important;
        font-weight: 500;
    }
    
    .view-all-btn:hover {
        background-color: var(--amazon-blue, #146eb4);
        color: #fff !important;
    }
}

/* ==========================================
   2. HERO CAROUSEL - Mobile Optimizations
   ========================================== */
@media (max-width: 768px) {
    .home-hero-carousel {
        margin-bottom: 2rem !important;
    }
    
    .carousel-item {
        min-height: 300px;
    }
    
    .carousel-overlay {
        min-height: 300px;
        background-size: cover;
        background-position: center;
    }
    
    .overlay-gradient {
        padding: 2rem 1.5rem !important;
        display: flex;
        align-items: center;
        min-height: 300px;
    }
    
    .carousel-item h2 {
        font-size: 1.75rem !important;
        line-height: 1.2;
        margin-bottom: 1rem !important;
    }
    
    .carousel-item p {
        font-size: 0.9rem !important;
        margin-bottom: 1rem !important;
        line-height: 1.5;
    }
    
    .carousel-item .price-main {
        font-size: 1.5rem !important;
    }
    
    .carousel-item .price-original {
        font-size: 1rem !important;
    }
    
    .btn-hero {
        font-size: 1rem !important;
        padding: 0.75rem 1.5rem !important;
        min-height: 48px;
        width: auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Carousel controls - larger touch targets */
    .carousel-control-prev,
    .carousel-control-next {
        width: 48px;
        height: 48px;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        opacity: 0.8;
    }
    
    .carousel-control-prev:hover,
    .carousel-control-next:hover {
        opacity: 1;
    }
    
    .carousel-control-prev-icon,
    .carousel-control-next-icon {
        width: 20px;
        height: 20px;
    }
    
    /* Carousel indicators - better spacing */
    .carousel-indicators {
        margin-bottom: 1rem;
        gap: 0.5rem;
    }
    
    .carousel-indicators button {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        margin: 0 4px;
    }
}

/* ==========================================
   3. CATEGORY TILES - Mobile Improvements
   ========================================== */
@media (max-width: 576px) {
    .shop-by-category-section {
        margin-bottom: 2rem !important;
    }
    
    .category-tile {
        padding: 0.5rem;
    }
    
    .category-image-wrap {
        margin-bottom: 0.5rem;
    }
    
    .category-image {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
        object-fit: cover;
        border-radius: 8px;
    }
    
    .category-name {
        font-size: 0.75rem;
        line-height: 1.3;
        padding: 0 0.25rem;
    }
    
    .category-name span {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ==========================================
   4. PRODUCT CARDS - Enhanced Mobile Layout
   ========================================== */
@media (max-width: 576px) {
    .product-card {
        border-radius: 8px;
        overflow: hidden;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    
    .product-card:active {
        transform: scale(0.98);
    }
    
    .product-card .img-wrap {
        position: relative;
        padding-top: 100%;
        overflow: hidden;
        background: #f5f5f5;
    }
    
    .product-card .card-img-top {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .product-card .card-body {
        padding: 0.75rem !important;
    }
    
    .product-card .card-title {
        font-size: 0.875rem !important;
        line-height: 1.4;
        margin-bottom: 0.5rem !important;
        min-height: 2.8em;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .product-card .card-title a {
        font-size: inherit;
    }
    
    .product-card .price-main {
        font-size: 1rem !important;
        font-weight: 700;
    }
    
    .product-card .price-original {
        font-size: 0.75rem !important;
    }
    
    /* Wishlist button - larger on mobile */
    .wishlist-btn {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        font-size: 1.125rem !important;
        z-index: 10;
    }
    
    /* Stock badge */
    .stock-badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
        top: 0.5rem;
        left: 0.5rem;
    }
}

/* ==========================================
   5. NEW ARRIVALS HORIZONTAL SCROLL
   ========================================== */
@media (max-width: 768px) {
    .new-arrivals-section {
        position: relative;
        padding: 0 3rem;
    }
    
    .new-arrivals-track {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 1rem;
    }
    
    .new-arrivals-track::-webkit-scrollbar {
        display: none;
    }
    
    .new-arrivals-card {
        flex: 0 0 160px;
        min-width: 160px;
        margin-right: 1rem;
    }
    
    .new-arrivals-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid #ddd;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .new-arrivals-nav.prev {
        left: 0.5rem;
    }
    
    .new-arrivals-nav.next {
        right: 0.5rem;
    }
    
    .new-arrivals-nav:active {
        transform: translateY(-50%) scale(0.95);
    }
    
    .new-arrivals-nav i {
        font-size: 1rem;
    }
}

/* ==========================================
   6. PROMO BANNERS - Mobile Stacking
   ========================================== */
@media (max-width: 768px) {
    .promo-banners {
        margin: 2rem 0 !important;
    }
    
    .promo-banners .row {
        margin: 0;
    }
    
    .promo-banners .col-md-6 {
        margin-bottom: 1rem;
    }
    
    .promo-banners img {
        border-radius: 8px;
    }
}

/* ==========================================
   7. FLASH SALE COUNTDOWN - Mobile
   ========================================== */
@media (max-width: 768px) {
    .flash-sale-section .section-header {
        flex-wrap: wrap;
    }
    
    #flash-countdown {
        font-size: 0.875rem !important;
        padding: 0.5rem 0.75rem !important;
        margin-top: 0.5rem;
    }
}

/* ==========================================
   8. NEWSLETTER & TRUST BADGES - Mobile
   ========================================== */
@media (max-width: 768px) {
    .row.my-5.g-4 > .col-lg-6 {
        margin-bottom: 1.5rem;
    }
    
    .card.h-100.p-4 {
        padding: 1.5rem !important;
    }
    
    .card h4 {
        font-size: 1.25rem !important;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group .form-control {
        border-radius: 4px 4px 0 0 !important;
        margin-bottom: 0;
    }
    
    .input-group .btn {
        border-radius: 0 0 4px 4px !important;
        width: 100%;
        min-height: 48px;
    }
    
    /* Trust badges grid */
    .card .row.text-center .col-4 {
        margin-bottom: 1rem;
        padding: 0.5rem;
    }
    
    .card .row.text-center .col-4 i {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .card .row.text-center .col-4 .fw-semibold {
        font-size: 0.875rem;
        margin-bottom: 0.25rem;
    }
    
    .card .row.text-center .col-4 small {
        font-size: 0.75rem;
        line-height: 1.3;
    }
}

/* ==========================================
   9. TRUST BAR - Mobile Optimizations
   ========================================== */
@media (max-width: 768px) {
    .trust-bar {
        padding: 1.5rem 0 !important;
    }
    
    .trust-item {
        padding: 1rem 0.5rem;
        text-align: center;
    }
    
    .trust-item i {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .trust-item-text h6 {
        font-size: 0.875rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    .trust-item-text p {
        font-size: 0.75rem !important;
        line-height: 1.3;
    }
}

/* ==========================================
   10. BRAND SHOPS - Mobile Grid
   ========================================== */
@media (max-width: 576px) {
    .brand-shops-section .col-6 {
        margin-bottom: 1rem;
    }
    
    .brand-shops-section .card {
        padding: 1rem !important;
        min-height: 100px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .brand-shops-section img {
        max-height: 50px !important;
    }
    
    .brand-shops-section .small {
        font-size: 0.75rem !important;
        margin-top: 0.5rem !important;
    }
}

/* ==========================================
   11. CONTAINER SPACING - Mobile
   ========================================== */
@media (max-width: 768px) {
    #main-content.container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    #main-content.container .mb-5 {
        margin-bottom: 2rem !important;
    }
    
    #main-content.container .my-5 {
        margin-top: 2rem !important;
        margin-bottom: 2rem !important;
    }
}

/* ==========================================
   12. SWIPE INDICATORS - Visual Feedback
   ========================================== */
@media (max-width: 768px) {
    .new-arrivals-track::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.8));
        pointer-events: none;
        z-index: 1;
    }
}

/* ==========================================
   13. LOADING STATES - Mobile
   ========================================== */
@media (max-width: 768px) {
    .product-card img {
        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;
        }
    }
}

/* ==========================================
   14. ACCESSIBILITY - Touch Targets
   ========================================== */
@media (max-width: 768px) {
    /* Ensure all interactive elements are easily tappable */
    a.category-tile,
    a.product-card,
    .new-arrivals-card a {
        min-height: 44px;
        display: block;
    }
    
    /* Better focus states for keyboard navigation */
    .product-card:focus-visible,
    .category-tile:focus-visible {
        outline: 2px solid var(--amazon-blue, #146eb4);
        outline-offset: 2px;
    }
}

/* ==========================================
   15. PERFORMANCE - Reduce Animations on Mobile
   ========================================== */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    .product-card,
    .category-tile,
    .new-arrivals-nav,
    .carousel-item {
        transition: none !important;
        animation: none !important;
    }
}

