/**
 * Frontend Announcement Bar Stylesheet
 *
 * @package    EZ_Announcement_Bar
 * @subpackage EZ_Announcement_Bar/assets/css
 */

/* Main Container Base */
.ezab-announcement-bar {
	position: relative;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	overflow: hidden;
	
	/* Apply configuration variables */
	background: var(--ezab-bg-color, #111111);
	color: var(--ezab-text-color, #ffffff);
	font-family: var(--ezab-font-family, system-ui, -apple-system, sans-serif);
	font-weight: var(--ezab-font-weight, 600);
	height: var(--ezab-bar-height-desktop, 42px);
	font-size: var(--ezab-font-size-desktop, 16px);
	z-index: var(--ezab-z-index, 9999);
	
	/* Smooth transitions for responsive heights */
	transition: height 0.2s ease, font-size 0.2s ease;
}

/* Sticky Top Position */
.ezab-announcement-bar.ezab-sticky {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
}

/* Compensate page layout padding for sticky bar */
body.ezab-has-sticky-bar {
	padding-top: var(--ezab-bar-height-desktop, 42px) !important;
}

/* Admin Bar Alignment Support */
.admin-bar .ezab-announcement-bar.ezab-sticky {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .ezab-announcement-bar.ezab-sticky {
		top: 46px;
	}
}

/* Scrolling Track Framework */
.ezab-scroll-wrapper {
	overflow: hidden;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	position: relative;
	padding: 0 40px; /* Space for close button */
	box-sizing: border-box;
}

.ezab-scroll-track {
	display: flex;
	align-items: center;
	white-space: nowrap;
	width: max-content;
	box-sizing: border-box;
}

.ezab-scroll-item {
	display: inline-block;
	white-space: nowrap;
	box-sizing: border-box;
	margin-right: var(--ezab-text-gap, 80px);
}

/* Close/Dismiss Button */
.ezab-close {
	position: absolute;
	right: 15px;
	top: 50%;
	transform: translateY(-50%);
	background: transparent;
	border: 0;
	cursor: pointer;
	font-size: 24px;
	font-weight: 300;
	line-height: 1;
	color: inherit;
	opacity: 0.6;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	transition: opacity 0.15s, background-color 0.15s;
	z-index: 10;
}
.ezab-close:hover {
	opacity: 1;
	background-color: rgba(255, 255, 255, 0.15);
}
.ezab-close:focus {
	outline: 2px solid currentColor;
	outline-offset: -2px;
}

/* Animations definition */

/* 1. Continuous Infinite Marquee */
.ezab-type-continuous .ezab-scroll-track {
	will-change: transform;
}
.ezab-dir-rtl.ezab-type-continuous .ezab-scroll-track {
	animation: ezab-scroll-rtl var(--ezab-animation-speed, 12s) linear infinite;
}
.ezab-dir-ltr.ezab-type-continuous .ezab-scroll-track {
	animation: ezab-scroll-ltr var(--ezab-animation-speed, 12s) linear infinite;
}

@keyframes ezab-scroll-rtl {
	0% { transform: translateX(0); }
	100% { transform: translateX(-50%); }
}
@keyframes ezab-scroll-ltr {
	0% { transform: translateX(-50%); }
	100% { transform: translateX(0); }
}

/* 2. Fade Entrance Animation */
.ezab-type-fade {
	animation: ezab-fade-in 0.8s ease-out forwards;
}
.ezab-type-fade .ezab-scroll-wrapper {
	justify-content: center;
}
@keyframes ezab-fade-in {
	0% { opacity: 0; }
	100% { opacity: 1; }
}

/* 3. Slide Down Entrance Animation */
.ezab-type-slide {
	animation: ezab-slide-down 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.ezab-type-slide .ezab-scroll-wrapper {
	justify-content: center;
}
@keyframes ezab-slide-down {
	0% { transform: translateY(-100%); }
	100% { transform: translateY(0); }
}

/* Mobile responsive settings overrides */
@media (max-width: 600px) {
	.ezab-announcement-bar {
		height: var(--ezab-bar-height-mobile, 36px);
		font-size: var(--ezab-font-size-mobile, 13px);
	}
	body.ezab-has-sticky-bar {
		padding-top: var(--ezab-bar-height-mobile, 36px) !important;
	}
	.ezab-scroll-wrapper {
		padding: 0 32px;
	}
	.ezab-close {
		right: 8px;
		font-size: 20px;
		width: 24px;
		height: 24px;
	}
}

/* Accessibility: Support prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
	.ezab-scroll-track {
		animation: none !important;
		transform: none !important;
		white-space: normal !important;
		width: auto !important;
		justify-content: center;
		text-align: center;
	}
	.ezab-scroll-wrapper {
		justify-content: center;
	}
}
