/**
 * Pollux Labs Feedback Survey – popup / modal styles.
 *
 * Wraps the existing survey card in an overlay dialog. Depends on frontend.css
 * for the survey itself. On small screens the dialog becomes a bottom sheet.
 */

.plfs-popup[hidden] {
	display: none;
}

.plfs-popup {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.plfs-popup__overlay {
	position: fixed;
	inset: 0;
	background: rgba(10, 14, 28, 0.6);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	animation: plfs-overlay-in 0.25s ease-out;
}

.plfs-popup__dialog {
	position: relative;
	width: 100%;
	max-width: 640px;
	margin: auto;
	animation: plfs-popup-in 0.3s cubic-bezier(0.21, 1.02, 0.73, 1);
}

/* The survey card already styles itself; neutralise its outer margin and give
   it an accent top edge so the popup feels intentional, not generic. */
.plfs-popup__dialog .plfs-survey {
	margin: 0;
	max-width: none;
}

.plfs-popup__dialog .plfs-card {
	border-top: 4px solid var(--plfs-accent, #2563eb);
	box-shadow: 0 24px 60px rgba(10, 14, 28, 0.28), 0 4px 14px rgba(10, 14, 28, 0.14);
	max-height: calc(100vh - 4.5rem);
	max-height: calc(100dvh - 4.5rem);
	overflow-y: auto;
	overscroll-behavior: contain;
}

.plfs-popup__close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 1;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	line-height: 1;
	color: var(--plfs-muted, #5b6472);
	background: var(--plfs-option-bg, #f7f9fc);
	border: 1px solid var(--plfs-border, #e2e6ee);
	border-radius: 50%;
	cursor: pointer;
	transition: transform 0.1s ease, background-color 0.15s ease, color 0.15s ease;
}

.plfs-popup__close:hover {
	color: var(--plfs-fg, #1f2330);
	background: var(--plfs-option-hover, #eef2f9);
}

.plfs-popup__close:active {
	transform: scale(0.94);
}

.plfs-popup__close:focus-visible {
	outline: 2px solid var(--plfs-accent, #2563eb);
	outline-offset: 2px;
}

/* Leave room for the close button next to the intro title. */
.plfs-popup__dialog .plfs-intro__title {
	padding-right: 2.5rem;
}

/* Lock background scroll while the popup is open. */
body.plfs-popup-open {
	overflow: hidden;
}

@media (prefers-color-scheme: dark) {
	.plfs-popup__overlay {
		background: rgba(0, 0, 0, 0.65);
	}

	.plfs-popup__close {
		color: #a6adbb;
		background: #232838;
		border-color: #2c3242;
	}

	.plfs-popup__close:hover {
		color: #e7eaf1;
		background: #2a3144;
	}
}

@keyframes plfs-overlay-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes plfs-popup-in {
	from {
		opacity: 0;
		transform: translateY(18px) scale(0.97);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.plfs-popup__overlay,
	.plfs-popup__dialog {
		animation: none;
	}
}

/* Bottom sheet on small screens. */
@media (max-width: 560px) {
	.plfs-popup {
		padding: 0;
		align-items: flex-end;
	}

	.plfs-popup__dialog {
		max-width: none;
		margin: auto 0 0;
		animation-name: plfs-popup-up;
	}

	.plfs-popup__dialog .plfs-card {
		border-radius: var(--plfs-radius, 16px) var(--plfs-radius, 16px) 0 0;
		border-left: none;
		border-right: none;
		border-bottom: none;
		max-height: calc(100vh - 2.5rem);
		max-height: calc(100dvh - 2.5rem);
	}

	.plfs-popup__close {
		top: 10px;
		right: 10px;
	}
}

@keyframes plfs-popup-up {
	from {
		opacity: 0;
		transform: translateY(40px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}
