/* =============================================================================
   K-Tech Flash Sale (Giảm Sốc 50%) Component
   File: assets/css/builder/ktech-flash-sale.css
   ============================================================================= */

/* ---- Main Wrapper ---- */
.ktech-flash-sale-wrap {
    position: relative;
    background-color: var(--ktech-fs-bg, #ffc700);
    border-radius: 4px;
    padding: 10px;
    box-sizing: border-box;
    width: 100%;
}

/* ---- Header ---- */
.ktech-fs-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.ktech-fs-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ktech-fs-title {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--ktech-fs-header-color, #111111);
    letter-spacing: -0.5px;
}

.ktech-fs-promo-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.ktech-fs-promo-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ktech-fs-header-color, #111111);
    letter-spacing: 0.3px;
}

.ktech-fs-promo-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ktech-fs-promo-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: #111111;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

/* ---- Countdown Timer ---- */
.ktech-fs-countdown-wrap {
    padding-right: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ktech-fs-countdown-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ktech-fs-header-color, #111111);
    white-space: nowrap;
}

.ktech-fs-countdown-boxes {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ktech-fs-time-box {
    background: #000000;
    color: #ffffff;
    border-radius: 4px;
    padding: 8px 10px;
    min-width: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.ktech-fs-time-num {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.1;
    color: #ffffff;
}

.ktech-fs-time-unit {
    font-size: 9px;
    font-weight: 500;
    line-height: 1;
    color: #ffffff;
    opacity: 0.9;
    margin-top: 1px;
}

.ktech-fs-time-sep {
    font-size: 14px;
    font-weight: 700;
    color: var(--ktech-fs-header-color, #111111);
}

/* ---- Slider Container ---- */
.ktech-fs-slider-container {
    position: relative;
    width: 100%;
}

.ktech-flash-sale-slider.swiper {
    width: 100%;
    overflow: hidden;
    padding: 2px;
    box-sizing: border-box;
}

.ktech-flash-sale-slider .swiper-wrapper {
    box-sizing: border-box;
    display: flex;
}

/* Swiper Multi-Row Grid Support */
.ktech-flash-sale-slider.swiper-grid>.swiper-wrapper {
    flex-wrap: wrap;
    flex-direction: row;
}

/* Slide item */
.ktech-product-slide.swiper-slide {
    height: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .ktech-flash-sale-slider.swiper-grid .swiper-slide {
        box-sizing: border-box;
        height: calc((100% - var(--ktech-fs-gap, 12px)) / 2) !important;
    }
}

/* ---- Product Card ---- */
.ktech-product-card {
    background: var(--ktech-fs-card-bg, #ffffff);
    border-radius: var(--ktech-fs-card-radius, 10px);
    padding: 10px 10px 12px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.ktech-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.09);
}

/* Image Wrap: 1:1 square ratio based on width */
.ktech-product-img-wrap {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    border-radius: calc(var(--ktech-fs-card-radius, 10px) - 2px);
    background: #ffffff;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.ktech-product-img-wrap a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ktech-product-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: auto;
    transition: transform 0.3s ease;
}

.ktech-product-card:hover .ktech-product-img-wrap img {
    transform: scale(1.05);
}

/* Body */
.ktech-product-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
    min-height: 0;
}

/* Title */
.ktech-product-title {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    height: 35px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ktech-product-title a {
    color: #333333;
    text-decoration: none;
    transition: color 0.18s;
}

.ktech-product-title a:hover {
    color: #e53935;
}

/* Rating */
.ktech-product-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 0px;
    font-size: 11px;
}

.ktech-stars-wrap {
    color: #f5a623;
    font-size: 13px;
    letter-spacing: -1px;
    line-height: 1;
}

.ktech-star.empty {
    color: #dcdcdc;
}

.ktech-rating-count {
    font-size: 11px;
    color: #888888;
    line-height: 1;
}

/* Price & Cart row */
.ktech-product-price-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px;
    margin-top: auto;
    margin-bottom: 6px;
}

.ktech-price-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ktech-current-price {
    font-size: 15px;
    font-weight: 700;
    color: #e53935;
    line-height: 1.15;
}

.ktech-current-price .woocommerce-Price-amount {
    color: #e53935;
    font-weight: 700;
}

.ktech-old-price-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ktech-old-price {
    font-size: 11px;
    color: #8c8c8c;
    text-decoration: line-through;
    line-height: 1;
}

.ktech-old-price .woocommerce-Price-amount {
    color: #8c8c8c;
    font-weight: normal;
}

.ktech-discount-pill {
    background: #e53935;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.1;
    display: inline-block;
}

/* Add to cart circle button */
.ktech-cart-btn-wrap {
    flex-shrink: 0;
}

.ktech-add-cart-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #ffffff !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(229, 57, 53, 0.35);
    transition: transform 0.2s ease, background-color 0.2s ease;
    border: none;
    outline: none;
}

.ktech-add-cart-btn:hover {
    background: var(--primary-color);
    transform: scale(1.1);
    color: #ffffff !important;
}

.ktech-add-cart-btn.added::after {
    display: none !important;
}

.ktech-add-cart-btn.loading {
    opacity: 0.6;
}

/* Sold Bar (Shopee / TikTok style) */
.ktech-sold-bar-wrap {
    width: 100%;
    margin-top: auto;
    flex-shrink: 0;
}

.ktech-sold-bar {
    width: 100%;
    height: 18px;
    background: #ffb4b4;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.ktech-sold-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: #e53935;
    border-radius: 10px;
    transition: width 0.4s ease;
}

.ktech-sold-label {
    position: relative;
    z-index: 2;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    padding: 0 6px;
    user-select: none;
    line-height: 18px;
}

/* ---- Navigation Arrows ---- */
.ktech-fs-nav {
    position: absolute;
    top: 55%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    color: #333333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    outline: none;
    padding: 0;
}

.ktech-fs-nav:hover {
    background: #e53935;
    color: #ffffff;
    border-color: #e53935;
    transform: translateY(-50%) scale(1.08);
}

.ktech-fs-prev {
    left: -14px;
}

.ktech-fs-next {
    right: -14px;
}

.ktech-fs-nav.swiper-button-disabled,
.ktech-fs-nav.swiper-button-lock {
    display: none !important;
}

/* ---- Fallback layout before Swiper init or when few items ---- */
@media (min-width: 1025px) {
    .ktech-flash-sale-slider:not(.swiper-initialized) .swiper-wrapper {
        display: flex;
        flex-wrap: wrap;
        gap: var(--ktech-fs-gap, 12px);
    }

    .ktech-flash-sale-slider:not(.swiper-initialized) .swiper-slide {
        width: calc((100% - 4 * var(--ktech-fs-gap, 12px)) / 5);
        max-width: calc((100% - 4 * var(--ktech-fs-gap, 12px)) / 5);
        flex-shrink: 0;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .ktech-flash-sale-slider:not(.swiper-initialized) .swiper-wrapper {
        display: flex;
        flex-wrap: wrap;
        gap: var(--ktech-fs-gap, 12px);
    }

    .ktech-flash-sale-slider:not(.swiper-initialized) .swiper-slide {
        width: calc((100% - 2 * var(--ktech-fs-gap, 12px)) / 3);
        max-width: calc((100% - 2 * var(--ktech-fs-gap, 12px)) / 3);
        flex-shrink: 0;
    }
}

/* ---- Responsive Breakpoints ---- */

/* Mobile (< 768px) */
@media (max-width: 767px) {
    .ktech-flash-sale-wrap {
        padding: 14px 12px 18px;
    }

    .ktech-fs-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .ktech-fs-title {
        font-size: 20px;
    }

    .ktech-fs-countdown-wrap {
        width: 100%;
        justify-content: flex-start;
    }

    .ktech-fs-nav {
        display: none !important;
    }

    .ktech-product-card {
        padding: 8px 8px 10px;
    }

    .ktech-product-title {
        font-size: 12px;
        height: 32px;
    }

    .ktech-current-price {
        font-size: 14px;
    }

    .ktech-add-cart-btn {
        width: 26px;
        height: 26px;
    }
}

/* =============================================================================
   Single Product Flash Sale Banner (Image 2)
   ============================================================================= */

.ktech-single-fs-banner {
    margin: 10px 0 14px 0;
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
    box-sizing: border-box;
}

.ktech-single-fs-top {
    background: #ffc700;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-sizing: border-box;
}

.ktech-single-fs-title {
    font-size: 15px;
    font-weight: 800;
    color: #111111;
    text-transform: uppercase;
    letter-spacing: -0.2px;
}

.ktech-single-fs-countdown {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ktech-single-fs-box {
    background: #000000;
    color: #ffffff;
    border-radius: 3px;
    padding: 3px 6px;
    min-width: 22px;
    text-align: center;
    box-sizing: border-box;
}

.ktech-single-fs-num {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    display: block;
    color: #ffffff;
}

.ktech-single-fs-sep {
    font-size: 14px;
    font-weight: 700;
    color: #111111;
}

.ktech-single-fs-bottom {
    background: #ffc700;
    padding: 0 14px 10px 14px;
    box-sizing: border-box;
}

.ktech-single-fs-sold-bar {
    position: relative;
    background: #ffccd0;
    border-radius: 20px;
    height: 20px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}

.ktech-single-fs-sold-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: linear-gradient(90deg, #f84d59, #ff3838);
    border-radius: 20px;
    transition: width 0.4s ease;
    z-index: 1;
}

.ktech-single-fs-sold-label {
    position: relative;
    z-index: 2;
    font-size: 11.5px;
    font-weight: 600;
    color: #ffffff;
    line-height: 20px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
}

/* Single Product Saving text */
.ktech-single-saving {
    font-size: 13px;
    color: #e50014;
    font-weight: 500;
    margin-top: 4px;
    display: block;
}

/* =============================================================================
   Single Product Promotions Box (KHUYẾN MÃI - ƯU ĐÃI)
   ============================================================================= */

.ktech-single-promo-box {
    margin: 16px 0 20px 0;
    border: 1px solid #ffccd0;
    border-radius: 4px;
    overflow: hidden;
    background: #ffffff;
    box-sizing: border-box;
}

.ktech-promo-header {
    background: #e50014;
    color: #ffffff;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
}

.ktech-promo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ktech-promo-title {
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    color: #ffffff;
}

.ktech-promo-list {
    padding: 12px 14px 12px 28px;
    margin: 0;
    list-style: disc;
    box-sizing: border-box;
}

.ktech-promo-list li {
    font-size: 13px;
    line-height: 1.6;
    color: #333333;
    margin-bottom: 6px;
}

.ktech-promo-list li:last-child {
    margin-bottom: 0;
}

.ktech-promo-list strong {
    font-weight: 700;
    color: #111111;
}

.ktech-promo-copy {
    color: var(--primary-color) !important;
    font-weight: 600;
    font-size: 12.5px;
    margin-left: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    vertical-align: middle;
}

.ktech-promo-copy:hover {
    color: #b70010 !important;
    text-decoration: underline;
}

.ktech-promo-copy.is-copied {
    color: #10b981 !important;
    font-weight: 700;
}