/* ============================================================================
 * Floating Catalog Widget
 *
 * Global FAB visible on every page that lets visitors order a material sample
 * (external link) or request the Traplast catalog by email. Positioned in the
 * bottom-right corner with enough offset to clear the existing sticky bar that
 * appears on landing-page templates.
 *
 * Layered z-index logic:
 *   --zcw-z: 9998      panel + button (above sticky-bar at z 9000-9500)
 *   --zcw-z-modal: 9999  intentionally one above to defeat any sticky overlay
 * ============================================================================ */

:root {
	--zcw-z: 9998;
	--zcw-bottom-offset: 96px; /* clears the .sticky-bar component on landing pages */
	--zcw-accent: #4caf72;
	--zcw-accent-hover: #5ec882;
	--zcw-bg: rgba(20, 28, 22, 0.94);
	--zcw-border: rgba(255, 255, 255, 0.1);
	--zcw-text: #ffffff;
	--zcw-muted: rgba(255, 255, 255, 0.55);
	--zcw-radius: 20px;
	--zcw-radius-sm: 12px;
	--zcw-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.55), 0 10px 30px -8px rgba(0, 0, 0, 0.35);
	--zcw-ease: cubic-bezier(0.23, 1, 0.32, 1);
}

.zcw {
	position: fixed;
	right: 24px;
	bottom: var(--zcw-bottom-offset);
	z-index: var(--zcw-z);
	font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: var(--zcw-text);
}

/* ---------- FAB ---------- */

.zcw-fab {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	background: linear-gradient(135deg, var(--zcw-accent) 0%, #3a8a5d 100%);
	color: #ffffff;
	border: none;
	border-radius: 999px;
	padding: 14px 22px 14px 18px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.01em;
	cursor: pointer;
	box-shadow:
		0 14px 30px -8px rgba(76, 175, 114, 0.55),
		0 6px 14px -4px rgba(0, 0, 0, 0.2),
		inset 0 1px 0 rgba(255, 255, 255, 0.18);
	transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
	position: relative;
	will-change: transform;
}

.zcw-fab::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 999px;
	background: var(--zcw-accent);
	opacity: 0.55;
	z-index: -1;
	animation: zcw-pulse 2.6s ease-out infinite;
}

@keyframes zcw-pulse {
	0%   { transform: scale(1); opacity: 0.55; }
	70%  { transform: scale(1.4); opacity: 0; }
	100% { transform: scale(1.4); opacity: 0; }
}

.zcw-fab:hover {
	transform: translateY(-2px);
}

.zcw-fab:active {
	transform: translateY(0);
}

.zcw-fab:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 4px rgba(76, 175, 114, 0.4),
		0 14px 30px -8px rgba(76, 175, 114, 0.55),
		0 6px 14px -4px rgba(0, 0, 0, 0.2),
		inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.zcw-fab-icon {
	display: inline-flex;
	width: 20px;
	height: 20px;
}

.zcw-fab-icon svg {
	width: 100%;
	height: 100%;
}

/* Label rotator: asymmetric enter/exit timing via custom ease-out curve.
   Exit is quick (140ms) — matches the JS FADE_OUT_MS constant. Enter is
   slower (220ms) so the new word settles in with a soft inhale. */
.zcw-fab-label {
	display: inline-block;
	transition: opacity 220ms var(--zcw-ease), transform 220ms var(--zcw-ease);
	will-change: opacity, transform;
}

.zcw-fab-label[data-leaving="true"] {
	opacity: 0;
	transform: translateY(-5px);
	transition-duration: 140ms;
}

.zcw-fab-label[data-entering="true"] {
	opacity: 0;
	transform: translateY(5px);
	transition: none;
}

.zcw[data-state="open"] .zcw-fab::before {
	animation: none;
}

/* ---------- Panel ---------- */

.zcw-panel {
	position: absolute;
	bottom: calc(100% + 14px);
	right: 0;
	width: 360px;
	max-width: calc(100vw - 32px);
	background: var(--zcw-bg);
	-webkit-backdrop-filter: blur(20px) saturate(140%);
	backdrop-filter: blur(20px) saturate(140%);
	border: 1px solid var(--zcw-border);
	border-radius: var(--zcw-radius);
	padding: 28px 24px 22px;
	box-shadow: var(--zcw-shadow);
	transform-origin: bottom right;
	animation: zcw-panel-in 0.34s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zcw-panel-in {
	from { opacity: 0; transform: translateY(16px) scale(0.96); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

.zcw-panel[hidden] {
	display: none;
}

.zcw-close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 32px;
	height: 32px;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 50%;
	color: rgba(255, 255, 255, 0.65);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.zcw-close svg {
	width: 14px;
	height: 14px;
}

.zcw-close:hover {
	background: rgba(255, 255, 255, 0.12);
	color: #ffffff;
	border-color: rgba(255, 255, 255, 0.18);
}

/* ---------- Header ---------- */

.zcw-header {
	margin: 0 0 20px;
	padding-right: 36px;
}

.zcw-eyebrow {
	display: inline-block;
	font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--zcw-accent);
	margin-bottom: 8px;
}

.zcw-header h3 {
	margin: 0 0 6px;
	font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
	font-size: 22px;
	font-weight: 800;
	letter-spacing: -0.01em;
	color: #ffffff;
	line-height: 1.2;
}

.zcw-header p {
	margin: 0;
	font-size: 13px;
	color: var(--zcw-muted);
	line-height: 1.55;
}

/* ---------- Options ---------- */

.zcw-options {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.zcw-option {
	display: flex;
	align-items: center;
	gap: 14px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 14px;
	padding: 14px 16px;
	color: #ffffff;
	text-decoration: none;
	cursor: pointer;
	font-family: inherit;
	font-size: 14px;
	text-align: left;
	width: 100%;
	transition: background 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

.zcw-option:hover {
	background: rgba(76, 175, 114, 0.1);
	border-color: rgba(76, 175, 114, 0.35);
	transform: translateY(-1px);
}

.zcw-option:focus-visible {
	outline: none;
	border-color: var(--zcw-accent);
	box-shadow: 0 0 0 3px rgba(76, 175, 114, 0.25);
}

.zcw-option-icon {
	flex-shrink: 0;
	width: 42px;
	height: 42px;
	background: rgba(76, 175, 114, 0.14);
	border-radius: 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--zcw-accent);
}

.zcw-option-icon svg {
	width: 20px;
	height: 20px;
}

.zcw-option-text {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.zcw-option-text strong {
	font-size: 14px;
	font-weight: 700;
	color: #ffffff;
}

.zcw-option-text span {
	font-size: 12px;
	font-weight: 400;
	color: var(--zcw-muted);
	line-height: 1.4;
}

.zcw-option-arrow {
	width: 16px;
	height: 16px;
	color: rgba(255, 255, 255, 0.4);
	flex-shrink: 0;
	transition: transform 0.22s ease;
}

.zcw-option:hover .zcw-option-arrow {
	transform: translateX(2px);
	color: var(--zcw-accent);
}

.zcw-option--toggle[aria-expanded="true"] .zcw-option-arrow--toggle {
	transform: rotate(180deg);
}

.zcw-option--toggle:hover .zcw-option-arrow--toggle {
	transform: none;
	color: var(--zcw-accent);
}

.zcw-option--toggle[aria-expanded="true"]:hover .zcw-option-arrow--toggle {
	transform: rotate(180deg);
}

/* ---------- Form ---------- */

.zcw-form {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	display: flex;
	flex-direction: column;
	gap: 10px;
	animation: zcw-fade-in 0.28s ease-out;
}

.zcw-form[hidden] {
	display: none;
}

@keyframes zcw-fade-in {
	from { opacity: 0; transform: translateY(-4px); }
	to   { opacity: 1; transform: translateY(0); }
}

.zcw-form label {
	font-size: 12px;
	font-weight: 600;
	color: rgba(255, 255, 255, 0.72);
	letter-spacing: 0.02em;
}

.zcw-form input[type="email"] {
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 11px;
	padding: 13px 15px;
	font-family: inherit;
	font-size: 14px;
	color: #ffffff;
	outline: none;
	transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.zcw-form input[type="email"]::placeholder {
	color: rgba(255, 255, 255, 0.32);
}

.zcw-form input[type="email"]:focus {
	border-color: var(--zcw-accent);
	background: rgba(255, 255, 255, 0.08);
	box-shadow: 0 0 0 3px rgba(76, 175, 114, 0.18);
}

.zcw-submit {
	position: relative;
	background: var(--zcw-accent);
	color: #ffffff;
	border: none;
	border-radius: 11px;
	padding: 13px 18px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
	box-shadow: 0 6px 18px -6px rgba(76, 175, 114, 0.5);
}

.zcw-submit:hover {
	background: var(--zcw-accent-hover);
	transform: translateY(-1px);
}

.zcw-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

.zcw-submit-spinner {
	width: 16px;
	height: 16px;
	display: none;
	animation: zcw-spin 0.85s linear infinite;
}

.zcw-submit[data-loading="true"] .zcw-submit-label {
	visibility: hidden;
}

.zcw-submit[data-loading="true"] .zcw-submit-spinner {
	display: block;
	position: absolute;
}

@keyframes zcw-spin {
	from { transform: rotate(0deg); }
	to   { transform: rotate(360deg); }
}

.zcw-status {
	margin: 0;
	font-size: 12px;
	min-height: 1em;
	color: var(--zcw-muted);
	line-height: 1.5;
}

.zcw-status.is-success {
	color: #5ed47f;
}

.zcw-status.is-error {
	color: #f87171;
}

.zcw-privacy {
	margin: 4px 0 0;
	font-size: 11px;
	color: rgba(255, 255, 255, 0.4);
	line-height: 1.5;
}

/* ---------- Mobile ---------- */

@media (max-width: 600px) {
	:root {
		--zcw-bottom-offset: 88px;
	}

	.zcw {
		right: 16px;
	}

	.zcw-fab {
		padding: 13px 18px 13px 16px;
	}

	.zcw-fab-label {
		display: none;
	}

	.zcw-panel {
		width: calc(100vw - 32px);
		right: -8px;
		padding: 24px 20px 20px;
	}

	.zcw-header h3 {
		font-size: 20px;
	}
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.zcw-fab::before,
	.zcw-panel,
	.zcw-form,
	.zcw-fab,
	.zcw-option,
	.zcw-option-arrow,
	.zcw-submit-spinner {
		animation: none !important;
		transition-duration: 0.01ms !important;
	}
}
