/**
 * Frontend Styles for WP We Are On Vacation
 * Cross-browser normalized (Chrome, Firefox, Edge, Safari)
 */

/* ==========================================================================
   Top Banner (100% Full-Width) — box model reset for consistent height/width
   ========================================================================== */
.wpv-banner-container,
.wpv-banner-container *,
.wpv-banner-container *::before,
.wpv-banner-container *::after {
	box-sizing: border-box;
}

.wpv-banner-container {
	background-color: var(--wpv-banner-bg, #0f172a);
	color: var(--wpv-banner-color, #f8fafc);
	/* min-height only — height grows with content the same way in all engines */
	min-height: var(--wpv-banner-height, 50px);
	height: auto;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0;
	/* High but below WP admin bar (99999) and popups */
	z-index: 99990;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	/* Flex centering — explicit for Firefox quirks with min-height */
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	/* Avoid transition:all which animates height/position differently per browser */
	transition: background-color 0.3s ease, box-shadow 0.3s ease, opacity 0.25s ease;
	position: relative;
	overflow: hidden;
	/* Prevent theme styles from shrinking the bar */
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

/*
 * "Sticky" mode uses fixed + spacer (see .wpv-banner-spacer).
 * position:sticky is unreliable across themes (parent overflow/transform)
 * and behaves differently in Firefox vs Chromium.
 */
.wpv-banner-position-sticky {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	width: 100%;
	max-width: 100vw;
}

/* Offset for WordPress admin bar when logged in */
body.admin-bar .wpv-banner-position-sticky {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar .wpv-banner-position-sticky {
		top: 46px;
	}
}

.wpv-banner-position-relative {
	position: relative;
	top: auto;
	left: auto;
	right: auto;
}

/* Spacer reserves layout space when banner is fixed — prevents content jump */
.wpv-banner-spacer {
	display: block;
	width: 100%;
	height: var(--wpv-banner-height, 50px);
	min-height: var(--wpv-banner-height, 50px);
	margin: 0;
	padding: 0;
	border: 0;
	pointer-events: none;
	visibility: hidden;
	overflow: hidden;
}

.wpv-banner-spacer.is-hidden,
.wpv-banner-container.is-dismissed + .wpv-banner-spacer {
	display: none;
}

.wpv-banner-container.is-dismissed {
	display: none !important;
}

.wpv-banner-inner {
	max-width: 1200px;
	width: 100%;
	margin: 0 auto;
	padding: 10px 52px 10px 20px;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	gap: 12px;
	position: relative;
	z-index: 1;
	min-height: inherit;
}

.wpv-banner-content {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	text-align: center;
	gap: 12px;
	-webkit-box-flex: 1;
	-ms-flex: 1 1 auto;
	flex: 1 1 auto;
	min-width: 0;
	max-width: 100%;
}

.wpv-banner-text-wrap {
	text-align: center;
	/*
	 * Line breaks are normalized to <br> in PHP (normalize_line_breaks).
	 * white-space: normal keeps cross-browser wrapping consistent while
	 * honouring explicit <br> and block <p> from the editor.
	 */
	white-space: normal;
	word-wrap: break-word;
	overflow-wrap: break-word;
	-webkit-hyphens: auto;
	hyphens: auto;
	max-width: 100%;
	/* Isolate layout so browser extensions (e.g. Simple Translate) injected
	   into this node do not stretch or break the banner box model */
	isolation: isolate;
	contain: layout style;
	position: relative;
}

/*
 * Neutralize Simple Translate (browser extension) when it injects into the banner.
 * It must not stretch flex layout or inflate banner height.
 */
.wpv-banner-container #simple-translate,
.wpv-banner-container .simple-translate-system-theme,
.wpv-banner-container .simple-translate-button,
.wpv-banner-container .simple-translate-panel,
.wpv-banner-container .simple-translate-result-wrapper,
.wpv-banner-container .simple-translate-move,
.wpv-banner-container .simple-translate-result-contents,
.wpv-banner-container .simple-translate-candidate {
	position: absolute !important;
	width: 0 !important;
	height: 0 !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: 0 !important;
	max-height: 0 !important;
	overflow: hidden !important;
	opacity: 0 !important;
	pointer-events: none !important;
	visibility: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	border: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
}

.wpv-banner-text-wrap p,
.wpv-banner-text-wrap div {
	margin: 0;
	padding: 0;
	display: block;
	text-align: center;
	max-width: 100%;
}

/* Stack successive paragraphs / editor lines with a small gap */
.wpv-banner-text-wrap p + p,
.wpv-banner-text-wrap div + div,
.wpv-banner-text-wrap p + div,
.wpv-banner-text-wrap div + p {
	margin-top: 0.35em;
}

/* Explicit line breaks (Shift+Enter in TinyMCE, or PHP-normalized \n) */
.wpv-banner-text-wrap br {
	display: block;
	content: "";
	/* Creates a clear line break without collapsing to zero height */
	margin-top: 0.15em;
}

.wpv-banner-text-wrap span {
	/* Keep inline spans wrapping naturally; do not force nowrap */
	white-space: normal;
}

/* Countdown: plain inline text, no badge or bubble styling */
.wpv-countdown {
	font-weight: 700;
	display: inline;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
	-moz-font-feature-settings: "tnum";
	font-feature-settings: "tnum";
}

.wpv-banner-close {
	position: absolute;
	right: 12px;
	top: 50%;
	-webkit-transform: translateY(-50%);
	transform: translateY(-50%);
	/* Reset UA button styles (Firefox adds default padding/border) */
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	background: transparent;
	background-color: transparent;
	border: none;
	border-radius: 4px;
	color: var(--wpv-banner-color, #f8fafc);
	font-family: inherit;
	font-size: 22px;
	font-weight: 400;
	line-height: 1;
	cursor: pointer;
	opacity: 0.75;
	padding: 4px 8px;
	margin: 0;
	min-width: 32px;
	min-height: 32px;
	transition: opacity 0.2s ease, background-color 0.2s ease;
	-ms-flex-negative: 0;
	flex-shrink: 0;
	z-index: 2;
}

.wpv-banner-close:hover,
.wpv-banner-close:focus {
	opacity: 1;
	background: rgba(255, 255, 255, 0.15);
	outline: none;
}

.wpv-banner-close:focus-visible {
	outline: 2px solid var(--wpv-countdown-bg, #38bdf8);
	outline-offset: 2px;
}

/* Mobile: slightly tighter padding, same structure */
@media (max-width: 640px) {
	.wpv-banner-inner {
		padding: 10px 44px 10px 14px;
		gap: 8px;
	}

	.wpv-banner-content {
		-webkit-box-orient: vertical;
		-webkit-box-direction: normal;
		-ms-flex-direction: column;
		flex-direction: column;
		gap: 6px;
	}

	.wpv-banner-text-wrap {
		font-size: 13px;
	}

	.wpv-countdown {
		white-space: normal;
	}
}

/* ==========================================================================
   BACKGROUND EFFECTS
   ========================================================================== */

/*
 * Background animations: use CSS variables on the element + animation of
 * background-color. All modern Chrome/Firefox/Edge interpolate custom props
 * the same way when declared on the animated element itself.
 */
@keyframes wpv-bg-flash {
	0%, 49% { background-color: var(--wpv-banner-bg, #0f172a); }
	50%, 100% { background-color: var(--wpv-banner-bg2, #ffffff); }
}
.wpv-bg-flash {
	-webkit-animation: wpv-bg-flash var(--wpv-effect-speed, 3s) step-start infinite;
	animation: wpv-bg-flash var(--wpv-effect-speed, 3s) step-start infinite;
}

@keyframes wpv-bg-fade-color {
	0%   { background-color: var(--wpv-banner-bg, #0f172a); }
	50%  { background-color: var(--wpv-banner-bg2, #1e3a5f); }
	100% { background-color: var(--wpv-banner-bg, #0f172a); }
}
.wpv-bg-fade-color {
	-webkit-animation: wpv-bg-fade-color var(--wpv-effect-speed, 3s) ease-in-out infinite;
	animation: wpv-bg-fade-color var(--wpv-effect-speed, 3s) ease-in-out infinite;
}

@keyframes wpv-bg-gradient-shift {
	0%   { background-position: 0% 50%; }
	50%  { background-position: 100% 50%; }
	100% { background-position: 0% 50%; }
}
.wpv-bg-gradient-animated {
	background-image: linear-gradient(270deg, var(--wpv-banner-bg, #0f172a), var(--wpv-banner-bg2, #1e3a5f), var(--wpv-banner-bg, #0f172a)) !important;
	background-color: transparent !important;
	background-size: 400% 400% !important;
	background-repeat: no-repeat !important;
	-webkit-animation: wpv-bg-gradient-shift var(--wpv-effect-speed, 3s) ease infinite;
	animation: wpv-bg-gradient-shift var(--wpv-effect-speed, 3s) ease infinite;
}

/* --- Image Background --- */
.wpv-bg-image-bg {
	background-image: var(--wpv-banner-bg-image) !important;
	background-size: cover !important;
	background-position: center center !important;
	background-repeat: no-repeat !important;
	background-color: transparent !important;
}
.wpv-bg-image-bg::before {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	/* inset:0 has full support, but explicit edges avoid older edge cases */
	background-color: var(--wpv-overlay-color, rgba(15, 23, 42, 0.6));
	z-index: 0;
	pointer-events: none;
}

/* Color Cycle is handled entirely by JavaScript */

/* ==========================================================================
   TEXT EFFECTS
   ========================================================================== */

/* --- Flash Text --- */
@keyframes wpv-text-flash {
	0%, 49% { opacity: 1; }
	50%, 100% { opacity: 0; }
}
.wpv-text-effect-flash {
	-webkit-animation: wpv-text-flash 1s step-start infinite;
	animation: wpv-text-flash 1s step-start infinite;
}

/* --- Glow Pulsé --- */
@keyframes wpv-text-glow {
	0%, 100% { text-shadow: 0 0 4px rgba(255,255,255,0.1); }
	50%       { text-shadow: 0 0 16px rgba(255,255,255,1), 0 0 32px rgba(255,255,255,0.6); }
}
.wpv-text-effect-glow {
	-webkit-animation: wpv-text-glow var(--wpv-effect-speed, 3s) ease-in-out infinite;
	animation: wpv-text-glow var(--wpv-effect-speed, 3s) ease-in-out infinite;
}

/* --- Fade In/Out --- */
@keyframes wpv-text-fade {
	0%, 100% { opacity: 1; }
	50%       { opacity: 0.05; }
}
.wpv-text-effect-fade {
	-webkit-animation: wpv-text-fade var(--wpv-effect-speed, 3s) ease-in-out infinite;
	animation: wpv-text-fade var(--wpv-effect-speed, 3s) ease-in-out infinite;
}

/* Respect reduced motion preferences across all browsers */
@media (prefers-reduced-motion: reduce) {
	.wpv-bg-flash,
	.wpv-bg-fade-color,
	.wpv-bg-gradient-animated,
	.wpv-text-effect-flash,
	.wpv-text-effect-glow,
	.wpv-text-effect-fade {
		-webkit-animation: none !important;
		animation: none !important;
	}
}

/* ==========================================================================
   Backdrop & Popups (Slide-in Drawer & Centered Modal)
   ========================================================================== */
.wpv-popup-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(15, 23, 42, 0.6);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	z-index: 999998;
	opacity: 0;
	transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.wpv-popup-backdrop.is-visible {
	opacity: 1;
}

.wpv-popup-container {
	position: fixed;
	z-index: 999999;
	background: #ffffff;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	box-sizing: border-box;
}

/* Style A: Slide-in Drawer (Right Side) */
.wpv-style-slide-in {
	top: 0;
	right: 0;
	width: 450px;
	max-width: 100vw;
	height: 100vh;
	transform: translateX(100%);
	transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
	border-left: 1px solid #e2e8f0;
	display: flex;
	flex-direction: column;
}

.wpv-style-slide-in.is-open {
	transform: translateX(0);
}

/* Style B: Centered Modal */
.wpv-style-modal {
	top: 50%;
	left: 50%;
	width: 520px;
	max-width: 90vw;
	border-radius: 16px;
	transform: translate(-50%, -60%) scale(0.95);
	opacity: 0;
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
	border: 1px solid #e2e8f0;
}

.wpv-style-modal.is-open {
	transform: translate(-50%, -50%) scale(1);
	opacity: 1;
}

.wpv-popup-content {
	position: relative;
	padding: 32px 28px;
	display: flex;
	flex-direction: column;
	height: 100%;
	box-sizing: border-box;
}

.wpv-popup-close {
	position: absolute;
	top: 20px;
	right: 20px;
	background: #f1f5f9;
	border: none;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	font-size: 20px;
	line-height: 32px;
	color: #64748b;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.wpv-popup-close:hover {
	background: #e2e8f0;
	color: #0f172a;
}

.wpv-popup-header {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-bottom: 20px;
}

.wpv-popup-icon-wrap {
	width: 48px;
	height: 48px;
	border-radius: 12px;
	background: #e0f2fe;
	color: #0284c7;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.wpv-popup-icon-wrap .dashicons {
	font-size: 26px;
	width: 26px;
	height: 26px;
}

.wpv-popup-title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	color: #0f172a;
	line-height: 1.3;
}

.wpv-popup-body {
	color: #475569;
	font-size: 15px;
	line-height: 1.6;
	margin-bottom: 24px;
	flex: 1;
}

.wpv-auto-redirect-status {
	background: #f0f9ff;
	border: 1px solid #bae6fd;
	color: #0369a1;
	padding: 12px 16px;
	border-radius: 8px;
	font-size: 13.5px;
	margin-bottom: 24px;
	text-align: center;
}

.wpv-popup-footer {
	display: flex;
	gap: 12px;
	margin-top: auto;
}

.wpv-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 20px;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none !important;
	cursor: pointer;
	transition: all 0.2s ease;
	border: none;
	flex: 1;
	text-align: center;
}

.wpv-btn-primary {
	background: #0284c7;
	color: #ffffff !important;
	box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.wpv-btn-primary:hover {
	background: #0369a1;
	box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35);
}

.wpv-btn-secondary {
	background: #f1f5f9;
	color: #475569 !important;
}

.wpv-btn-secondary:hover {
	background: #e2e8f0;
	color: #0f172a !important;
}

@media (max-width: 640px) {
	.wpv-style-slide-in {
		width: 100vw;
	}
	.wpv-popup-footer {
		flex-direction: column;
	}
}
