/* ==========================================================================
   WA Lead Button — Frontend Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
	--walb-color: #25D366;
	--walb-color-dark: #128C7E;
	--walb-color-light: #DCF8C6;
	--walb-radius: 16px;
	--walb-radius-sm: 10px;
	--walb-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
	--walb-shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.1);
	--walb-shadow-hover: 0 12px 40px rgba(37, 211, 102, 0.35);
	--walb-transition: cubic-bezier(0.4, 0, 0.2, 1);
	--walb-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* --------------------------------------------------------------------------
   Widget Container
   -------------------------------------------------------------------------- */
.walb-widget {
	position: fixed;
	bottom: 24px;
	z-index: 999999;
	font-family: var(--walb-font);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

.walb-position-left {
	left: 24px;
}

.walb-position-right {
	right: 24px;
}

/* --------------------------------------------------------------------------
   Floating Trigger Button
   -------------------------------------------------------------------------- */
.walb-trigger {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 22px 14px 16px;
	border: none;
	border-radius: 60px;
	background: var(--walb-color);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	font-family: var(--walb-font);
	cursor: pointer;
	box-shadow: var(--walb-shadow);
	position: relative;
	overflow: hidden;
	transition: all 0.35s var(--walb-transition);
	animation: walb-slide-in 0.6s var(--walb-transition) 0.5s both;
}

.walb-trigger:hover {
	transform: translateY(-3px) scale(1.03);
	box-shadow: var(--walb-shadow-hover);
}

.walb-trigger:active {
	transform: translateY(-1px) scale(0.98);
}

/* Shimmer effect on button */
.walb-trigger::after {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(
		90deg,
		transparent,
		rgba(255, 255, 255, 0.2),
		transparent
	);
	animation: walb-shimmer 3s infinite;
}

.walb-trigger-icon {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.walb-trigger-label {
	white-space: nowrap;
	letter-spacing: 0.01em;
}

/* Pulse ring behind button */
.walb-trigger-pulse {
	position: absolute;
	inset: -4px;
	border-radius: inherit;
	border: 2px solid var(--walb-color);
	opacity: 0;
	animation: walb-pulse 2.5s var(--walb-transition) infinite;
	pointer-events: none;
}

/* Hide label on very small screens */
@media (max-width: 420px) {
	.walb-trigger {
		padding: 14px;
		border-radius: 50%;
	}

	.walb-trigger-label {
		display: none;
	}
}

/* --------------------------------------------------------------------------
   Modal Overlay & Container
   -------------------------------------------------------------------------- */
.walb-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 9999999;
	align-items: flex-end;
	justify-content: flex-start;
	padding: 24px;
}

.walb-modal.walb-open {
	display: flex;
}

.walb-position-right .walb-modal,
.walb-position-right.walb-widget .walb-modal {
	justify-content: flex-end;
}

/* Fix: modal inside the widget needs fixed positioning */
.walb-widget .walb-modal {
	position: fixed;
	inset: 0;
}

.walb-modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity 0.3s var(--walb-transition);
}

.walb-modal.walb-open .walb-modal-backdrop {
	opacity: 1;
}

/* --------------------------------------------------------------------------
   Modal Content Card
   -------------------------------------------------------------------------- */
.walb-modal-content {
	position: relative;
	width: 100%;
	max-width: 380px;
	background: #fff;
	border-radius: var(--walb-radius);
	box-shadow: var(--walb-shadow);
	overflow: hidden;
	transform: translateY(30px) scale(0.95);
	opacity: 0;
	transition: all 0.4s var(--walb-transition);
	align-self: flex-end;
	margin-bottom: 80px;
}

.walb-modal.walb-open .walb-modal-content {
	transform: translateY(0) scale(1);
	opacity: 1;
}

/* --------------------------------------------------------------------------
   Modal Header
   -------------------------------------------------------------------------- */
.walb-modal-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 20px 20px 16px;
	background: linear-gradient(135deg, var(--walb-color), var(--walb-color-dark));
	color: #fff;
	position: relative;
}

/* Decorative circles */
.walb-modal-header::before {
	content: '';
	position: absolute;
	top: -20px;
	right: -20px;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
}

.walb-modal-header::after {
	content: '';
	position: absolute;
	bottom: -10px;
	left: 30px;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.06);
}

.walb-modal-header-icon {
	width: 44px;
	height: 44px;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.walb-modal-header-text {
	flex: 1;
	min-width: 0;
}

.walb-modal-header-text h3 {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
	color: #fff;
}

.walb-modal-header-text p {
	margin: 2px 0 0;
	font-size: 13px;
	opacity: 0.9;
	line-height: 1.4;
	color: #fff;
}

/* Close button */
.walb-modal-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	border: none;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
}

.walb-modal-close:hover {
	background: rgba(255, 255, 255, 0.3);
}

/* --------------------------------------------------------------------------
   Form
   -------------------------------------------------------------------------- */
.walb-form {
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* Field wrapper */
.walb-field label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #374151;
	margin-bottom: 6px;
}

/* Input wrapper with icon */
.walb-input-wrap {
	position: relative;
	display: flex;
	align-items: center;
}

.walb-input-icon {
	position: absolute;
	left: 14px;
	color: #9CA3AF;
	pointer-events: none;
	transition: color 0.2s;
}

.walb-input-wrap input {
	width: 100%;
	padding: 12px 14px 12px 42px;
	border: 2px solid #E5E7EB;
	border-radius: var(--walb-radius-sm);
	font-size: 15px;
	font-family: var(--walb-font);
	color: #111827;
	background: #F9FAFB;
	transition: all 0.25s var(--walb-transition);
	outline: none;
	box-sizing: border-box;
}

.walb-input-wrap input::placeholder {
	color: #9CA3AF;
}

.walb-input-wrap input:focus {
	border-color: var(--walb-color);
	background: #fff;
	box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.1);
}

.walb-input-wrap input:focus + .walb-input-icon,
.walb-input-wrap input:focus ~ .walb-input-icon {
	color: var(--walb-color);
}

/* Re-order for the icon to respond to input focus via general sibling */
.walb-input-wrap {
	flex-direction: row-reverse;
}

.walb-input-wrap .walb-input-icon {
	position: absolute;
	left: 14px;
	z-index: 1;
}

.walb-input-wrap input {
	flex: 1;
}

/* Error state */
.walb-field.walb-has-error .walb-input-wrap input {
	border-color: #EF4444;
	background: #FEF2F2;
}

.walb-field.walb-has-error .walb-input-icon {
	color: #EF4444;
}

.walb-error {
	display: none;
	font-size: 12px;
	color: #EF4444;
	margin-top: 4px;
	padding-left: 2px;
}

.walb-field.walb-has-error .walb-error {
	display: block;
	animation: walb-shake 0.4s var(--walb-transition);
}

/* --------------------------------------------------------------------------
   Custom Checkbox
   -------------------------------------------------------------------------- */
.walb-field-checkbox {
	margin-top: 2px;
}

.walb-checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	cursor: pointer;
	font-size: 13px !important;
	font-weight: 400 !important;
	color: #6B7280 !important;
	line-height: 1.5;
}

.walb-checkbox-label input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.walb-checkbox-custom {
	width: 20px;
	height: 20px;
	min-width: 20px;
	border: 2px solid #D1D5DB;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s var(--walb-transition);
	margin-top: 1px;
	background: #F9FAFB;
	position: relative;
}

.walb-checkbox-custom::after {
	content: '';
	width: 10px;
	height: 6px;
	border-left: 2.5px solid #fff;
	border-bottom: 2.5px solid #fff;
	transform: rotate(-45deg) scale(0);
	transition: transform 0.2s var(--walb-transition);
	position: absolute;
	top: 4px;
}

.walb-checkbox-label input:checked + .walb-checkbox-custom {
	background: var(--walb-color);
	border-color: var(--walb-color);
}

.walb-checkbox-label input:checked + .walb-checkbox-custom::after {
	transform: rotate(-45deg) scale(1);
}

.walb-checkbox-text {
	flex: 1;
}

.walb-field-checkbox.walb-has-error .walb-checkbox-custom {
	border-color: #EF4444;
}

/* --------------------------------------------------------------------------
   Submit Button
   -------------------------------------------------------------------------- */
.walb-submit {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	padding: 14px 24px;
	border: none;
	border-radius: var(--walb-radius-sm);
	background: linear-gradient(135deg, var(--walb-color), var(--walb-color-dark));
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	font-family: var(--walb-font);
	cursor: pointer;
	transition: all 0.3s var(--walb-transition);
	position: relative;
	overflow: hidden;
	margin-top: 4px;
}

.walb-submit:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.walb-submit:active {
	transform: translateY(0);
}

.walb-submit:disabled {
	opacity: 0.7;
	cursor: not-allowed;
	transform: none;
}

.walb-submit::after {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(
		90deg,
		transparent,
		rgba(255, 255, 255, 0.15),
		transparent
	);
	transition: left 0.5s;
}

.walb-submit:hover::after {
	left: 100%;
}

.walb-submit-icon {
	display: flex;
}

/* --------------------------------------------------------------------------
   Modal Footer
   -------------------------------------------------------------------------- */
.walb-modal-footer {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 12px 20px;
	background: #F9FAFB;
	border-top: 1px solid #F3F4F6;
	font-size: 12px;
	color: #9CA3AF;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */

/* Slide in from bottom */
@keyframes walb-slide-in {
	from {
		opacity: 0;
		transform: translateY(40px) scale(0.8);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* Pulse ring */
@keyframes walb-pulse {
	0% {
		opacity: 0.6;
		transform: scale(1);
	}
	50% {
		opacity: 0;
		transform: scale(1.3);
	}
	100% {
		opacity: 0;
		transform: scale(1.3);
	}
}

/* Shimmer */
@keyframes walb-shimmer {
	0% {
		left: -100%;
	}
	20% {
		left: 100%;
	}
	100% {
		left: 100%;
	}
}

/* Shake for errors */
@keyframes walb-shake {
	0%, 100% { transform: translateX(0); }
	20% { transform: translateX(-4px); }
	40% { transform: translateX(4px); }
	60% { transform: translateX(-3px); }
	80% { transform: translateX(3px); }
}

/* --------------------------------------------------------------------------
   Hidden state for trigger when modal is open
   -------------------------------------------------------------------------- */
.walb-widget.walb-active .walb-trigger {
	transform: scale(0);
	opacity: 0;
	pointer-events: none;
}

/* --------------------------------------------------------------------------
   Success state
   -------------------------------------------------------------------------- */
.walb-success-message {
	text-align: center;
	padding: 30px 20px;
}

.walb-success-message svg {
	color: var(--walb-color);
	margin-bottom: 12px;
}

.walb-success-message p {
	font-size: 15px;
	font-weight: 600;
	color: #374151;
	margin: 0;
}

.walb-success-message span {
	display: block;
	font-size: 13px;
	color: #9CA3AF;
	margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
	.walb-widget {
		bottom: 16px;
		left: 16px;
		right: 16px;
	}

	.walb-position-left {
		left: 16px;
	}

	.walb-position-right {
		right: 16px;
	}

	.walb-modal {
		padding: 12px;
		align-items: flex-end;
		justify-content: center !important;
	}

	.walb-modal-content {
		max-width: 100%;
		margin-bottom: 70px;
	}

	.walb-modal-header {
		padding: 16px;
	}

	.walb-form {
		padding: 16px;
	}
}
