/* Pureit Việt Nam Flash Sale – có thể đổi màu bằng cách ghi đè các biến dưới đây trong CSS của theme */
:root {
	--sofs-hot: #e5101d;
	--sofs-hot-2: #ff6a00;
	--sofs-brand: #1e73be;
	--sofs-text: #1f2937;
	--sofs-muted: #6b7280;
	--sofs-radius: 10px;
}

.sofs-block:empty, .sofs-box-wrap:empty { display: none; }
.sofs-bolt { display: inline-block; margin-right: 4px; animation: sofs-flash 1.2s ease-in-out infinite; }
@keyframes sofs-flash { 50% { opacity: .35; } }

/* Đồng hồ đếm ngược */
.sofs-cd { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sofs-cd > b, .sofs-cd-d b { display: inline-block; min-width: 26px; padding: 3px 4px; border-radius: 5px; background: #111827; color: #fff; font-weight: 700; text-align: center; line-height: 1.2; }
.sofs-cd > i { font-style: normal; font-weight: 700; }
.sofs-cd-d { margin-right: 4px; font-weight: 600; }
.sofs-cd-d[hidden] { display: none; }

/* ---------------- Khối shortcode ---------------- */
.sofs-wrap { margin: 0 0 24px; border-radius: var(--sofs-radius); background: linear-gradient(135deg, var(--sofs-hot), var(--sofs-hot-2)); padding: 12px; color: #fff; }
.sofs-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 2px 4px 12px; }
.sofs-title { font-size: 22px; font-weight: 800; font-style: italic; letter-spacing: .5px; line-height: 1.1; }
.sofs-label { font-size: 13px; font-style: normal; font-weight: 600; background: rgba(255,255,255,.2); padding: 3px 8px; border-radius: 20px; vertical-align: middle; }
.sofs-timer { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.sofs-more { margin-left: auto; color: #fff !important; font-weight: 600; font-size: 14px; }
.sofs-more:hover { text-decoration: underline; }

.sofs-slots { display: flex; gap: 6px; overflow-x: auto; padding: 0 2px 10px; scrollbar-width: none; }
.sofs-slots::-webkit-scrollbar { display: none; }
.sofs-slot { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; padding: 5px 14px; border-radius: 8px; background: rgba(0,0,0,.15); line-height: 1.25; }
.sofs-slot b { font-size: 16px; }
.sofs-slot small { font-size: 11px; opacity: .9; }
.sofs-slot.is-running { background: #fff; color: var(--sofs-hot); }
.sofs-slot.is-ended { opacity: .55; }

.sofs-grid { display: grid; grid-template-columns: repeat(var(--sofs-cols, 5), minmax(0, 1fr)); gap: 10px; }
.layout-row .sofs-grid { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: calc((100% - (var(--sofs-cols, 5) - 1) * 10px) / var(--sofs-cols, 5)); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; padding-bottom: 4px; }
.layout-row .sofs-card { scroll-snap-align: start; }

.sofs-card { display: flex; flex-direction: column; gap: 6px; background: #fff; color: var(--sofs-text) !important; border-radius: 8px; padding: 8px; text-decoration: none !important; transition: box-shadow .2s, transform .2s; position: relative; min-width: 0; }
.sofs-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.15); transform: translateY(-2px); }
.sofs-img { position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 6px; background: #f5f5f5; }
.sofs-img img { width: 100%; height: 100%; object-fit: contain; margin: 0 !important; }
.sofs-card .sofs-off { position: absolute; top: 6px; left: 6px; background: var(--sofs-hot); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.sofs-stamp { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.6); color: var(--sofs-hot); font-weight: 800; font-size: 18px; text-transform: uppercase; }
.sofs-name { font-size: 13px; line-height: 1.35; height: 2.7em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sofs-prices { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.sofs-prices ins { text-decoration: none; color: var(--sofs-hot); font-weight: 700; font-size: 16px; }
.sofs-prices del { color: var(--sofs-muted); font-size: 12px; }
.sofs-open { margin-top: auto; text-align: center; font-size: 12px; font-weight: 600; color: var(--sofs-brand); background: #eef4ff; border-radius: 20px; padding: 4px 6px; }

/* Thanh đã bán */
.sofs-bar { position: relative; margin-top: auto; height: 18px; border-radius: 20px; background: #ffd5c2; overflow: hidden; }
.sofs-bar > span { position: absolute; inset: 0 auto 0 0; width: var(--sofs-fill, 0%); background: linear-gradient(90deg, var(--sofs-hot-2), var(--sofs-hot)); border-radius: 20px; }
.sofs-bar > em { position: relative; display: block; text-align: center; font-style: normal; font-size: 11px; font-weight: 700; line-height: 18px; color: #9a1b0c; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.sofs-bar > em.sofs-bar-on { position: absolute; inset: 0; color: #fff; clip-path: inset(0 calc(100% - var(--sofs-fill, 0%)) 0 0); }
.sofs-bar.is-out { background: #e5e7eb; }
.sofs-bar.is-out > em { color: var(--sofs-muted); }

.is-upcoming.sofs-wrap { background: linear-gradient(135deg, var(--sofs-brand), #3b82f6); }

@media (max-width: 849px) {
	.sofs-wrap { --sofs-cols: 3 !important; padding: 10px 8px; }
	.sofs-title { font-size: 19px; }
	.sofs-more { margin-left: 0; }
}
@media (max-width: 549px) {
	.sofs-wrap { --sofs-cols: 2 !important; }
	.layout-row .sofs-grid { grid-auto-columns: 42%; }
	.sofs-cd > b { min-width: 22px; padding: 2px 3px; font-size: 13px; }
}

/* ---------------- Hộp trên trang sản phẩm ---------------- */
.sofs-box { margin: 10px 0 16px; border-radius: var(--sofs-radius); overflow: hidden; border: 1px solid #ffd0c2; background: #fff7f3; }
.sofs-box-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; padding: 8px 12px; background: linear-gradient(135deg, var(--sofs-hot), var(--sofs-hot-2)); color: #fff; }
.sofs-box-title { font-weight: 800; font-style: italic; font-size: 17px; }
.sofs-box-timer { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.sofs-box-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.sofs-box-price { font-size: 22px; font-weight: 800; color: var(--sofs-hot); line-height: 1.2; }
.sofs-box-price small { font-size: 13px; font-weight: 600; color: var(--sofs-muted); }
.sofs-box-price del { font-size: 14px; font-weight: 400; color: var(--sofs-muted); }
.sofs-box .sofs-off { display: inline-block; background: var(--sofs-hot); color: #fff; font-size: 12px; padding: 2px 6px; border-radius: 4px; vertical-align: middle; }
.sofs-box-note { font-size: 13px; color: var(--sofs-muted); }
.sofs-box .sofs-bar { max-width: 320px; height: 20px; }
.sofs-box .sofs-bar > em { line-height: 20px; }
.sofs-box .sofs-bar > em.sofs-bar-on { line-height: 20px; }
.sofs-box.sofs-upcoming { border-color: #c7dafc; background: #f3f7ff; }
.sofs-box.sofs-upcoming .sofs-box-head { background: linear-gradient(135deg, var(--sofs-brand), #3b82f6); }
.sofs-box.sofs-soldout .sofs-box-head { background: #6b7280; }

/* Giá ẩn trước giờ mở bán */
.sofs-mask { letter-spacing: 1px; filter: blur(.4px); }
.sofs-box.is-hidden-price .sofs-box-price { color: var(--sofs-hot); }
