/* ============================================================
HBWeb Flash Sale - Frontend CSS
============================================================ */

/* ---- Variables ---- */
:root {
	--hbfs-primary:   #f35627;
	--hbfs-secondary: #fda524;
	--hbfs-text:      #fff;
	--hbfs-radius:    8px;
}

/* ============================================================
SINGLE PRODUCT BAR
============================================================ */
.hbfs-product-bar {
	background: linear-gradient(135deg, #ff4500 0%, #fda524 100%);
	border-radius: var(--hbfs-radius);
	padding: 12px 16px;
	margin-bottom: 18px;
	color: #fff;
	font-family: inherit;
	position: relative; /* cần thiết để frame_image overlay hoạt động */
	overflow: hidden;
}

.hbfs-product-bar__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
	flex-wrap: wrap;
	gap: 8px;
}

.hbfs-product-bar__title {
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: .5px;
	display: flex;
	align-items: center;
	gap: 6px;
}

.hbfs-product-bar__title svg { width: 20px; height: 20px; fill: #fff; }

/* Countdown */
.hbfs-countdown {
	display: flex;
	gap: 6px;
	align-items: center;
}

.hbfs-countdown__block {
	background: rgba(0,0,0,.25);
	border-radius: 5px;
	min-width: 36px;
	text-align: center;
	padding: 2px 6px;
	font-size: .85rem;
	font-weight: 700;
}

.hbfs-countdown__sep {
	font-weight: 900;
	font-size: 1rem;
	opacity: .8;
}

/* Progress Bar */
.hbfs-progress-wrap {
	background: rgba(255,255,255,.3);
	border-radius: 50px;
	height: 14px;
	overflow: hidden;
	position: relative;
}

.hbfs-progress-bar {
	height: 100%;
	background: #fff;
	border-radius: 50px;
	transition: width .6s ease;
	position: relative;
}

.hbfs-progress-bar::after {
	content: '';
	position: absolute;
	top: 0; left: 0; right: 0; bottom: 0;
	background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.4) 50%, transparent 100%);
	animation: hbfs-shine 1.8s linear infinite;
}

@keyframes hbfs-shine {
	0%   { transform: translateX(-100%); }
	100% { transform: translateX(200%); }
}

.hbfs-progress-label {
	margin-top: 5px;
	font-size: .8rem;
	opacity: .9;
	display: flex;
	align-items: center;
	gap: 4px;
}

/* ============================================================
CART BADGE
============================================================ */
.hbfs-cart-badge {
	display: inline-block;
	background: linear-gradient(135deg, #f35627, #fda524);
	color: #fff;
	font-size: .7rem;
	font-weight: 700;
	padding: 2px 7px;
	border-radius: 20px;
	margin-left: 6px;
	vertical-align: middle;
	letter-spacing: .5px;
}

/* ============================================================
SLIDER  [hbfs_slider]
============================================================ */
.hbfs-slider-wrap {
	margin-bottom: 32px;
	position: relative;
	overflow: visible !important;
}

/* Header bar — border-radius ở đây thay vì trên wrapper */
.hbfs-slider-header {
	background: linear-gradient(135deg, #f35627 0%, #fda524 100%);
	padding: 12px 18px;
	display: flex;
	align-items: center;
	gap: 12px;
	color: #fff;
	border-radius: var(--hbfs-radius) var(--hbfs-radius) 0 0;
}

.hbfs-slider-header__name {
	font-size: 1.1rem;
	font-weight: 800;
	letter-spacing: 1px;
	text-transform: uppercase;
}

.hbfs-slider-header__countdown {
	display: flex;
	gap: 4px;
	margin-left: auto;
}

.hbfs-slider-header__countdown .hbfs-countdown__block {
	background: rgba(0,0,0,.3);
}

.hbfs-slider-header__link {
	color: #fff;
	font-size: .85rem;
	text-decoration: none;
	border: 1px solid rgba(255,255,255,.6);
	padding: 3px 10px;
	border-radius: 20px;
	white-space: nowrap;
	transition: background .2s;
}

.hbfs-slider-header__link:hover { background: rgba(255,255,255,.2); }

/* Banner */
.hbfs-slider-banner img {
	width: 100%;
	display: block;
	object-fit: cover;
}

/* Splide carousel container */
.hbfs-products-row {
	background: #fff;
	border-radius: 0 0 var(--hbfs-radius) var(--hbfs-radius);
	position: relative; /* cần thiết để splide__arrow position: absolute hoạt động đúng */
}
.hbfs-products-row:focus { outline: none; }

/* Product card — Flickity cell */
.hbfs-product-card {
	/* width được set bởi inline <style> block từ PHP: calc((100% - 20px) / show_col) */
	margin-right: 10px;
	border: 1px solid #ebebeb;
	border-radius: var(--hbfs-radius);
	overflow: hidden;
	background: #fff;
	transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
	text-align: left;
	text-decoration: none;
	color: inherit;
	display: flex;
	flex-direction: column;
	/* Đảm bảo không bị stretch bởi Flickity slider */
	box-sizing: border-box;
}
.hbfs-product-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(243,86,39,.13);
	border-color: #fda524;
}
/* Tắt transition khi đang drag — tránh giật khi kéo */
.hbfs-products-row.is-dragging .hbfs-product-card {
	transition: none !important;
	transform: none !important;
}

/* ── Image ── */
.hbfs-product-card__img-wrap {
	position: relative;
	background: #f5f5f5;
	flex-shrink: 0;
}
.hbfs-product-card__img-wrap img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	display: block;
}

/* Discount badge */
.hbfs-badge {
	position:absolute;
	top: 6px;
	left: 6px;
	background: red;
	color: #fff;
	font-size: .68rem;
	font-weight: 700;
	padding: 2px 5px;
	border-radius: 3px;
	letter-spacing: .3px;
}

.hbfs-product-bar .hbfs-badge {
	position:unset;

}

/* Frame image overlay */
.hbfs-product-card__frame {
	position: absolute;
	inset: 0;
	pointer-events: none;
}
.hbfs-product-card__frame img { width: 100%; height: 100%; object-fit: fill; }

/* ── Body ── */
.hbfs-product-card__body {
	padding: 8px 10px 6px;
	flex: 1;                   /* đẩy footer xuống đáy */
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.hbfs-product-card__name {
	font-size: .8rem;
	color: #333;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.2em;         /* chiều cao tối thiểu 2 dòng để các card đều nhau */
}

/* ── Prices (cùng hàng) ── */
.hbfs-product-card__prices {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 4px 6px;
	margin-top: auto;          /* giá luôn ở dưới tên */
}
.hbfs-product-card__price-new span{
	color: #f35627 !important;
	font-weight: 700  !important;
	font-size: 1.2rem  !important;
	white-space: nowrap  !important;
}
.hbfs-product-card__price-new .woocommerce-Price-currencySymbol { font-size: .78rem; }
.hbfs-product-card__price-old span{
	color: #bbb !important;
	font-size: .72rem;
	text-decoration: line-through;
	white-space: nowrap !important;
}

/* ── Footer: sold label + progress bar ── */
.hbfs-product-card__footer {
	padding: 0 10px 10px;
}
.hbfs-product-card__sold-label {
	font-size: .7rem;
	color: #f35627;
	font-weight: 600;
	margin-bottom: 4px;
	display: flex;
	align-items: center;
	gap: 3px;
}
.hbfs-product-card__progress-wrap {
	height: 5px;
	background: #f0f0f0;
	border-radius: 50px;
	overflow: hidden;
}
.hbfs-product-card__progress-bar {
	height: 100%;
	background: linear-gradient(90deg, #f35627, #fda524);
	border-radius: 50px;
	transition: width .6s ease;
}

/* ============================================================
RESPONSIVE
============================================================ */
@media (max-width: 768px) {
	.hbfs-product-card__name { font-size: .75rem; }
	.hbfs-slider-header__name { font-size: .9rem; }
	.hbfs-slider-header { flex-wrap: wrap; gap: 6px; }
	.hbfs-right {
		margin: 0;
	}
}

@media (max-width: 480px) {
	.hbfs-product-card__price-new { font-size: .82rem; }
	.hbfs-slider-header__countdown { margin-left: 0; }
}

/* Countdown ngày label */
.hbfs-countdown__block small {
	font-size: .55rem;
	display: block;
	line-height: 1;
	opacity: .8;
	font-weight: 400;
}

/* ============================================================
SPLIDE ARROW BUTTON OVERRIDE — style theo theme cam/đỏ
Splide inject nút vào .splide > .splide__arrows (ngoài __track)
============================================================ */

/* Container .hbfs-products-row.splide cần position relative + padding hai bên */
.hbfs-products-row.splide {
	padding-left: 0px;
	padding-right: 0px;
	padding-top:10px;
}

.hbfs-products-row.splide .splide__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	width: 35px;
	height: 35px;
	margin:0;
	border-radius: 50%;
	background: linear-gradient(135deg, #f35627, #fda524) !important;
	box-shadow: 0 2px 10px rgba(0,0,0,.3);
	border: none;
	outline: none;
	opacity: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .2s, box-shadow .2s;
	padding: 0;
}
.hbfs-products-row.splide .splide__arrow:hover {
	background: linear-gradient(135deg, #e04b1e, #f09010) !important;
	box-shadow: 0 4px 14px rgba(0,0,0,.35);
	opacity: 1;
}
.hbfs-products-row.splide .splide__arrow svg {
	fill: #fff;
	height: 14px;
	flex-shrink: 0;
}
.hbfs-products-row.splide .splide__arrow:disabled {
	opacity: .3 !important;
	cursor: default;
	pointer-events: none;
}
.hbfs-products-row.splide .splide__arrow--prev {
	left: 0;
	transform: translateY(-50%) rotate(180deg);
}
.hbfs-products-row.splide .splide__arrow--next { right: 0; }

/* Splide slide items fill full height */
.hbfs-products-row .splide__slide {
	display: flex;
	flex-direction: column;
	margin-left: 0;
	padding: 2px;
}
.hbfs-products-row .splide__slide .hbfs-product-card {
	flex: 1;
	display: flex;
	flex-direction: column;
}

/* ============================================================
UPCOMING FLASH SALE TEASER
============================================================ */

/* Header teaser — pulse glow nhẹ */
.hbfs-upcoming-header {
	position: relative;
	overflow: hidden;
}
.hbfs-upcoming-header::before {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(255,255,255,.08);
	animation: hbfs-upcoming-pulse 2s ease-in-out infinite;
	pointer-events: none;
}
@keyframes hbfs-upcoming-pulse {
	0%, 100% { opacity: 0; }
	50%       { opacity: 1; }
}

.hbfs-upcoming-header__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.hbfs-upcoming-badge {
	font-size: .85rem;
	font-weight: 800;
	letter-spacing: 1px;
	text-transform: uppercase;
	background: rgba(255,255,255,.2);
	padding: 2px 8px;
	border-radius: 20px;
	display: inline-block;
	width: fit-content;
}
.hbfs-upcoming-header__sub {
	font-size: .72rem;
	opacity: .8;
	font-weight: 400;
}

/* Grid layout */
.hbfs-upcoming-grid {
	display: grid;
	grid-template-columns: repeat(var(--hbfs-cols, 5), 1fr);
	gap: 10px;
	padding: 12px;
	background: #fff;
	border-radius: 0 0 var(--hbfs-radius) var(--hbfs-radius);
}

/* Ribbon "Sắp diễn ra" góc dưới ảnh */
.hbfs-upcoming-card__ribbon {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: linear-gradient(135deg, #f35627, #fda524);
	color: #fff;
	font-size: .65rem;
	font-weight: 700;
	text-align: center;
	padding: 3px 0;
	letter-spacing: .3px;
}

/* Giá flash sale ẩn — shimmer "???" */
.hbfs-upcoming-price-secret {
	font-size: 1rem;
	font-weight: 800;
	letter-spacing: 3px;
	background: linear-gradient(90deg, #f35627 0%, #fda524 50%, #f35627 100%);
	background-size: 200% auto;
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	color: transparent;
	animation: hbfs-secret-shimmer 1.8s linear infinite;
}
@keyframes hbfs-secret-shimmer {
	0%   { background-position: 200% center; }
	100% { background-position: -200% center; }
}

/* Responsive */
@media (max-width: 900px) {
	.hbfs-upcoming-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
	.hbfs-upcoming-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
PRODUCT LOOP OVERLAY — Flatsome product box
============================================================ */

/*
* Wrapper bao quanh li.product — cần position:relative.
* Flatsome dùng ul.products > li.product, mỗi li đã có overflow:hidden.
* Ta inject div.hbfs-loop-wrap bên trong li (trước/sau content).
* Overlay được đặt absolute bên trong div.hbfs-loop-wrap.
*/


/* Tổng overlay container — absolute fill toàn bộ .hbfs-loop-wrap */
.hbfs-loop-overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 5;
}


.hbfs-loop-overlay__badge {
	position: absolute;
	top: 8px;
	left: 8px;
	color: #fff;
	font-size: .68rem;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 20px;
	letter-spacing: .3px;
	line-height: 1.5;
	box-shadow: 0 2px 6px rgba(0,0,0,.2);
	pointer-events: none;
}

/* ============================================================
FLASH SALE PRICE HIGHLIGHT — product loop ngoài shop
Khi sản phẩm đang flash sale (.hbfs-loop-wrap), làm nổi bật
giá sale (ins) và mờ giá gốc (del) của WooCommerce.
============================================================ */

/* Wrapper cần position:relative để badge định vị đúng */
.hbfs-loop-wrap {
	position: relative;
}

/* Giá sale (ins) — nổi bật màu cam + hơi to hơn bình thường */
.hbfs-loop-wrap .price ins,
.hbfs-loop-wrap .price ins .woocommerce-Price-amount {
	text-decoration: none;
	color: #f35627 !important;
	font-weight: 800 !important;
	font-size: 0.9em !important;
}
.hbfs-right {
	display: flex;
	gap: 10px;
	margin-left: auto;
	align-items: center;
}

/* Giá gốc (del) — nhỏ và mờ */
.hbfs-loop-wrap .price del,
.hbfs-loop-wrap .price del .woocommerce-Price-amount {
	color: #aaa !important;
	font-size: .8em !important;
	opacity: .75;
}

/* Giá đơn (khi không có del) cũng được highlight */
.hbfs-loop-wrap .price > .woocommerce-Price-amount {
	color: #f35627 !important;
	font-weight: 800 !important;
}

/* ============================================================
FRAME ẢNH — chỉ bọc .box-image
JS sẽ move .hbfs-loop-overlay__frame vào bên trong .box-image
Box-image cần position:relative (Flatsome đã có).
============================================================ */
.hbfs-loop-overlay__frame {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 3;
}
.hbfs-loop-overlay__frame img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: fill;
	pointer-events: none;
}
