/*
 * Tasg Popup frontend glass-modal styling.
 *
 * One static file serves every popup instance: appearance settings
 * (blur, tint, overlay color, radius, max-width) are set per instance
 * as inline custom properties by PopupWidget::render(), so this file
 * just reads them.
 */

.tasg-popup {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
}

.tasg-popup.is-open {
	display: flex;
}

/* Forces the popup visible inside Elementor's editor iframe, so it
   can be seen/styled without saving and reloading the live page.
   Pure CSS, no reliance on JS or the is-open class - see the note on
   PopupWidget::render() for why the JS trigger logic must NOT run
   here (it would write real visitor-facing state to localStorage). */
.tasg-popup--editor-preview {
	display: flex !important;
}

/* No blur of its own: the panel's own backdrop-filter already samples
   whatever is visually behind it, including this overlay - stacking
   a second blur here on top of a dark tint was muddying the panel's
   glass effect toward grey rather than a clean frosted look. Keeping
   this overlay's own default opacity relatively light for the same
   reason: a heavy dark layer directly behind the panel dominates
   what the panel's blur picks up. */
.tasg-popup__overlay {
	position: absolute;
	inset: 0;
	background: var( --tasg-popup-overlay-color, rgba( 0, 0, 0, 0.3 ) );
}

.tasg-popup__panel {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: var( --tasg-popup-max-width, 560px );
	max-height: calc( 100vh - 48px );
	overflow: auto;
	box-sizing: border-box;
	padding: 32px;
	background: var( --tasg-popup-tint, rgba( 255, 255, 255, 0.55 ) );
	backdrop-filter: blur( var( --tasg-popup-blur, 20px ) ) saturate( 180% );
	-webkit-backdrop-filter: blur( var( --tasg-popup-blur, 20px ) ) saturate( 180% );
	border: 1px solid rgba( 255, 255, 255, 0.4 );
	border-radius: var( --tasg-popup-radius, 16px );
	box-shadow: 0 8px 32px rgba( 0, 0, 0, 0.25 ), inset 0 1px 0 rgba( 255, 255, 255, 0.5 );
}

.tasg-popup--no-border .tasg-popup__panel {
	border: none;
}

/* Browsers without backdrop-filter support (or with it disabled) get
   a more opaque panel instead of a transparent, unreadable one. */
@supports not ( ( backdrop-filter: blur( 1px ) ) or ( -webkit-backdrop-filter: blur( 1px ) ) ) {
	.tasg-popup__panel {
		background: #ffffff;
	}
}

.tasg-popup__content {
	color: inherit;
}

.tasg-popup__title {
	margin: 0 0 12px;
	font-size: 1.4em;
	line-height: 1.3;
	padding-right: 32px;
}

.tasg-popup__body {
	line-height: 1.6;
}

.tasg-popup__footer {
	margin-top: 20px;
}

/* Position variants. --center is the default flex centering above,
   so it needs no override. */
.tasg-popup--top {
	align-items: flex-start;
}

.tasg-popup--bottom-left {
	align-items: flex-end;
	justify-content: flex-start;
}

.tasg-popup--bottom-right {
	align-items: flex-end;
	justify-content: flex-end;
}

/* Entrance animation variants. --anim-none plays no animation. */
@keyframes tasg-popup-fade-in {
	from {
		opacity: 0;
	}
}

@keyframes tasg-popup-fade-scale-in {
	from {
		opacity: 0;
		transform: scale( 0.95 );
	}
}

@keyframes tasg-popup-slide-up-in {
	from {
		opacity: 0;
		transform: translateY( 24px );
	}
}

.tasg-popup--anim-fade.is-open .tasg-popup__panel {
	animation: tasg-popup-fade-in 0.25s ease-out;
}

.tasg-popup--anim-fade-scale.is-open .tasg-popup__panel {
	animation: tasg-popup-fade-scale-in 0.25s ease-out;
}

.tasg-popup--anim-slide-up.is-open .tasg-popup__panel {
	animation: tasg-popup-slide-up-in 0.3s ease-out;
}

@media ( prefers-reduced-motion: reduce ) {
	.tasg-popup__panel {
		animation: none !important;
	}
}

.tasg-popup__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.08 );
	color: inherit;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.tasg-popup__close:hover,
.tasg-popup__close:focus {
	background: rgba( 0, 0, 0, 0.16 );
}

.tasg-popup__dismiss {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin-top: 20px;
	font-size: 13px;
	opacity: 0.85;
	cursor: pointer;
	user-select: none;
}

/* Visually hidden but still focusable/keyboard-operable - the label
   wraps the whole control, and :checked + .track drives the visible
   toggle-switch styling below. */
.tasg-popup__dismiss-input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect( 0 0 0 0 );
	white-space: nowrap;
}

.tasg-popup__dismiss-track {
	position: relative;
	flex-shrink: 0;
	width: 38px;
	height: 22px;
	border-radius: 999px;
	background: rgba( 0, 0, 0, 0.25 );
	transition: background-color 0.2s ease;
}

.tasg-popup__dismiss-track::before {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.35 );
	transition: transform 0.2s ease;
}

.tasg-popup__dismiss-input:checked + .tasg-popup__dismiss-track {
	background: rgba( 0, 166, 147, 0.9 );
}

.tasg-popup__dismiss-input:checked + .tasg-popup__dismiss-track::before {
	transform: translateX( 16px );
}

.tasg-popup__dismiss-input:focus-visible + .tasg-popup__dismiss-track {
	outline: 2px solid rgba( 0, 166, 147, 0.9 );
	outline-offset: 2px;
}

/* Device visibility. Breakpoints match frontend.js's deviceAllowed()
   so JS eligibility and CSS visibility never disagree. Defense in
   depth against mid-session viewport changes (e.g. a tablet
   rotation) - JS only checks width once, at page load. */
@media ( max-width: 767px ) {
	.tasg-popup[data-hide-mobile] {
		display: none !important;
	}
}

@media ( min-width: 768px ) and ( max-width: 1024px ) {
	.tasg-popup[data-hide-tablet] {
		display: none !important;
	}
}

@media ( min-width: 1025px ) {
	.tasg-popup[data-hide-desktop] {
		display: none !important;
	}
}
