/* ============================================================
   WWWTech2 — Frontend Announcement Bar
   ============================================================ */

#wwt-announcement-bar {
	display: flex;
	align-items: center;
	width: 100%;
	min-height: var(--anbar-h, 44px);
	background: var(--anbar-bg, #E63946);
	color: var(--anbar-text, #fff);
	font-size: var(--anbar-font, 14px);
	font-family: inherit;
	line-height: 1.4;
	position: relative;
	z-index: 99999;
	box-sizing: border-box;
}

#wwt-announcement-bar.wwt-anbar--sticky {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
}

body.admin-bar #wwt-announcement-bar.wwt-anbar--sticky {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar #wwt-announcement-bar.wwt-anbar--sticky {
		top: 46px;
	}
}

/* Push page content down when the sticky bar is visible */
body.wwt-anbar-sticky-active {
	padding-top: var(--anbar-h, 44px);
}

body.admin-bar.wwt-anbar-sticky-active {
	padding-top: calc(var(--anbar-h, 44px) + 32px);
}

@media screen and (max-width: 782px) {
	body.admin-bar.wwt-anbar-sticky-active {
		padding-top: calc(var(--anbar-h, 44px) + 46px);
	}
}

/* ---- Device visibility ---- */
#wwt-announcement-bar.wwt-anbar--hide-mobile {
	display: none;
}

@media (min-width: 768px) {
	#wwt-announcement-bar.wwt-anbar--hide-mobile {
		display: flex;
	}
	#wwt-announcement-bar.wwt-anbar--hide-desktop {
		display: none !important;
	}
}

/* ---- Inner layout ---- */
.wwt-anbar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 6px 20px;
	box-sizing: border-box;
	gap: 16px;
}

#wwt-announcement-bar.wwt-anbar--closeable .wwt-anbar__inner {
	padding-right: 48px;
}

.wwt-anbar__left,
.wwt-anbar__right {
	flex: 0 1 auto;
	display: flex;
	align-items: center;
	min-width: 0;
}

.wwt-anbar__center {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	min-width: 0;
}

/* ---- Text ---- */
.wwt-anbar__text {
	color: var(--anbar-text);
	font-size: var(--anbar-font);
	font-weight: 500;
}

.wwt-anbar__link,
.wwt-anbar__link:visited {
	color: var(--anbar-link);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.wwt-anbar__link:hover {
	opacity: 0.85;
	text-decoration: underline;
}

/* ---- CTA button ---- */
.wwt-anbar__cta,
.wwt-anbar__cta:visited {
	display: inline-flex;
	align-items: center;
	padding: 5px 16px;
	background: rgba(255, 255, 255, 0.2);
	border: 1px solid rgba(255, 255, 255, 0.45);
	border-radius: 100px;
	color: var(--anbar-link);
	font-size: calc(var(--anbar-font) * 0.9);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.2s, border-color 0.2s;
}

.wwt-anbar__cta:hover {
	background: rgba(255, 255, 255, 0.32);
	border-color: rgba(255, 255, 255, 0.65);
	text-decoration: none;
	color: var(--anbar-link);
}

/* ---- Rotating messages ---- */
.wwt-anbar__rotate {
	position: relative;
	width: 100%;
	min-height: 1.5em;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.wwt-anbar__rotate-item {
	position: absolute;
	width: 100%;
	text-align: center;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.45s ease, transform 0.45s ease;
	color: var(--anbar-text);
	font-weight: 500;
	pointer-events: none;
}

.wwt-anbar__rotate-item.is-active {
	opacity: 1;
	transform: translateY(0);
	position: relative;
	pointer-events: auto;
}

/* ---- Countdown ---- */
.wwt-anbar__countdown {
	display: flex;
	align-items: center;
	gap: 10px;
}

.wwt-anbar__countdown-label {
	color: var(--anbar-text);
	font-weight: 500;
}

.wwt-anbar__countdown-units {
	display: flex;
	align-items: center;
	gap: 3px;
}

.wwt-anbar__countdown-unit {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.2);
	border-radius: 5px;
	padding: 2px 8px;
	min-width: 38px;
}

.wwt-anbar__countdown-unit b {
	display: block;
	font-size: calc(var(--anbar-font) * 1.2);
	font-weight: 700;
	line-height: 1.2;
	color: var(--anbar-text);
}

.wwt-anbar__countdown-unit small {
	display: block;
	font-size: calc(var(--anbar-font) * 0.68);
	color: rgba(255, 255, 255, 0.75);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.wwt-anbar__countdown-sep {
	color: var(--anbar-text);
	font-weight: 700;
	font-size: calc(var(--anbar-font) * 1.1);
	opacity: 0.65;
	margin-bottom: 6px;
}

.wwt-anbar__countdown-expired {
	color: var(--anbar-text);
	font-weight: 500;
}

/* ---- Contact ---- */
.wwt-anbar__contact {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--anbar-text);
}

.wwt-anbar__contact svg {
	flex-shrink: 0;
	opacity: 0.9;
}

/* ---- Social ---- */
.wwt-anbar__social {
	display: flex;
	align-items: center;
	gap: 10px;
}

.wwt-anbar__social-link,
.wwt-anbar__social-link:visited {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--anbar-text);
	opacity: 0.85;
	transition: opacity 0.2s;
	text-decoration: none;
}

.wwt-anbar__social-link:hover {
	opacity: 1;
	text-decoration: none;
}

/* ---- Image ---- */
.wwt-anbar__image {
	display: block;
	height: auto;
	max-height: calc(var(--anbar-h, 44px) - 10px);
	object-fit: contain;
}

.wwt-anbar__image-link {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
}

/* ---- Free Shipping Bar ---- */
.wwt-anbar__shipping-bar {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	width: 100%;
	max-width: 420px;
}

/* In left/right expanded slot, align bar to that side */
.wwt-anbar__left .wwt-anbar__shipping-bar {
	align-items: flex-start;
}
.wwt-anbar__right .wwt-anbar__shipping-bar {
	align-items: flex-end;
}

.wwt-anbar__shipping-text {
	font-size: var(--anbar-font);
	font-weight: 500;
	color: var(--anbar-text);
}

.wwt-anbar__shipping-progress {
	width: 100%;
	height: 4px;
	background: rgba(255, 255, 255, 0.25);
	border-radius: 99px;
	overflow: hidden;
}

.wwt-anbar__shipping-fill {
	height: 100%;
	background: var(--anbar-accent, rgba(255, 255, 255, 0.85));
	border-radius: 99px;
	transition: width 0.5s ease;
	width: 0%;
}

/* ---- Close button ---- */
.wwt-anbar__close {
	position: absolute;
	top: 50%;
	right: 10px;
	transform: translateY(-50%);
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.15);
	border: none;
	border-radius: 50%;
	color: var(--anbar-text);
	cursor: pointer;
	padding: 0;
	opacity: 0.7;
	transition: opacity 0.2s, background 0.2s;
	flex-shrink: 0;
	line-height: 1;
}

.wwt-anbar__close:hover {
	opacity: 1;
	background: rgba(0, 0, 0, 0.28);
}

/* ---- Hidden ---- */
#wwt-announcement-bar.is-hidden {
	display: none !important;
}

/* ---- Rotating messages — slot alignment ---- */
.wwt-anbar__rotate--left {
	justify-content: flex-start;
}
.wwt-anbar__rotate--left .wwt-anbar__rotate-item {
	text-align: left;
}
.wwt-anbar__rotate--right {
	justify-content: flex-end;
}
.wwt-anbar__rotate--right .wwt-anbar__rotate-item {
	text-align: right;
}

/* ---- Rotating messages — animation variants ---- */

/* fade: opacity only, no transform */
.wwt-anbar__rotate--anim-fade .wwt-anbar__rotate-item {
	transform: none;
	transition: opacity 0.45s ease;
}
.wwt-anbar__rotate--anim-fade .wwt-anbar__rotate-item.is-active {
	transform: none;
}

/* slide-up: default — base styles already do translateY(8px) → 0 */

/* slide-down */
.wwt-anbar__rotate--anim-slide-down .wwt-anbar__rotate-item {
	transform: translateY(-10px);
	transition: opacity 0.45s ease, transform 0.45s ease;
}
.wwt-anbar__rotate--anim-slide-down .wwt-anbar__rotate-item.is-active {
	transform: translateY(0);
}

/* zoom */
.wwt-anbar__rotate--anim-zoom .wwt-anbar__rotate-item {
	transform: scale(0.82);
	transition: opacity 0.4s ease, transform 0.4s ease;
}
.wwt-anbar__rotate--anim-zoom .wwt-anbar__rotate-item.is-active {
	transform: scale(1);
}

/* flip on X axis */
.wwt-anbar__rotate--anim-flip .wwt-anbar__rotate-item {
	transform: rotateX(90deg);
	transition: opacity 0.35s ease, transform 0.35s ease;
	transform-origin: center top;
}
.wwt-anbar__rotate--anim-flip .wwt-anbar__rotate-item.is-active {
	transform: rotateX(0deg);
}

/* ---- Expanded slot (for shipping_bar in left/right) ---- */
.wwt-anbar__slot--expand {
	flex: 1 1 auto;
	max-width: 40%;
}

/* ---- Woodmart cart widget z-index fix (modern browsers) ----
   .wd-side-hidden has z-index:500, so drop our bar below it. */
body:has(.wd-side-hidden.wd-opened) #wwt-announcement-bar,
body:has(.cart-widget-side.wd-opened) #wwt-announcement-bar {
	z-index: 100 !important;
}

/* ---- Mobile ---- */
@media (max-width: 767px) {
	.wwt-anbar__left,
	.wwt-anbar__right {
		display: none;
	}

	.wwt-anbar__inner {
		padding: 6px 12px;
	}

	#wwt-announcement-bar.wwt-anbar--closeable .wwt-anbar__inner {
		padding-right: 42px;
	}

	.wwt-anbar__countdown {
		gap: 6px;
		flex-wrap: wrap;
		justify-content: center;
	}

	.wwt-anbar__countdown-unit {
		min-width: 30px;
		padding: 2px 5px;
	}

	.wwt-anbar__cta {
		padding: 4px 12px;
	}
}
