/**
 * Product Quiz Frontend CSS.
 *
 * Styles for quiz display on WooCommerce product pages.
 *
 * @package Retrotec_Site_Manager
 */

/* Override WP block group padding for quiz block */
:root :where(.wp-block-retrotec-product-quiz),
:root :where(.wp-block-group):has(.retrotec-product-quiz-container) {
	padding: 0 !important;
	margin: 0 !important;
}

/* Container */
.retrotec-product-quiz-container {
	margin: 0;
	padding: 0;
	clear: both;
}

.retrotec-product-quiz-container--shortcode {
	margin: 0;
	padding: 0;
}

/* Quiz Item */
.retrotec-product-quiz {
	margin: 0;
	padding: 0;
}

/* Inline Quiz */
.retrotec-product-quiz--inline {
	background: transparent;
	border: none;
	border-radius: 0;
	overflow: visible;
	width: 100%;
}

.retrotec-product-quiz__embed-wrapper {
	width: 100%;
}

.retrotec-product-quiz__iframe-wrapper {
	position: relative;
	width: 100%;
}

.retrotec-product-quiz__iframe-wrapper iframe {
	display: block;
	width: 100%;
	border: 0;
}

/* Modal Trigger Button */
.retrotec-product-quiz--modal-trigger {
	display: inline-block;
	margin-right: 10px;
}

.retrotec-product-quiz__button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 20px;
	font-size: 14px;
	font-weight: 500;
	color: #fff;
	background: #2271b1;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color 0.2s;
}

.retrotec-product-quiz__button:hover {
	background: #135e96;
	color: #fff;
}

.retrotec-product-quiz__button:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.retrotec-product-quiz__button-icon {
	font-size: 18px;
	line-height: 1;
}

/* Modal Overlay */
.retrotec-product-quiz-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 100000;
	display: none;
}

.retrotec-product-quiz-modal.is-open {
	display: flex;
	align-items: center;
	justify-content: center;
}

.retrotec-product-quiz-modal[hidden] {
	display: none;
}

.retrotec-product-quiz-modal__overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.7);
	backdrop-filter: blur(2px);
}

/* Modal Content */
.retrotec-product-quiz-modal__content {
	position: relative;
	width: 90%;
	max-width: 900px;
	max-height: 90vh;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.retrotec-product-quiz-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 15px 20px;
	background: #f8f8f8;
	border-bottom: 1px solid #e0e0e0;
}

.retrotec-product-quiz-modal__title {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: #1d2327;
}

.retrotec-product-quiz-modal__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	background: transparent;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	color: #666;
	transition: background-color 0.2s, color 0.2s;
}

.retrotec-product-quiz-modal__close:hover {
	background: #e0e0e0;
	color: #1d2327;
}

.retrotec-product-quiz-modal__close:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.retrotec-product-quiz-modal__close .dashicons {
	font-size: 24px;
	width: 24px;
	height: 24px;
}

.retrotec-product-quiz-modal__body {
	flex: 1;
	overflow: auto;
	padding: 0;
}

.retrotec-product-quiz-modal__body iframe {
	display: block;
	width: 100%;
	border: 0;
}

/* Body Class When Modal Open */
body.retrotec-modal-open {
	overflow: hidden;
}

/* Responsive */
@media screen and (max-width: 768px) {
	.retrotec-product-quiz-modal__content {
		width: 95%;
		max-height: 95vh;
	}

	.retrotec-product-quiz__button {
		width: 100%;
		justify-content: center;
	}

	.retrotec-product-quiz--modal-trigger {
		display: block;
		margin-right: 0;
	}

	.retrotec-product-quiz-modal__header {
		padding: 12px 15px;
	}

	.retrotec-product-quiz-modal__title {
		font-size: 16px;
	}
}

/* Animation */
@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes slideUp {
	from {
		transform: translateY(20px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

.retrotec-product-quiz-modal.is-open .retrotec-product-quiz-modal__overlay {
	animation: fadeIn 0.2s ease-out;
}

.retrotec-product-quiz-modal.is-open .retrotec-product-quiz-modal__content {
	animation: slideUp 0.3s ease-out;
}
