/* ============================================
   RESPONSIVE FIXES FOR E-COMMERCE SECTIONS
   Target: Hero Banner, Monthly Best Sell, Deals Section
   ============================================ */

/* ============================================
   1. HERO BANNER SECTION - MOBILE FIXES
   ============================================ */

/* Prevent hero section overflow on mobile */
@media (max-width: 991px) {
    .home-slider {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
        padding: 30px 0 !important;
    }
    
    .home-slider .container {
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .home-slider .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Stack hero content and carousel vertically on tablet/mobile */
    .home-slider .col-lg-5,
    .home-slider .col-lg-7 {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }
    
    .hero-slider-content-2 {
        text-align: center;
        margin-bottom: 30px;
    }
    
    .hero-slider-content-2 h4 {
        font-size: 14px;
    }
    
    .hero-slider-content-2 h2 {
        font-size: 24px;
    }
    
    .hero-slider-content-2 h1 {
        font-size: 28px;
    }
    
    .hero-slider-content-2 p {
        font-size: 13px;
    }
    
    /* Force carousel wrapper to stay within bounds */
    .lively_sf_spotlight_carousel_wrapper {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        padding: 10px 0;
    }
    
    .lively_sf_spotlight_carousel {
        height: 350px;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .home-slider {
        padding: 20px 0 !important;
    }
    
    .hero-slider-content-2 h4 {
        font-size: 12px;
    }
    
    .hero-slider-content-2 h2 {
        font-size: 20px;
    }
    
    .hero-slider-content-2 h1 {
        font-size: 24px;
    }
    
    .lively_sf_spotlight_carousel {
        height: 300px;
    }
    
    .lively_sf_spotlight_card {
        width: 240px !important;
        height: 340px !important;
    }
}

/* ============================================
   2. MONTHLY BEST SELL SECTION - RESPONSIVE
   ============================================ */

/* ============================================
   2A. FEATURED/POPULAR/NEW TABS (First Section) - RESPONSIVE
   ============================================ */

/* Tab header responsiveness */
@media (max-width: 991px) {
    .product-tabs .tab-header {
        flex-direction: column;
        align-items: flex-start !important;
        margin-bottom: 25px;
        position: relative;
        z-index: 1;
    }
    
    .product-tabs .tab-header .nav-tabs {
        width: 100%;
        margin-bottom: 20px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        background: transparent;
        border: none;
        padding: 0;
    }
    
    .product-tabs .tab-header .nav-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .product-tabs .tab-header .nav-item {
        flex-shrink: 0;
        margin-right: 8px;
    }
    
    .product-tabs .tab-header .nav-link {
        background: #f8f9fa;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 10px 18px;
        font-size: 14px;
        font-weight: 500;
        color: #666;
        transition: all 0.3s ease;
        white-space: nowrap;
    }
    
    .product-tabs .tab-header .nav-link.active {
        background: #3BB77E;
        color: #fff;
        border-color: #3BB77E;
    }
    
    .product-tabs .tab-header .view-more {
        margin-top: 10px;
    }
    
    /* Ensure tab content doesn't overlap */
    .product-tabs .tab-content {
        position: relative;
        z-index: 0;
        margin-top: 10px;
    }
}

/* Tablet: 2-3 products per row */
@media (max-width: 991px) and (min-width: 769px) {
    .product-tabs .product-grid-4 .col-lg-3 {
        width: 33.333%;
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }
}

/* Mobile: 2 products per row */
@media (max-width: 768px) {
    .product-tabs {
        padding: 40px 0;
    }
    
    .product-tabs .tab-header .nav-link {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .product-tabs .product-grid-4 .col-lg-3,
    .product-tabs .product-grid-4 .col-md-4 {
        width: 50%;
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .product-tabs .product-cart-wrap {
        margin-bottom: 20px;
    }
    
    .product-tabs .product-cart-wrap .product-img {
        height: 200px;
    }
    
    .product-tabs .product-cart-wrap .product-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .product-tabs .product-content-wrap h2 {
        font-size: 14px;
        margin-bottom: 5px;
    }
    
    .product-tabs .product-content-wrap .product-category {
        font-size: 11px;
    }
    
    .product-tabs .product-content-wrap .product-price {
        font-size: 14px;
    }
}

/* Extra small: 1 product per row */
@media (max-width: 480px) {
    .product-tabs .product-grid-4 .col-6 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .product-tabs .product-cart-wrap .product-img {
        height: 280px;
    }
}

/* ============================================
   2B. MONTHLY BEST SELL SECTION (Carousel) - RESPONSIVE
   ============================================ */

/* Tablet: 2 products per row */
@media (max-width: 991px) and (min-width: 769px) {
    /* Monthly Best product carousel */
    .carausel-4-columns .product-cart-wrap {
        width: 50% !important;
        flex: 0 0 50%;
        max-width: 50%;
        padding: 0 10px;
        margin-bottom: 20px;
    }
    
    /* Hide left sidebar banner on tablet */
    .bg-grey-9 .col-lg-3 {
        display: none !important;
    }
    
    .bg-grey-9 .col-lg-9 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Ensure slider works with 2 columns */
    .carausel-4-columns.slick-initialized .slick-slide {
        width: 50% !important;
        padding: 0 10px;
    }
}

/* Mobile: 1 product per row with slider support */
@media (max-width: 768px) {
    /* Monthly Best section adjustments */
    .bg-grey-9.section-padding {
        padding: 40px 0 !important;
    }
    
    .bg-grey-9 .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* CRITICAL: Fix tab visibility and stacking order */
    .heading-tab {
        flex-direction: column;
        align-items: flex-start !important;
        margin-bottom: 25px;
        position: relative;
        z-index: 10; /* Above everything else */
    }
    
    .heading-tab-left {
        width: 100%;
        margin-bottom: 15px;
        position: relative;
        z-index: 11;
    }
    
    .heading-tab-left .section-title {
        font-size: 22px;
        margin-bottom: 10px !important;
    }
    
    /* TABS: Use static/relative positioning for normal document flow */
    .heading-tab-right {
        width: 100%;
        position: relative;
        z-index: 11;
        margin-bottom: 20px; /* Space before products */
    }
    
    .heading-tab-right .nav-tabs {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        border: none;
        background: transparent;
        padding: 0;
        position: relative; /* Normal flow, not absolute */
    }
    
    .heading-tab-right .nav-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .heading-tab-right .nav-tabs .nav-item {
        flex-shrink: 0;
        margin-right: 8px;
    }
    
    .heading-tab-right .nav-tabs .nav-link {
        padding: 10px 18px;
        font-size: 14px;
        font-weight: 500;
        margin-right: 0;
        background: #f8f9fa;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        color: #666;
        transition: all 0.3s ease;
        white-space: nowrap;
    }
    
    .heading-tab-right .nav-tabs .nav-link.active {
        background: #3BB77E;
        color: #fff;
        border-color: #3BB77E;
    }
    
    /* Hide sidebar banner on mobile */
    .bg-grey-9 .col-lg-3 {
        display: none !important;
    }
    
    .bg-grey-9 .col-lg-9 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        padding: 0;
    }
    
    /* Tab content - ensure it stays BELOW tabs */
    .bg-grey-9 .tab-content {
        width: 100%;
        position: relative;
        z-index: 1; /* Below tabs (which are z-index: 11) */
        margin-top: 0;
    }
    
    /* Carousel container - proper width and overflow */
    .carausel-4-columns-cover {
        width: 100%;
        max-width: 100%;
        overflow: visible;
        position: relative;
        padding: 0 15px;
        z-index: 1; /* Below tabs */
    }
    
    /* Product carousel - show as grid on mobile for better visibility */
    .carausel-4-columns {
        width: 100% !important;
        display: block !important;
    }
    
    /* When Slick is NOT initialized (fallback) */
    .carausel-4-columns:not(.slick-initialized) {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 15px;
        width: 100%;
    }
    
    .carausel-4-columns:not(.slick-initialized) .product-cart-wrap {
        width: 100% !important;
        max-width: 100%;
        display: block;
    }
    
    /* When Slick slider IS initialized */
    .carausel-4-columns.slick-initialized {
        width: 100% !important;
        display: block !important;
    }
    
    .carausel-4-columns.slick-initialized .slick-list {
        width: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }
    
    .carausel-4-columns.slick-initialized .slick-track {
        display: flex !important;
        align-items: stretch;
    }
    
    .carausel-4-columns.slick-initialized .slick-slide {
        width: 100% !important;
        height: auto;
        padding: 0 10px;
        box-sizing: border-box;
    }
    
    .carausel-4-columns.slick-initialized .slick-slide > div {
        height: 100%;
    }
    
    /* Product cards styling */
    .carausel-4-columns .product-cart-wrap {
        width: 100% !important;
        max-width: 100%;
        margin-bottom: 20px;
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 10px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    /* Product image container */
    .carausel-4-columns .product-img-action-wrap {
        width: 100%;
        position: relative;
        background: #f8f9fa;
    }
    
    .carausel-4-columns .product-img {
        width: 100%;
        height: 280px;
        overflow: hidden;
        position: relative;
    }
    
    .carausel-4-columns .product-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }
    
    .carausel-4-columns .product-cart-wrap:active .product-img img {
        transform: scale(1.05);
    }
    
    /* Product content */
    .carausel-4-columns .product-content-wrap {
        padding: 15px;
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    
    .carausel-4-columns .product-content-wrap .product-category {
        font-size: 11px;
        margin-bottom: 5px;
        text-transform: uppercase;
        color: #666;
    }
    
    .carausel-4-columns .product-content-wrap h2 {
        font-size: 15px;
        line-height: 1.4;
        margin-bottom: 8px;
        font-weight: 600;
    }
    
    .carausel-4-columns .product-content-wrap .rating-result {
        margin-bottom: 8px;
    }
    
    .carausel-4-columns .product-content-wrap .product-price {
        font-size: 16px;
        font-weight: 700;
        margin-bottom: 10px;
    }
    
    .carausel-4-columns .product-content-wrap .product-price .old-price {
        font-size: 14px;
        font-weight: 400;
    }
    
    /* Action buttons */
    .carausel-4-columns .product-action-1 {
        position: absolute;
        top: 15px;
        right: 15px;
        z-index: 2;
        opacity: 1 !important;
    }
    
    .carausel-4-columns .product-action-1 .action-btn {
        background: #fff;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        margin-bottom: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .carausel-4-columns .product-action-1.show {
        position: static;
        margin-top: auto;
    }
    
    .carausel-4-columns .product-action-1.show .action-btn {
        width: 100%;
        border-radius: 8px;
        height: 44px;
        background: #3BB77E;
        color: #fff;
        font-weight: 600;
        margin: 0;
    }
    
    /* Carousel navigation arrows - HIDE on mobile for cleaner swipe experience */
    .carausel-4-columns-arrow {
        display: none !important; /* Hidden on mobile - use swipe gestures */
    }
    
    /* If arrows need to be shown, they should be outside product cards */
    .carausel-4-columns-arrow .slick-arrow {
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.95) !important;
        border-radius: 50%;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
        display: none !important; /* Hidden on mobile */
        align-items: center;
        justify-content: center;
        z-index: 2; /* Below tabs */
        opacity: 0.8;
        transition: opacity 0.3s ease;
    }
    
    .carausel-4-columns-arrow .slick-arrow:hover {
        opacity: 1;
    }
    
    .carausel-4-columns-arrow .slick-arrow:before {
        font-size: 16px;
        color: #333;
        opacity: 1;
    }
    
    .carausel-4-columns-arrow .slick-prev {
        left: -18px; /* Outside the container */
    }
    
    .carausel-4-columns-arrow .slick-next {
        right: -18px; /* Outside the container */
    }
    
    /* Dots navigation */
    .carausel-4-columns .slick-dots {
        position: relative;
        bottom: 0;
        padding: 15px 0 0 0;
        display: flex !important;
        justify-content: center;
    }
    
    .carausel-4-columns .slick-dots li {
        margin: 0 4px;
    }
    
    .carausel-4-columns .slick-dots li button:before {
        font-size: 10px;
        color: #ccc;
        opacity: 1;
    }
    
    .carausel-4-columns .slick-dots li.slick-active button:before {
        color: #3BB77E;
        opacity: 1;
    }
    
    /* Badges */
    .carausel-4-columns .product-badges {
        position: absolute;
        top: 15px;
        left: 15px;
        z-index: 2;
    }
    
    .carausel-4-columns .product-badges span {
        font-size: 11px;
        padding: 4px 10px;
        border-radius: 4px;
    }
}

/* Extra small mobile devices */
@media (max-width: 576px) {
    .bg-grey-9 .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .carausel-4-columns-cover {
        padding: 0 10px;
    }
    
    .carausel-4-columns .product-cart-wrap {
        margin-bottom: 15px;
    }
    
    .carausel-4-columns .product-img {
        height: 240px;
    }
    
    .carausel-4-columns .product-content-wrap {
        padding: 12px;
    }
    
    .carausel-4-columns .product-content-wrap h2 {
        font-size: 14px;
    }
    
    .carausel-4-columns .product-content-wrap .product-price {
        font-size: 15px;
    }
    
    /* Smaller arrows on very small screens */
    .carausel-4-columns-arrow .slick-arrow {
        width: 35px;
        height: 35px;
    }
    
    .carausel-4-columns-arrow .slick-arrow:before {
        font-size: 16px;
    }
    
    .carausel-4-columns-arrow .slick-prev {
        left: 5px;
    }
    
    .carausel-4-columns-arrow .slick-next {
        right: 5px;
    }
}

/* ============================================
   3. FESTIVAL PROMOTIONAL BANNER - RESPONSIVE
   ============================================ */

/* Button hover effect */
.btn-festival-promo:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3) !important;
}

/* Mobile responsive styles for festival banner */
@media (max-width: 991px) {
    .festival-promo-banner .promo-card {
        padding: 40px 30px !important;
    }
    
    .festival-promo-banner h2 {
        font-size: 32px !important;
    }
    
    .festival-promo-banner p {
        font-size: 18px !important;
    }
}

@media (max-width: 768px) {
    .festival-promo-banner {
        margin: 30px 0 !important;
    }
    
    .festival-promo-banner .promo-card {
        padding: 30px 20px !important;
        border-radius: 15px !important;
    }
    
    .festival-promo-banner h2 {
        font-size: 28px !important;
        margin-bottom: 12px !important;
    }
    
    .festival-promo-banner p {
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }
    
    .festival-promo-banner .btn-festival-promo {
        padding: 15px 35px !important;
        font-size: 16px !important;
        display: block !important;
        margin: 0 auto !important;
    }
    
    /* Hide decorative circles on mobile for cleaner look */
    .festival-promo-banner .promo-card > div[style*="position: absolute"] {
        display: none;
    }
}

@media (max-width: 576px) {
    .festival-promo-banner .promo-card {
        padding: 25px 15px !important;
    }
    
    .festival-promo-banner h2 {
        font-size: 24px !important;
    }
    
    .festival-promo-banner p {
        font-size: 14px !important;
    }
    
    .festival-promo-banner .btn-festival-promo {
        padding: 12px 30px !important;
        font-size: 15px !important;
        width: 100%;
    }
}

/* ============================================
   4. DEALS & OUTLET SECTION - RESPONSIVE
   ============================================ */

/* Product list hover effects */
.product-list-small article {
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
}

.product-list-small article.hover-up:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.product-list-small article figure {
    overflow: hidden;
    border-radius: 8px;
}

.product-list-small article figure img {
    transition: transform 0.3s ease;
}

.product-list-small article:hover figure img {
    transform: scale(1.1);
}

.product-list-small .title-small a {
    transition: color 0.3s ease;
}

.product-list-small .title-small a:hover {
    color: #3BB77E;
}

/* Tablet: Stack columns, 2 products per row inside each column */
@media (max-width: 991px) and (min-width: 769px) {
    /* Make columns stack in 2x2 grid on tablet */
    .mb-45 .col-lg-3 {
        width: 50%;
        flex: 0 0 50%;
        max-width: 50%;
        margin-bottom: 30px;
    }
    
    /* Product list inside each section */
    .product-list-small article {
        margin-bottom: 15px;
    }
    
    .product-list-small figure {
        flex: 0 0 35%;
        max-width: 35%;
    }
    
    .product-list-small .col-md-8 {
        flex: 0 0 65%;
        max-width: 65%;
    }
}

/* Mobile: Stack all sections vertically, 2 products per row inside */
@media (max-width: 768px) {
    .mb-45 {
        margin-bottom: 30px !important;
    }
    
    .mb-45 .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Stack all 4 columns vertically */
    .mb-45 .col-lg-3,
    .mb-45 .col-md-6 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 30px;
    }
    
    /* Side banner in first column */
    .mb-45 .banner-img {
        height: 250px;
        margin-bottom: 30px;
    }
    
    .mb-45 .banner-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    /* Section titles */
    .section-title.style-1 {
        font-size: 20px;
        margin-bottom: 20px !important;
    }
    
    /* Product list - 2 items per row */
    .product-list-small {
        display: flex;
        flex-wrap: wrap;
        margin-left: -5px;
        margin-right: -5px;
    }
    
    .product-list-small article {
        width: 50%;
        flex: 0 0 50%;
        max-width: 50%;
        padding: 0 5px;
        margin-bottom: 15px;
        display: flex;
        flex-direction: column;
    }
    
    .product-list-small figure {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }
    
    .product-list-small figure img {
        width: 100%;
        height: 120px;
        object-fit: cover;
        border-radius: 8px;
    }
    
    .product-list-small .col-md-8 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        padding: 0;
    }
    
    .product-list-small .title-small {
        font-size: 13px;
        line-height: 1.3;
        margin-bottom: 5px;
    }
    
    .product-list-small .title-small a {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .product-list-small .product-price {
        font-size: 14px;
    }
    
    .product-list-small .product-price span {
        display: inline-block;
    }
}

/* Extra small mobile: 1 product per row in lists */
@media (max-width: 480px) {
    .product-list-small article {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        flex-direction: row;
    }
    
    .product-list-small figure {
        width: 35%;
        flex: 0 0 35%;
        max-width: 35%;
        margin-bottom: 0;
    }
    
    .product-list-small figure img {
        height: 90px;
    }
    
    .product-list-small .col-md-8 {
        width: 65%;
        flex: 0 0 65%;
        max-width: 65%;
        padding-left: 10px;
    }
}

/* ============================================
   4. GENERAL RESPONSIVE UTILITIES
   ============================================ */

/* Prevent horizontal scroll on all mobile devices */
@media (max-width: 991px) {
    body {
        overflow-x: hidden;
    }
    
    .container {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    [class*="col-"] {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Ensure images scale properly */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Product card images */
    .product-img img {
        width: 100%;
        object-fit: cover;
    }
    
    /* Equal height product cards */
    .product-cart-wrap {
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    
    .product-img-action-wrap {
        flex: 0 0 auto;
    }
    
    .product-content-wrap {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
}

/* ============================================
   5. PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Smooth transitions on mobile */
@media (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: transparent;
    }
    
    a, button {
        touch-action: manipulation;
    }
    
    /* Optimize animations for mobile */
    .animated,
    .wow {
        animation-duration: 0.5s !important;
    }
}
