/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    --mfs-primary-color: #ff3c00;
    --mfs-text-dark: #333;
    --mfs-text-gray: #888;
    --mfs-bg-light: #f4f6f8;
    --mfs-white: #ffffff;
    --mfs-radius: 12px;
    --mfs-shadow: 0 5px 15px rgba(0,0,0,0.05);
    --mfs-shadow-hover: 0 15px 30px rgba(0,0,0,0.1);
}

.mfs-wrapper * { 
    box-sizing: border-box; 
}

/* =========================================
   2. CONTAINER & HEADER
   ========================================= */
.flash-sale-section {
    background: var(--mfs-white);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--mfs-shadow);
    margin-bottom: 30px;
    font-family: 'Poppins', sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto;
    position: relative; /* Để định vị nút điều hướng */
}

/* Header: Title & Timer */
.fs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.fs-title {
    display: flex;
    align-items: center;
}

.fs-title h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--mfs-primary-color);
    text-transform: uppercase;
    margin: 0;
    line-height: 1.2;
}

.fs-timer-label {
    font-size: 14px; 
    color: #666; 
    margin-left: 10px;
    font-weight: 400;
}

.fs-timer {
    display: flex; 
    align-items: center; 
    gap: 5px; 
    font-weight: 600; 
    color: var(--mfs-text-dark);
}

.fs-timer-box {
    background-color: var(--mfs-text-dark);
    color: var(--mfs-white);
    padding: 5px 8px;
    border-radius: 6px;
    min-width: 36px;
    text-align: center;
    font-size: 16px;
    line-height: 1.4;
}

/* =========================================
   3. PRODUCT CARD STYLES
   ========================================= */
.fs-card {
    background: var(--mfs-white);
    border-radius: var(--mfs-radius);
    overflow: hidden;
    border: 1px solid #eee;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%; /* Đảm bảo chiều cao đồng đều */
}

.fs-card:hover {
    box-shadow: var(--mfs-shadow-hover);
    transform: translateY(-5px);
    border-color: transparent;
}

/* Badge giảm giá (Màu động từ PHP) */
.fs-badge {
    position: absolute;
    top: 10px; 
    left: 10px;
    background: var(--mfs-badge-bg, linear-gradient(135deg, #ff5722 0%, #ff9800 100%));
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px; 
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Ảnh sản phẩm */
.fs-image-wrapper {
    position: relative;
    padding-top: 100%; /* Tỉ lệ 1:1 */
    overflow: hidden;
    background-color: #fafafa;
}

.fs-image-wrapper img {
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    object-fit: cover;
    transition: transform 0.5s ease;
}

.fs-card:hover .fs-image-wrapper img { 
    transform: scale(1.08); 
}

/* Nội dung Card */
.fs-content { 
    padding: 15px; 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column;
}

.fs-product-name {
    font-size: 15px; 
    font-weight: 500; 
    margin: 0 0 10px;
    line-height: 1.4;
    height: 42px; /* Giới hạn 2 dòng */
    overflow: hidden;
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical;
}

.fs-product-name a { 
    color: var(--mfs-text-dark); 
    text-decoration: none; 
}

.fs-product-name a:hover {
    color: var(--mfs-primary-color);
}

/* Giá tiền */
.fs-price-row {
    display: flex; 
    align-items: baseline; 
    gap: 8px; 
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.fs-price-current { 
    color: var(--mfs-primary-color); 
    font-size: 18px; 
    font-weight: 700; 
}

.fs-price-old { 
    color: var(--mfs-text-gray); 
    text-decoration: line-through; 
    font-size: 13px; 
}

.fs-price-old del { 
    color: inherit; /* Fix màu mặc định của Woo */
    text-decoration: inherit;
} 

/* Thanh tiến độ (Màu động từ PHP) */
.fs-progress-container {
    position: relative; 
    height: 16px;
    background: #ffecd2; 
    border-radius: 10px; 
    overflow: hidden; 
    margin-bottom: 15px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.fs-progress-bar {
    height: 100%;
    background: var(--mfs-bar-bg, #ff3c00);
    border-radius: 10px;
    transition: width 1s ease-in-out;
    width: 0; /* JS sẽ cập nhật */
}

.fs-progress-text {
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%);
    font-size: 10px; 
    font-weight: 700; 
    color: #333; 
    text-transform: uppercase; 
    white-space: nowrap;
    z-index: 1;
}

/* Nút Mua (Màu động từ PHP) */
.fs-btn {
    display: block; 
    width: 100%; 
    padding: 10px; 
    text-align: center;
    border: none;
    background: var(--mfs-btn-bg, #333);
    color: #fff !important;
    font-weight: 600; 
    border-radius: 8px; 
    cursor: pointer; 
    text-decoration: none;
    transition: all 0.3s ease; 
    margin-top: auto; /* Đẩy nút xuống đáy */
    font-size: 14px;
}

.fs-btn:hover { 
    opacity: 0.9; 
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.fs-btn.disabled { 
    background: #ccc !important; 
    cursor: not-allowed; 
    color: #666 !important;
    box-shadow: none;
}

/* =========================================
   4. NAVIGATION BUTTONS (CIRCULAR STYLE)
   ========================================= */

/* Ẩn mũi tên mặc định xấu xí của Swiper */
.mfs-swiper-container .swiper-button-next:after,
.mfs-swiper-container .swiper-button-prev:after {
    display: none;
}

/* Style chung cho nút hình tròn */
.mfs-swiper-container .swiper-button-next,
.mfs-swiper-container .swiper-button-prev {
    width: 44px; 
    height: 44px;
    background-color: #ffffff;
    border-radius: 50%; /* Hình tròn */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); /* Đổ bóng */
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0; /* Mặc định ẩn */
    visibility: hidden;
    z-index: 10;
    margin-top: -22px; /* Căn giữa chiều dọc chính xác */
}

/* Hiện nút khi di chuột vào khu vực Flash Sale */
.flash-sale-section:hover .swiper-button-next,
.flash-sale-section:hover .swiper-button-prev {
    opacity: 1;
    visibility: visible;
}

/* Hiệu ứng khi di chuột vào nút */
.mfs-swiper-container .swiper-button-next:hover,
.mfs-swiper-container .swiper-button-prev:hover {
    background-color: var(--mfs-primary-color); /* Đổi sang màu chủ đạo của site */
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
    transform: scale(1.1);
}

/* Sử dụng Dashicons cho mũi tên */
.mfs-swiper-container .swiper-button-next:before,
.mfs-swiper-container .swiper-button-prev:before {
    font-family: 'dashicons';
    font-size: 28px;
    color: #333;
    transition: color 0.3s ease;
    line-height: 1;
    font-weight: 400;
}

/* Icon Next */
.mfs-swiper-container .swiper-button-next:before {
    content: "\f345"; /* dashicons-arrow-right-alt2 */
    margin-left: 2px;
}

/* Icon Prev */
.mfs-swiper-container .swiper-button-prev:before {
    content: "\f341"; /* dashicons-arrow-left-alt2 */
    margin-right: 2px;
}

/* Đổi màu icon sang trắng khi hover nút */
.mfs-swiper-container .swiper-button-next:hover:before,
.mfs-swiper-container .swiper-button-prev:hover:before {
    color: #ffffff;
}

/* Vị trí nút */
.mfs-swiper-container .swiper-button-next {
    right: 10px;
}
.mfs-swiper-container .swiper-button-prev {
    left: 10px;
}

/* Style cho nút khi bị vô hiệu hóa (hết slide) */
.mfs-swiper-container .swiper-button-disabled {
    opacity: 0 !important; /* Ẩn luôn nếu hết slide */
    cursor: auto;
    pointer-events: none;
}

/* =========================================
   5. ANIMATIONS (Hiệu ứng)
   ========================================= */
@keyframes pulse { 
    0% { transform: scale(1); } 
    50% { transform: scale(1.05); } 
    100% { transform: scale(1); } 
}
@keyframes shake { 
    0% { transform: translateX(0); } 
    25% { transform: translateX(-5px); } 
    75% { transform: translateX(5px); } 
    100% { transform: translateX(0); } 
}
@keyframes flash { 
    0%, 100% { opacity: 1; } 
    50% { opacity: 0.5; } 
}

.anim-pulse { animation: pulse 2s infinite; }
.anim-shake { animation: shake 0.5s infinite; }
.anim-flash { animation: flash 1s infinite; }

/* =========================================
   6. RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    .fs-header { 
        flex-direction: column; 
        align-items: flex-start; 
    }
    
    .fs-content { 
        padding: 10px; 
    }
    
    .fs-price-current {
        font-size: 16px;
    }
    
    /* Trên mobile nút điều hướng hiện luôn, không cần hover */
    .mfs-swiper-container .swiper-button-next,
    .mfs-swiper-container .swiper-button-prev {
        opacity: 1;
        visibility: visible;
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .mfs-swiper-container .swiper-button-next:before,
    .mfs-swiper-container .swiper-button-prev:before {
        font-size: 20px;
    }
}