:root { --fsp-color: #e53935; }

.fsp-wrap, .fsp-box { box-sizing: border-box; }
.fsp-wrap *, .fsp-box * { box-sizing: border-box; }

/* ---------- Khối Flash Sale (shortcode) ---------- */
.fsp-wrap { margin: 24px 0; border: 2px solid var(--fsp-color); border-radius: 10px; overflow: hidden; background: #fff; color: #222; }
.fsp-head { background: var(--fsp-color); color: #fff; padding: 12px 16px; }
.fsp-title { margin: 0; color: #fff; font-size: 22px; line-height: 1.2; letter-spacing: .5px; }

.fsp-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px 0; background: #fafafa; border-bottom: 1px solid #eee; -webkit-overflow-scrolling: touch; }
.fsp-tab { flex: 0 0 auto; cursor: pointer; border: 1px solid #ddd; border-bottom: 0; border-radius: 8px 8px 0 0; background: #fff; color: #333; padding: 8px 16px; font-size: 14px; line-height: 1.3; text-align: center; }
.fsp-tab b { display: block; font-size: 16px; }
.fsp-tab small { display: block; font-size: 11px; opacity: .75; }
.fsp-tab img { display: block; max-height: 40px; width: auto; }
.fsp-tab.is-active { background: var(--fsp-color); border-color: var(--fsp-color); color: #fff; }
.fsp-ptabs .fsp-tab { font-weight: 700; text-transform: uppercase; }

.fsp-panel { display: none; }
.fsp-panel.is-active { display: block; }

.fsp-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid #f0f0f0; }
.fsp-status { font-weight: 700; color: var(--fsp-color); }
.fsp-bar.is-soon .fsp-status { color: #8a6d00; }
.fsp-countdown { font-size: 14px; }
.fsp-cd-time { display: inline-block; min-width: 76px; padding: 2px 8px; border-radius: 4px; background: #222; color: #fff; font-variant-numeric: tabular-nums; text-align: center; }

/* ---------- Danh sách sản phẩm ---------- */
.fsp-listwrap { position: relative; padding: 14px; }
.fsp-list { display: grid; grid-template-columns: repeat(var(--fsp-cols, 5), minmax(0, 1fr)); gap: 12px; }
/* Nhiều hơn cols × rows: chia trang trượt ngang, mỗi trang cols × rows sản phẩm */
.fsp-listwrap.is-slider .fsp-list {
	grid-template-columns: none;
	grid-template-rows: repeat(var(--fsp-rows, 2), auto);
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - (var(--fsp-cols, 5) - 1) * 12px) / var(--fsp-cols, 5));
	overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.fsp-listwrap.is-slider .fsp-list::-webkit-scrollbar { display: none; }
.fsp-listwrap.is-slider .fsp-card { scroll-snap-align: start; }

.fsp-nav { position: absolute; top: 45%; z-index: 2; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
.fsp-prev { left: 4px; }
.fsp-next { right: 4px; }

.fsp-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid #eee; border-radius: 8px; background: #fff; }
.fsp-thumb { position: relative; display: block; }
.fsp-thumb img { display: block; width: 100%; height: auto; border-radius: 6px; }
.fsp-name { color: #222; font-size: 14px; line-height: 1.35; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.fsp-prices { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.fsp-price { color: var(--fsp-color); font-weight: 700; font-size: 16px; }
.fsp-base { color: #888; font-size: 12px; }
.fsp-note { font-size: 12px; color: #555; }
.fsp-giftline { font-size: 12px; color: #1b5e20; background: #e8f5e9; border-radius: 4px; padding: 3px 6px; }

.fsp-off { display: inline-block; padding: 1px 6px; border-radius: 4px; background: var(--fsp-color); color: #fff; font-size: 12px; font-weight: 700; }
.fsp-off-corner { position: absolute; top: 6px; right: 6px; }
.fsp-gift { position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 10px; background: #2e7d32; color: #fff; font-size: 11px; line-height: 1.5; z-index: 3; }

.fsp-btn { display: block; margin-top: auto; padding: 8px 10px; border-radius: 6px; background: var(--fsp-color); color: #fff; font-weight: 700; font-size: 14px; text-align: center; text-decoration: none; }
.fsp-btn:hover { color: #fff; opacity: .92; }
.fsp-btn.is-off { background: #bdbdbd; color: #fff; cursor: default; }

@media (max-width: 900px) {
	.fsp-wrap { --fsp-cols: 3 !important; }
}
@media (max-width: 600px) {
	.fsp-title { font-size: 18px; }
	.fsp-wrap { --fsp-cols: 2 !important; }
}

/* ---------- Khung trên trang chi tiết sản phẩm ---------- */
.fsp-box { margin: 12px 0; border: 1px solid var(--fsp-color); border-radius: 8px; overflow: hidden; background: #fff; color: #222; }
.fsp-box-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 12px; background: var(--fsp-color); color: #fff; font-size: 13px; }
.fsp-box-title { font-weight: 800; letter-spacing: .5px; }
.fsp-box-prog { opacity: .9; }
.fsp-box-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; padding: 10px 12px 4px; }
.fsp-box .fsp-price { font-size: 24px; }
.fsp-box .fsp-countdown { padding: 4px 12px; }
.fsp-box-note, .fsp-box-gift, .fsp-box-limit { padding: 4px 12px; font-size: 13px; }
.fsp-box-gift { color: #1b5e20; background: #e8f5e9; margin: 4px 12px; border-radius: 4px; padding: 6px 8px; }
.fsp-box-limit { color: #666; font-size: 12px; padding-bottom: 10px; }

/* ===== Chữ lớn hơn 25% ===== */
.fsp-title { font-size: 28px; }
.fsp-tab { font-size: 17.5px; }
.fsp-tab b { font-size: 20px; }
.fsp-tab small { font-size: 14px; }
.fsp-tab img { max-height: 50px; }
.fsp-status { font-size: 18px; }
.fsp-countdown { font-size: 17.5px; }
.fsp-cd-time { min-width: 95px; }
.fsp-name { font-size: 17.5px; }
.fsp-price { font-size: 20px; }
.fsp-base { font-size: 15px; }
.fsp-note, .fsp-giftline { font-size: 15px; }
.fsp-off { font-size: 15px; }
.fsp-gift { font-size: 14px; }
.fsp-btn { font-size: 17.5px; }
.fsp-box-head { font-size: 16px; }
.fsp-box .fsp-price { font-size: 30px; }
.fsp-box-note, .fsp-box-gift { font-size: 16px; }
.fsp-box-limit { font-size: 15px; }

/* ===== Mũi tên qua lại ===== */
.fsp-nav {
	display: none; position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
	width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%;
	background: #fff; color: var(--fsp-color);
	box-shadow: 0 2px 10px rgba(0,0,0,.22), 0 0 0 1px rgba(0,0,0,.06);
	align-items: center; justify-content: center; cursor: pointer;
	font-size: 0; line-height: 0;
	transition: transform .15s, background .15s, color .15s, opacity .15s;
}
.fsp-listwrap.has-scroll .fsp-nav { display: flex; }
.fsp-nav svg { display: block; width: 22px; height: 22px; }
.fsp-nav:hover:not(:disabled) { background: var(--fsp-color); color: #fff; transform: translateY(-50%) scale(1.08); }
.fsp-nav:disabled { opacity: .35; cursor: default; }
.fsp-prev { left: 4px; }
.fsp-next { right: 4px; }

/* ===== Tia sét động ===== */
.fsp-bolt {
	display: inline-block; width: 1.1em; height: 1.1em; vertical-align: -.15em;
	transform-origin: 50% 60%;
	animation: fsp-bolt 1.6s ease-in-out infinite;
	filter: drop-shadow(0 0 3px rgba(255,214,0,.8));
}
@keyframes fsp-bolt {
	0%, 100% { transform: scale(1) rotate(0); opacity: 1; filter: drop-shadow(0 0 3px rgba(255,214,0,.7)); }
	8%  { transform: scale(1.3) rotate(-10deg); opacity: 1; filter: drop-shadow(0 0 12px #fff176); }
	14% { transform: scale(.95) rotate(6deg); opacity: .55; }
	22% { transform: scale(1.25) rotate(-5deg); opacity: 1; filter: drop-shadow(0 0 14px #fff); }
	40% { transform: scale(1) rotate(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .fsp-bolt { animation: none; } }

/* ===== Mobile: tối đa 2 dòng, 2 cột, trượt ngang có mũi tên ===== */
@media (max-width: 600px) {
	.fsp-title { font-size: 22px; }
	.fsp-wrap .fsp-listwrap .fsp-list {
		grid-template-columns: none;
		grid-template-rows: repeat(2, auto);
		grid-auto-flow: column;
		grid-auto-columns: calc((100% - 12px) / 2);
		overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
	}
	.fsp-wrap .fsp-listwrap .fsp-list::-webkit-scrollbar { display: none; }
	.fsp-wrap .fsp-listwrap .fsp-card { scroll-snap-align: start; }
	.fsp-nav { width: 38px; height: 38px; }
	.fsp-nav svg { width: 18px; height: 18px; }
}
