/* Flash Sale Carousel Styles */
.flash-sale-carousel-section {
    padding: 0rem 0;
    margin: 0rem 0;
    position: relative;
}

.flash-sale-carousel-wrapper {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 3rem;
    /* Allow vertical scrolling to pass through naturally */
    touch-action: pan-y pan-x;
    overscroll-behavior-y: none;
}

.flash-sale-carousel {
    display: flex;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    cursor: grab;
    touch-action: pan-y pan-x; /* Allow both vertical and horizontal scrolling naturally */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    will-change: scroll-position; /* Optimize for scrolling */
    transform: translateZ(0); /* Force GPU acceleration */
    -webkit-transform: translateZ(0);
    overscroll-behavior-x: contain; /* Prevent scroll chaining to parent */
    overscroll-behavior-y: none; /* Allow vertical scroll to pass through to page */
}

/* Disable smooth scroll on mobile for better performance */
@media (max-width: 768px) {
    .flash-sale-carousel {
        scroll-behavior: auto; /* Instant scroll on mobile */
    }
}

.flash-sale-carousel::-webkit-scrollbar {
    display: none;
}

.flash-sale-slide {
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-height: 400px;
    will-change: transform; /* Optimize for transforms */
    transform: translateZ(0); /* Force GPU acceleration */
    -webkit-transform: translateZ(0);
    backface-visibility: hidden; /* Prevent flickering */
    -webkit-backface-visibility: hidden;
}

.flash-sale-slide:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.flash-sale-slide-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    display: block;
}

.flash-sale-slide-placeholder {
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    padding: 2rem;
    text-align: center;
}

.flash-sale-slide-placeholder i {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: lightningFlash 1.5s ease-in-out infinite;
}

.flash-sale-slide-placeholder h3 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
}

.flash-sale-slide-placeholder p {
    font-size: 1rem;
    opacity: 0.9;
}

.flash-sale-slide-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
    padding: 2rem;
    color: white;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.flash-sale-slide:hover .flash-sale-slide-overlay {
    transform: translateY(0);
}

.flash-sale-slide-content {
    text-align: center;
}

.flash-sale-slide-title {
    font-size: 1.5rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.flash-sale-slide-desc {
    font-size: 1rem;
    margin-bottom: 1rem;
    opacity: 0.95;
}

.flash-sale-slide-timer {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.flash-sale-slide-btn {
    background: white;
    color: #ff6b6b;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    margin-top: 1rem;
}

.flash-sale-slide-btn:hover {
    background: #ff6b6b;
    color: white;
    transform: scale(1.05);
}

/* Navigation Arrows */
.flash-sale-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(255, 107, 107, 0.3);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    color: #ff6b6b;
    font-size: 1.5rem;
}

.flash-sale-carousel-nav:hover {
    background: #ff6b6b;
    color: white;
    border-color: #ff6b6b;
    transform: translateY(-50%) scale(1.1);
}

.flash-sale-carousel-nav.prev {
    left: 0.5rem;
}

.flash-sale-carousel-nav.next {
    right: 0.5rem;
}

.flash-sale-carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Indicators */
.flash-sale-carousel-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding: 0 1rem;
}

.flash-sale-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d1d5db;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    flex-shrink: 0;
}

.flash-sale-indicator:hover {
    background: #9ca3af;
    transform: scale(1.2);
}

.flash-sale-indicator.active {
    background: #ff6b6b;
    width: 30px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
}

/* View All Button */
.view-all-flash-sales-btn {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.3);
}

.view-all-flash-sales-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.4);
    color: white;
}

/* Products Modal - Enhanced Design */
.flash-sale-products-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.flash-sale-products-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
}

.flash-sale-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeInOverlay 0.3s ease;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.flash-sale-modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    max-width: 95vw;
    max-height: 92vh;
    width: 1400px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalSlideIn {
    to {
        transform: scale(1) translateY(0);
    }
}

.flash-sale-products-modal.active .flash-sale-modal-content {
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.flash-sale-modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border: 2px solid rgba(255, 107, 107, 0.3);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 1.3rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.flash-sale-modal-close:hover {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    border-color: #ff6b6b;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.flash-sale-modal-close:active {
    transform: rotate(90deg) scale(0.95);
}

.flash-sale-modal-header {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 50%, #c44569 100%);
    color: white;
    padding: 3.75rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin-top: -4rem;
}

.flash-sale-modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 20px,
        rgba(255, 255, 255, 0.05) 20px,
        rgba(255, 255, 255, 0.05) 40px
    );
    animation: headerStripes 20s linear infinite;
}

@keyframes headerStripes {
    0% { transform: translate(0, 0); }
    100% { transform: translate(40px, 40px); }
}

.flash-sale-modal-header h2 {
    font-size: 1.75rem;
    font-weight: 900;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

.flash-sale-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
    position: relative;
}

/* Loading spinner styling */
#flashSaleLoadingSpinner {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Custom Scrollbar for Modal Body */
.flash-sale-modal-body::-webkit-scrollbar {
    width: 8px;
}

.flash-sale-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.flash-sale-modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    border-radius: 10px;
}

.flash-sale-modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #ee5a6f, #c44569);
}

/* Timer Styles */
.timer-segment {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    min-width: 70px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.timer-number {
    font-size: 1.5rem;
    font-weight: 900;
    display: block;
    color: #fff;
}

.timer-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    opacity: 0.9;
    margin-top: 0.3rem;
    display: block;
}

/* Compact Product Cards for Modal */
.flash-sale-modal-body .flash-sale-product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    margin-bottom: 0;
    border: 2px solid transparent;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.flash-sale-modal-body .flash-sale-product-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 8px 30px rgba(255, 107, 107, 0.3);
    border-color: #ff6b6b;
}

.flash-sale-modal-body .flash-sale-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 10;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 16px;
    font-weight: 700;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.5);
    animation: badgePulse 2s ease-in-out infinite;
}

.flash-sale-modal-body .flash-sale-product-image-wrapper {
    position: relative;
    padding-top: 75%;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.flash-sale-modal-body .fire-effect {
    position: absolute;
    bottom: 6px;
    right: 6px;
    font-size: 1rem;
    z-index: 5;
    animation: firePulse 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 3px rgba(255, 107, 107, 0.6));
    pointer-events: none;
}

@keyframes firePulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.1) rotate(5deg);
        opacity: 0.8;
    }
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 107, 107, 0.5);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 3px 12px rgba(255, 107, 107, 0.7);
    }
}

.flash-sale-modal-body .flash-sale-product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.flash-sale-modal-body .flash-sale-product-card:hover .flash-sale-product-image {
    transform: scale(1.1) rotate(2deg);
}

.flash-sale-modal-body .flash-sale-product-info {
    padding: 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.flash-sale-modal-body .flash-sale-product-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    min-height: 38px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.flash-sale-modal-body .flash-sale-product-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.flash-sale-modal-body .flash-sale-product-title a:hover {
    color: #ff6b6b;
}

.flash-sale-modal-body .flash-sale-price-section {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.flash-sale-modal-body .flash-sale-prices {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
}

.flash-sale-modal-body .flash-sale-normal-price {
    font-size: 0.7rem;
    color: #95a5a6;
    text-decoration: line-through;
    font-weight: 500;
}

.flash-sale-modal-body .flash-sale-current-price {
    font-size: 1.1rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.flash-sale-modal-body .flash-sale-discount-badge {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.65rem;
    box-shadow: 0 2px 6px rgba(46, 204, 113, 0.3);
    white-space: nowrap;
}

.flash-sale-modal-body .flash-sale-stock-info {
    margin-bottom: 0.5rem;
    font-size: 0.7rem;
}

.flash-sale-modal-body .stock-progress-bar-wrapper {
    height: 4px;
    background: #ecf0f1;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 0.3rem;
}

.flash-sale-modal-body .stock-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #ee5a6f);
    border-radius: 8px;
    transition: width 0.5s ease;
}

.flash-sale-modal-body .flash-sale-add-to-cart-btn {
    width: 100%;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: auto;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.flash-sale-modal-body .flash-sale-add-to-cart-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
    background: linear-gradient(135deg, #ee5a6f, #c44569);
}

.flash-sale-modal-body .flash-sale-add-to-cart-btn:active:not(:disabled) {
    transform: translateY(0);
}

.flash-sale-modal-body .flash-sale-add-to-cart-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.flash-sale-modal-body .flash-sale-variant-info {
    background: #f0f0f0;
    padding: 0.4rem;
    border-radius: 6px;
    margin: 0.4rem 0;
    font-size: 0.7rem;
    color: #666;
}

/* Modal Product Grid - Smaller Columns */
.flash-sale-modal-body .row {
    margin: 0;
}

.flash-sale-modal-body .row > [class*="col-"] {
    padding: 0.75rem;
    animation: fadeInProduct 0.4s ease forwards;
    opacity: 0;
}

@keyframes fadeInProduct {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for products */
.flash-sale-modal-body .row > [class*="col-"]:nth-child(1) { animation-delay: 0.05s; }
.flash-sale-modal-body .row > [class*="col-"]:nth-child(2) { animation-delay: 0.1s; }
.flash-sale-modal-body .row > [class*="col-"]:nth-child(3) { animation-delay: 0.15s; }
.flash-sale-modal-body .row > [class*="col-"]:nth-child(4) { animation-delay: 0.2s; }
.flash-sale-modal-body .row > [class*="col-"]:nth-child(5) { animation-delay: 0.25s; }
.flash-sale-modal-body .row > [class*="col-"]:nth-child(6) { animation-delay: 0.3s; }
.flash-sale-modal-body .row > [class*="col-"]:nth-child(n+7) { animation-delay: 0.35s; }

/* Mobile Responsive */
@media (max-width: 768px) {
    .flash-sale-carousel-wrapper {
        padding: 0 0rem;
    }
    
    .flash-sale-slide {
        min-height: 300px;
    }
    
    .flash-sale-slide-image,
    .flash-sale-slide-placeholder {
        height: 300px;
    }
    
    .flash-sale-carousel-nav {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }
    
    .flash-sale-carousel-nav.prev {
        left: 0.25rem;
    }
    
    .flash-sale-carousel-nav.next {
        right: 0.25rem;
    }
    
    .flash-sale-modal-content {
        max-width: 95vw;
        max-height: 95vh;
        width: 100%;
        border-radius: 16px 16px 0 0;
    }
    
    .flash-sale-modal-header {
        padding: 4.25rem 1rem;
        margin-top: -4rem;
    }
    
    .flash-sale-modal-header h2 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }
    
    .flash-sale-modal-body {
        padding: 0.75rem;
    }
    
    .flash-sale-modal-close {
        top: 0.75rem;
        right: 0.75rem;
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
    
    /* Smaller product cards on mobile */
    .flash-sale-modal-body .flash-sale-product-image-wrapper {
        padding-top: 80%;
    }
    
    .flash-sale-modal-body .flash-sale-product-info {
        padding: 0.6rem;
    }
    
    .flash-sale-modal-body .flash-sale-product-title {
        font-size: 0.8rem;
        min-height: 34px;
    }
    
    .flash-sale-modal-body .flash-sale-current-price {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .flash-sale-modal-body .row > [class*="col-"] {
        padding: 0.5rem;
    }
    
    .flash-sale-modal-body .flash-sale-product-info {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .flash-sale-slide {
        min-height: 250px;
    }
    
    .flash-sale-slide-image,
    .flash-sale-slide-placeholder {
        height: 250px;
    }
    
    .flash-sale-carousel-nav {
        display: none;
    }
}

@keyframes lightningFlash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

