/* Thông Báo Cửa Hàng — giao diện ngoài trang */

/* ---------- Thanh thông báo trên đầu ---------- */
.tbch-bar {
	position: relative;
	z-index: 99998;
	overflow: hidden;
	box-sizing: border-box;
	width: 100%;
	background: linear-gradient(90deg, var(--tbch-bar-bg), var(--tbch-bar-bg2));
	color: var(--tbch-bar-text);
	font-size: 14px;
	line-height: 1.45;
	letter-spacing: .01em;
	box-shadow: 0 1px 0 rgba(0, 0, 0, .06);
}
/* Ghim cố định: JS thêm class này và tự chèn khoảng trống + đẩy header của theme xuống */
.tbch-bar.is-fixed { position: fixed; top: 0; left: 0; right: 0; margin: 0; }
.tbch-spacer { display: block; width: 100%; margin: 0; padding: 0; }

/* Ánh sáng lướt qua nhẹ nhàng */
.tbch-bar::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .22) 50%, transparent 65%);
	transform: translateX(-100%);
	animation: tbch-shine 7s ease-in-out infinite;
}
@keyframes tbch-shine {
	0%, 60% { transform: translateX(-100%); }
	100% { transform: translateX(100%); }
}

.tbch-bar-inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 10px 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px 14px;
	flex-wrap: wrap;
	text-align: center;
}
.tbch-bar.has-close .tbch-bar-inner { padding-left: 52px; padding-right: 52px; }
.tbch-bar-text { font-weight: 500; }
.tbch-bar-text a { color: inherit; text-decoration: underline; }
.tbch-bar a.tbch-bar-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 13px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .2);
	border: 1px solid rgba(255, 255, 255, .35);
	color: inherit;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: background .2s, transform .2s;
}
.tbch-bar a.tbch-bar-link:hover { background: rgba(255, 255, 255, .32); transform: translateX(2px); }

.tbch-bar button.tbch-bar-close {
	position: absolute;
	top: 50%;
	right: 12px;
	z-index: 1;
	width: 30px;
	height: 30px;
	min-height: 0;
	margin: -15px 0 0;
	padding: 0;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	color: inherit;
	opacity: .85;
	cursor: pointer;
	transition: background .2s, opacity .2s;
}
.tbch-bar button.tbch-bar-close:hover { background: rgba(255, 255, 255, .2); opacity: 1; }
.tbch-bar.tbch-hiding { animation: tbch-bar-out .35s ease forwards; }
@keyframes tbch-bar-out { to { margin-top: -60px; opacity: 0; } }

@media (max-width: 600px) {
	.tbch-bar { font-size: 13px; }
	.tbch-bar-inner { padding: 9px 14px; gap: 6px 10px; }
	.tbch-bar.has-close .tbch-bar-inner { padding-right: 44px; }
	.tbch-bar button.tbch-bar-close { right: 6px; }
	.tbch-bar a.tbch-bar-link { padding: 3px 10px; font-size: 12px; }
}

/* Cờ Việt Nam */
.tbch-flag {
	display: inline-block;
	flex: none;
	vertical-align: middle;
	border-radius: 2px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
	transform-origin: left center;
	animation: tbch-wave 3.2s ease-in-out infinite;
}
.tbch-flag-shade { animation: tbch-flag-light 3.2s ease-in-out infinite; }
.tbch-flag-bar { width: 27px; height: 18px; }
.tbch-flag-wrap { margin: 0 0 14px; line-height: 0; }
.tbch-flag-popup { width: 60px; height: 40px; border-radius: 3px; box-shadow: 0 6px 16px -6px rgba(218, 37, 29, .6), 0 1px 3px rgba(0, 0, 0, .2); }
@keyframes tbch-wave {
	0%, 100% { transform: perspective(60px) rotateY(0deg) skewY(0deg); }
	50% { transform: perspective(60px) rotateY(-8deg) skewY(-2deg); }
}
@keyframes tbch-flag-light {
	0%, 100% { opacity: .6; }
	50% { opacity: 1; }
}
@media (max-width: 600px) {
	.tbch-flag-bar { width: 24px; height: 16px; }
}

/* Chữ chạy ngang trên điện thoại khi dòng thông báo dài */
.tbch-bar.tbch-mq-on .tbch-bar-inner { flex-wrap: nowrap; justify-content: flex-start; }
.tbch-bar.tbch-mq-on .tbch-bar-text {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
	text-align: left;
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 10px), transparent);
	mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 10px), transparent);
}
.tbch-bar.tbch-mq-on .tbch-bar-link { flex: none; }
.tbch-mq {
	display: inline-flex;
	white-space: nowrap;
	will-change: transform;
	animation: tbch-mq 16s linear 1.5s infinite;
}
.tbch-mq > span { padding-right: 48px; }
@media (hover: hover) and (pointer: fine) { .tbch-bar:hover .tbch-mq { animation-play-state: paused; } }
@keyframes tbch-mq { to { transform: translateX(-50%); } }

/* ---------- Popup ---------- */
html.tbch-lock, html.tbch-lock body { overflow: hidden; }

.tbch-overlay {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(15, 17, 26, .55);
	-webkit-backdrop-filter: blur(5px);
	backdrop-filter: blur(5px);
	opacity: 0;
	transition: opacity .3s ease;
}
.tbch-overlay[hidden] { display: none; }
.tbch-overlay.tbch-open { opacity: 1; }

.tbch-modal {
	position: relative;
	width: 100%;
	max-width: 420px;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	background: #fff;
	color: #1f2330;
	border-radius: 22px;
	box-shadow: 0 40px 90px -25px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .04);
	font-size: 15px;
	text-align: center;
	transform: translateY(28px) scale(.95);
	transition: transform .45s cubic-bezier(.2, .9, .3, 1.15);
}
.tbch-open .tbch-modal { transform: none; }

/* Dải màu trên cùng khi không có ảnh */
.tbch-modal:not(.has-media)::before {
	content: "";
	display: block;
	height: 6px;
	background: linear-gradient(90deg, var(--tbch-accent), var(--tbch-bar-bg2));
}

.tbch-media img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 230px;
	object-fit: cover;
	margin: 0;
}

.tbch-body { padding: 30px 30px 24px; }
.tbch-modal.has-media .tbch-body { padding-top: 24px; }
.tbch-modal.no-actions .tbch-body { padding-bottom: 30px; }
.tbch-modal.no-actions:not(.has-media) .tbch-body { padding-top: 34px; }

.tbch-badge {
	display: inline-block;
	margin-bottom: 14px;
	padding: 5px 13px;
	border-radius: 999px;
	background: rgba(225, 29, 72, .1);
	background: color-mix(in srgb, var(--tbch-accent) 12%, #fff);
	color: var(--tbch-accent);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: .1em;
	text-transform: uppercase;
	line-height: 1.4;
}

.tbch-modal .tbch-title {
	margin: 0 0 10px;
	padding: 0;
	color: #141722;
	font-size: 23px;
	font-weight: 800;
	line-height: 1.3;
	letter-spacing: -.01em;
	text-transform: none;
}

.tbch-content { color: #5a6072; line-height: 1.65; }
.tbch-content p { margin: 0 0 .6em; }
.tbch-content p:last-child { margin-bottom: 0; }
.tbch-content strong { color: #1f2330; }

.tbch-actions {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 24px;
}

.tbch-modal a.tbch-btn,
.tbch-modal button.tbch-later:only-child {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 14px 20px;
	border: 0;
	border-radius: 14px;
	background: var(--tbch-accent);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	text-decoration: none;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	box-shadow: 0 10px 24px -10px var(--tbch-accent);
	transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}
.tbch-modal a.tbch-btn:hover,
.tbch-modal button.tbch-later:only-child:hover {
	transform: translateY(-1px);
	filter: brightness(1.07);
	color: #fff;
	box-shadow: 0 14px 28px -10px var(--tbch-accent);
}

.tbch-modal button.tbch-later {
	padding: 10px;
	min-height: 0;
	border: 0;
	background: none;
	box-shadow: none;
	color: #8a8f9c;
	font-size: 14px;
	font-weight: 500;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
}
.tbch-modal button.tbch-later:hover { color: #1f2330; background: none; }

.tbch-modal button.tbch-close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	width: 36px;
	height: 36px;
	min-height: 0;
	margin: 0;
	padding: 0;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .95);
	box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
	color: #333;
	cursor: pointer;
	transition: transform .25s ease, background .2s;
}
.tbch-modal button.tbch-close:hover { transform: rotate(90deg); background: #fff; color: #000; }

.tbch-modal button,
.tbch-modal a { font-family: inherit; }
.tbch-modal:focus { outline: none; }

.tbch-modal :focus-visible {
	outline: 3px solid var(--tbch-accent);
	outline-offset: 2px;
}

/* Điện thoại: popup trượt lên từ dưới */
@media (max-width: 520px) {
	.tbch-overlay { align-items: flex-end; padding: 0; }
	.tbch-modal {
		max-width: none;
		max-height: 88vh;
		border-radius: 24px 24px 0 0;
		transform: translateY(100%);
		transition-timing-function: cubic-bezier(.2, .9, .3, 1);
	}
	.tbch-body { padding: 28px 22px calc(20px + env(safe-area-inset-bottom)); }
	.tbch-modal .tbch-title { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
	.tbch-bar::after { animation: none; display: none; }
	.tbch-mq { animation: none; }
	.tbch-flag, .tbch-flag-shade { animation: none; }
	.tbch-overlay, .tbch-modal { transition: none; }
}
