/* Quiz Discount - frontend styles */

/* === Floating Action Button === */
.qd-fab {
	position: fixed;
	z-index: 99998;
	top: var(--qd-fab-vy, 92vh);
	transform: translateY(var(--qd-fab-translate-y, -92%));
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 14px 22px;
	background: var(--qd-fab-bg, #111) !important;
	color: var(--qd-fab-fg, #fff) !important;
	border: none !important;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	font: 600 15px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
	cursor: pointer !important;
	text-shadow: none !important;
	text-decoration: none !important;
	transition: background 0.18s ease, box-shadow 0.18s ease, padding 0.3s ease, gap 0.3s ease;
}

/* === Collapsible: only icon visible by default, expand on hover/tap === */
.qd-fab-collapsible {
	gap: 0;
	padding: 14px 16px;
}
.qd-fab-collapsible .qd-fab-text {
	max-width: 0 !important;
	opacity: 0 !important;
	overflow: hidden !important;
	white-space: nowrap !important;
	margin: 0 !important;
	transition: max-width 0.3s ease, opacity 0.2s ease 0.05s, margin 0.3s ease, padding 0.3s ease;
	display: inline-block !important;
}

/* Expanded state - on hover (real hover devices only) OR on JS-toggled .is-expanded (touch) */
@media (hover: hover) and (pointer: fine) {
	.qd-fab-collapsible:hover {
		gap: 8px;
		padding: 14px 22px;
	}
	.qd-fab-collapsible:hover .qd-fab-text {
		max-width: 260px !important;
		opacity: 1 !important;
		margin-left: 4px !important;
	}
}
.qd-fab-collapsible.is-expanded {
	gap: 8px;
	padding: 14px 22px;
}
.qd-fab-collapsible.is-expanded .qd-fab-text {
	max-width: 260px !important;
	opacity: 1 !important;
	margin-left: 4px !important;
}

/* Half_circle collapsed - keep flush with edge, smaller padding */
.qd-fab-shape-half_circle.qd-fab-collapsible.qd-fab-side-right {
	padding: 14px 18px 14px 22px !important;
}
.qd-fab-shape-half_circle.qd-fab-collapsible.qd-fab-side-left {
	padding: 14px 22px 14px 18px !important;
}
.qd-fab-shape-half_circle.qd-fab-collapsible:hover,
.qd-fab-shape-half_circle.qd-fab-collapsible.is-expanded {
	padding: 14px 22px 14px 28px !important;
}
.qd-fab-shape-half_circle.qd-fab-collapsible.qd-fab-side-left:hover,
.qd-fab-shape-half_circle.qd-fab-collapsible.qd-fab-side-left.is-expanded {
	padding: 14px 28px 14px 22px !important;
}

.qd-fab:hover,
.qd-fab:focus {
	background: var(--qd-fab-bg-hover, #333) !important;
	color: var(--qd-fab-fg, #fff) !important;
	box-shadow: 0 14px 32px rgba(0, 0, 0, 0.26);
}
.qd-fab-icon {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	min-width: 26px !important;
	height: 26px !important;
	padding: 0 8px !important;
	box-sizing: border-box !important;
	background: var(--qd-fab-fg, #fff) !important;
	color: var(--qd-fab-bg, #111) !important;
	border-radius: 999px !important;
	font-weight: 700 !important;
	font-size: 13px !important;
	line-height: 1 !important;
	letter-spacing: -0.2px;
	white-space: nowrap;
	flex-shrink: 0;
}

/* Side */
.qd-fab-side-right { right: 24px; }
.qd-fab-side-left  { left:  24px; }

/* Shapes */
.qd-fab-shape-pill   { border-radius: 999px; }
.qd-fab-shape-square { border-radius: 8px; }

.qd-fab-shape-circle {
	min-width: 60px;
	height: 60px;
	padding: 0 18px !important;
	border-radius: 999px !important;
	justify-content: center;
	gap: 0;
}
.qd-fab-shape-circle .qd-fab-text { display: none; }
.qd-fab-shape-circle .qd-fab-icon {
	min-width: auto !important;
	width: auto !important;
	height: auto !important;
	padding: 0 !important;
	background: transparent !important;
	color: var(--qd-fab-fg, #fff) !important;
	font-size: 20px !important;
	font-weight: 700 !important;
}

.qd-fab-shape-half_circle.qd-fab-side-right {
	right: 0;
	border-radius: 30px 0 0 30px;
	padding: 14px 22px 14px 28px;
	box-shadow: -6px 8px 24px rgba(0, 0, 0, 0.18);
}
.qd-fab-shape-half_circle.qd-fab-side-left {
	left: 0;
	border-radius: 0 30px 30px 0;
	padding: 14px 28px 14px 22px;
	box-shadow: 6px 8px 24px rgba(0, 0, 0, 0.18);
}

.qd-inline-btn {
	display: inline-block;
	padding: 12px 22px;
	background: #111;
	color: #fff;
	border: none;
	border-radius: 4px;
	font-weight: 600;
	cursor: pointer;
}

/* === Modal === */
.qd-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 99999;
	font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.qd-modal.is-open { display: block; }

.qd-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(2px);
}

.qd-modal-dialog {
	position: relative;
	max-width: var(--qd-modal-width, 520px);
	margin: 5vh auto;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
	max-height: 90vh;
	max-height: 90dvh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.qd-modal-close {
	position: absolute;
	top: 10px;
	right: 14px;
	background: transparent;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #666;
	padding: 6px 10px;
	z-index: 2;
}
.qd-modal-close:hover { color: #000; }

.qd-modal-body {
	padding: 28px 30px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	flex: 1 1 auto;
	min-height: 0;
}

.qd-modal-title {
	margin: 0 0 6px;
	font-size: 22px;
	color: #111;
}
.qd-modal-description {
	color: #555;
	margin-bottom: 16px;
}
.qd-modal-description p,
.qd-success-message p {
	margin: 0 0 10px;
}
.qd-modal-description p:last-child,
.qd-success-message p:last-child {
	margin-bottom: 0;
}
.qd-modal-description ul,
.qd-modal-description ol,
.qd-success-message ul,
.qd-success-message ol {
	margin: 0 0 10px;
	padding-left: 22px;
}
.qd-modal-description li,
.qd-success-message li {
	margin: 3px 0;
}
.qd-modal-description a,
.qd-success-message a {
	color: #111;
	text-decoration: underline;
}
.qd-modal-description blockquote {
	margin: 8px 0;
	padding: 6px 12px;
	border-left: 3px solid #ddd;
	color: #666;
	font-style: italic;
}

/* === Form === */
.qd-field {
	margin-bottom: 14px;
}

.qd-field-label {
	display: block;
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 6px;
	color: #222;
}

.qd-required {
	color: #d23;
	margin-left: 2px;
}

.qd-input {
	display: block;
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #ccc;
	border-radius: 6px;
	font-size: 14px;
	font-family: inherit;
	box-sizing: border-box;
	background: #fff;
}
.qd-input:focus {
	outline: none;
	border-color: #111;
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

textarea.qd-input { resize: vertical; min-height: 70px; }

.qd-option {
	display: block;
	padding: 6px 0;
	cursor: pointer;
	font-size: 14px;
}
.qd-option input { margin-right: 6px; }

.qd-consent label {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	font-size: 13px;
	color: #555;
	cursor: pointer;
}
.qd-consent input { margin-top: 3px; }

/* === GDPR / RODO === */
.qd-gdpr-details {
	background: #f7f7f7;
	border: 1px solid #e2e2e2;
	border-radius: 6px;
	padding: 8px 12px;
	margin: 14px 0;
	font-size: 12px;
}
.qd-gdpr-summary {
	cursor: pointer;
	color: #444;
	font-weight: 600;
	padding: 4px 0;
	list-style: none;
	outline: none;
}
.qd-gdpr-summary::-webkit-details-marker { display: none; }
.qd-gdpr-summary::before {
	content: "▸ ";
	display: inline-block;
	transition: transform 0.15s ease;
}
.qd-gdpr-details[open] .qd-gdpr-summary::before {
	transform: rotate(90deg);
}
.qd-gdpr-clause {
	color: #555;
	line-height: 1.55;
	padding: 10px 4px 4px;
	border-top: 1px solid #e2e2e2;
	margin-top: 6px;
	max-height: 220px;
	overflow-y: auto;
}
.qd-gdpr-clause p { margin: 0 0 8px; }

.qd-consent-marketing {
	margin-top: -4px;
}

/* === Star Rating === */
.qd-rating {
	display: flex;
	gap: 6px;
	font-size: 32px;
	line-height: 1;
}
.qd-modal .qd-star {
	background: transparent !important;
	border: none !important;
	padding: 2px 4px !important;
	margin: 0 !important;
	cursor: pointer !important;
	color: #d0d0d0 !important;
	font-size: 32px !important;
	line-height: 1 !important;
	box-shadow: none !important;
	text-shadow: none !important;
	transition: color 0.12s ease, transform 0.12s ease;
}
.qd-modal .qd-star:hover,
.qd-modal .qd-star.is-active {
	color: #f5b301 !important;
}
.qd-modal .qd-star:hover {
	transform: scale(1.12);
}
.qd-modal .qd-star:focus {
	outline: 2px solid rgba(0, 0, 0, 0.15);
	outline-offset: 2px;
}

.qd-submit-btn {
	width: 100%;
	padding: 14px;
	background: #111;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	margin-top: 8px;
	transition: background 0.15s ease;
}
.qd-submit-btn:hover  { background: #000; }
.qd-submit-btn:disabled { background: #888; cursor: not-allowed; }

.qd-form-error {
	background: #fde2e2;
	color: #8a1f1f;
	padding: 10px 12px;
	border-radius: 6px;
	margin-bottom: 12px;
	font-size: 13px;
}

/* === Success State === */
.qd-success {
	text-align: center;
	padding: 20px 0;
}
.qd-success-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: #d4edda;
	color: #155724;
	font-size: 36px;
	margin-bottom: 12px;
}
.qd-success h3 {
	margin: 0 0 8px;
	font-size: 20px;
}
.qd-success-message {
	color: #555;
	margin-bottom: 16px;
}

.qd-coupon-box {
	background: #f8f8f8;
	border: 2px dashed #bbb;
	border-radius: 8px;
	padding: 18px;
	margin-top: 12px;
}
.qd-coupon-box small {
	display: block;
	color: #666;
	margin-bottom: 6px;
	text-transform: uppercase;
	letter-spacing: 1px;
	font-size: 11px;
}
.qd-coupon-code {
	font-family: "SFMono-Regular", Consolas, monospace;
	font-size: 22px;
	font-weight: 700;
	letter-spacing: 2px;
	color: #111;
	margin-bottom: 10px;
}
.qd-copy-btn {
	background: #111;
	color: #fff;
	border: none;
	padding: 8px 16px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 13px;
}
.qd-copy-btn:hover { background: #000; }

/* === Mobile === */
@media (max-width: 600px) {
	.qd-fab:not(.qd-fab-shape-half_circle):not(.qd-fab-collapsible) {
		padding: 12px 16px;
	}
	.qd-fab-side-right:not(.qd-fab-shape-half_circle) { right: 16px; }
	.qd-fab-side-left:not(.qd-fab-shape-half_circle)  { left:  16px; }
	.qd-modal-dialog {
		margin: 0;
		max-width: 100%;
		width: 100%;
		border-radius: 0;
		/* vh fallback first, dvh wins where supported — fixes bottom buttons
		   hidden behind the mobile browser address bar */
		height: 100vh;
		height: 100dvh;
		max-height: 100vh;
		max-height: 100dvh;
	}
	.qd-modal-body {
		/* extra breathing room above the iOS home indicator / safe area */
		padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
	}
}

/* === FAB Attention Animations === */

/* Pause animations during hover or expansion so user can interact calmly */
.qd-fab:hover,
.qd-fab.is-expanded {
	animation-play-state: paused !important;
}

/* 1. Pulsing glow — soft pulse of color around the button */
@keyframes qd-anim-glow {
	0%, 100% {
		box-shadow:
			0 8px 24px rgba(0, 0, 0, 0.18),
			0 0 0 0 var(--qd-fab-bg, #111);
	}
	50% {
		box-shadow:
			0 8px 24px rgba(0, 0, 0, 0.18),
			0 0 32px 6px var(--qd-fab-bg, #111);
	}
}
.qd-fab-anim-glow {
	animation: qd-anim-glow 2.4s ease-in-out infinite;
}

/* 2. Expanding ring — like a sonar ping radiating outward */
@keyframes qd-anim-ring {
	0% {
		box-shadow:
			0 8px 24px rgba(0, 0, 0, 0.18),
			0 0 0 0 var(--qd-fab-bg, #111);
	}
	80%, 100% {
		box-shadow:
			0 8px 24px rgba(0, 0, 0, 0.18),
			0 0 0 22px rgba(0, 0, 0, 0);
	}
}
.qd-fab-anim-ring {
	animation: qd-anim-ring 2s ease-out infinite;
}

/* 3. Heartbeat-style pulse — gentle scale up and down.
   Includes the positioning translateY so it doesn't reset the button's vertical placement. */
@keyframes qd-anim-pulse {
	0%, 100% {
		transform: translateY(var(--qd-fab-translate-y, -92%)) scale(1);
	}
	50% {
		transform: translateY(var(--qd-fab-translate-y, -92%)) scale(1.08);
	}
}
.qd-fab-anim-pulse {
	animation: qd-anim-pulse 1.7s ease-in-out infinite;
}

/* 4. Shake — brief horizontal wiggle every few seconds.
   Most of the timeline is rest (88%), wiggle happens in the last 12%. */
@keyframes qd-anim-shake {
	0%, 88%, 100% {
		transform: translateY(var(--qd-fab-translate-y, -92%)) translateX(0);
	}
	90% { transform: translateY(var(--qd-fab-translate-y, -92%)) translateX(-4px); }
	92% { transform: translateY(var(--qd-fab-translate-y, -92%)) translateX(4px); }
	94% { transform: translateY(var(--qd-fab-translate-y, -92%)) translateX(-3px); }
	96% { transform: translateY(var(--qd-fab-translate-y, -92%)) translateX(3px); }
	98% { transform: translateY(var(--qd-fab-translate-y, -92%)) translateX(-1px); }
}
.qd-fab-anim-shake {
	animation: qd-anim-shake 3.5s ease-in-out infinite;
}

/* Respect user's preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
	.qd-fab-anim-glow,
	.qd-fab-anim-ring,
	.qd-fab-anim-pulse,
	.qd-fab-anim-shake {
		animation: none !important;
	}
}
