/*
 * Ported from the Vue app's FloatingAllenChat/style.scss. The ringing /
 * call-caption / call-ring states from that file are BYOBW-specific (tied
 * to useAllenCall()'s page-takeover mechanism) and intentionally not
 * included here — see allen-chat-shortcode.php's own header comment.
 */

.w2w-allen-chat {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 1000;
}

.w2w-allen-chat__button {
	width: 90px;
	height: 90px;
	border-radius: 50%;
	background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%);
	border: 2px solid #f7f3eb;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(247, 243, 235, 0.2);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	position: relative;
	overflow: hidden;
	padding: 0;
}

.w2w-allen-chat__button:hover {
	transform: translateY(-3px) scale(1.05);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 0 4px rgba(247, 243, 235, 0.3);
	background: linear-gradient(135deg, #2d2d2d 0%, #3d3d3d 50%, #2d2d2d 100%);
	border-color: #c5a572;
}

.w2w-allen-chat__button:active {
	transform: translateY(-1px) scale(1.02);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(247, 243, 235, 0.2);
}

.w2w-allen-chat__button.is-active {
	border-color: #c5a572;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(197, 165, 114, 0.4);
}

.w2w-allen-chat__alien {
	width: 65px;
	height: 65px;
	object-fit: cover;
	object-position: center top;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
	transition: all 0.3s ease;
	border-radius: 50%;
}

.w2w-allen-chat__button:hover .w2w-allen-chat__alien {
	transform: scale(1.1);
	filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4)) brightness(1.1);
}

.w2w-allen-chat__widget {
	position: absolute;
	bottom: 90px;
	right: 0;
	width: 400px;
	height: 500px;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.2);
	border: 2px solid #f7f3eb;
	overflow: hidden;
	animation: w2w-allen-slide-up 0.3s ease-out;
}

.w2w-allen-chat__widget-header {
	background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
	padding: 16px 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 1px solid #f7f3eb;
}

.w2w-allen-chat__widget-title {
	color: #f7f3eb;
	font-weight: 600;
	font-size: 16px;
}

.w2w-allen-chat__close-button {
	background: none;
	border: none;
	color: #f7f3eb;
	cursor: pointer;
	padding: 4px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.w2w-allen-chat__close-button:hover {
	background: rgba(247, 243, 235, 0.1);
	color: #c5a572;
}

.w2w-allen-chat__widget-content {
	height: calc(100% - 60px);
	width: 100%;
}

.w2w-allen-chat__widget-content iframe {
	width: 100%;
	height: 100%;
	border: 0;
}

.w2w-allen-chat__terms-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	padding: 20px;
	text-align: center;
	color: #666;
	font-size: 14px;
	line-height: 1.5;
}

@keyframes w2w-allen-slide-up {
	from { opacity: 0; transform: translateY(20px) scale(0.95); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 768px) {
	.w2w-allen-chat__button {
		width: 64px;
		height: 64px;
	}
	.w2w-allen-chat {
		bottom: 20px;
		right: 20px;
	}
	.w2w-allen-chat__alien {
		width: 48px;
		height: 48px;
	}
	.w2w-allen-chat__widget {
		width: calc(100vw - 40px);
		height: 60vh;
		bottom: 90px;
		right: -10px;
	}
}

@media (max-width: 480px) {
	.w2w-allen-chat__widget {
		width: calc(100vw - 20px);
		height: 70vh;
		bottom: 90px;
		right: -5px;
	}
}

/* Terms modal overlay — position: absolute, not fixed: it's nested inside
   .w2w-allen-chat__widget (see the template), so it fills that small panel's
   own box, not the viewport. That's the Vue original's own behavior too
   (style.scss's .terms-modal-overlay is absolute for the same reason). */
.w2w-allen-chat__terms-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.8);
	backdrop-filter: blur(4px);
	border-radius: 12px;
	/* Not display: flex here — that would beat the browser's own
	   [hidden] { display: none } rule (author styles always win over the
	   UA default for the same element), making this visible on every
	   page load regardless of the hidden attribute the JS toggles. */
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 10;
	animation: w2w-allen-fade-in 0.2s ease;
}

.w2w-allen-chat__terms-overlay:not([hidden]) {
	display: flex;
}

.w2w-allen-chat__terms-content {
	background: #1a1e2e;
	color: #fff;
	border-radius: 12px;
	width: 90%;
	max-width: 500px;
	max-height: 90%;
	overflow-y: auto;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
	animation: w2w-allen-modal-slide-in 0.3s ease;
	position: relative;
}

.w2w-allen-chat__modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 24px 24px 20px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.w2w-allen-chat__modal-header h2 {
	margin: 0;
	font-size: 24px;
	font-weight: 700;
	color: #4fc3f7;
	letter-spacing: 1px;
}

.w2w-allen-chat__modal-close-button {
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px;
	border-radius: 4px;
	color: #999;
}

.w2w-allen-chat__modal-close-button:hover {
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
}

.w2w-allen-chat__terms-form {
	padding: 0 24px 24px;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.w2w-allen-chat__form-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.w2w-allen-chat__form-group label {
	font-size: 14px;
	font-weight: 500;
	color: #ccc;
}

.w2w-allen-chat__required {
	color: #ff6b6b;
}

.w2w-allen-chat__form-group input[type="text"],
.w2w-allen-chat__form-group input[type="email"] {
	padding: 12px 16px;
	border: 2px solid rgba(255, 255, 255, 0.2);
	border-radius: 8px;
	font-size: 14px;
	background: rgba(255, 255, 255, 0.1);
	/* !important: the theme's own style.css (line ~835) sets color: #666 on
	   every input[type=text]/[type=email]/etc. site-wide, unscoped to any
	   class — plain specificity math says this class-qualified rule should
	   already win, but it doesn't in practice, confirmed via devtools. */
	color: #fff !important;
	transition: border-color 0.2s ease;
}

.w2w-allen-chat__form-group input[type="text"]:focus,
.w2w-allen-chat__form-group input[type="email"]:focus {
	outline: none;
	border-color: #4fc3f7;
	background: rgba(255, 255, 255, 0.15);
}

/* Chrome/Safari autofill (these fields carry autocomplete="given-name" etc.,
   so it's likely to trigger) ignores a plain `color` rule and forces its own
   via -webkit-text-fill-color plus an opaque light background — this is
   what actually shows as black text, not the color: #fff above, which only
   ever applied to manually-typed input. */
.w2w-allen-chat__form-group input[type="text"]:-webkit-autofill,
.w2w-allen-chat__form-group input[type="email"]:-webkit-autofill,
.w2w-allen-chat__form-group input[type="text"]:-webkit-autofill:focus,
.w2w-allen-chat__form-group input[type="email"]:-webkit-autofill:focus {
	-webkit-text-fill-color: #fff;
	/* Long-delay transition trick: autofill's own background can't be set
	   directly, but an inset box-shadow the same color as our own
	   background paints over it without a visible flash. */
	transition: background-color 600000s 0s, color 600000s 0s;
	box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.1) inset;
}

.w2w-allen-chat__ai-terms-link {
	text-align: center;
	margin: 8px 0;
}

.w2w-allen-chat__ai-terms-link a {
	color: #4fc3f7;
	text-decoration: underline;
	font-size: 14px;
	font-weight: 500;
}

.w2w-allen-chat__ai-terms-link a:hover {
	color: #29b6f6;
}

.w2w-allen-chat__checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	font-size: 13px;
	color: #ccc;
	cursor: pointer;
	line-height: 1.4;
}

.w2w-allen-chat__checkbox-label input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: #4fc3f7;
	margin-top: 2px;
	flex-shrink: 0;
}

.w2w-allen-chat__begin-button {
	background: #4fc3f7;
	color: #1a1e2e;
	border: none;
	padding: 14px 20px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.2s ease;
	margin-top: 8px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.w2w-allen-chat__begin-button:hover:not(:disabled) {
	background: #29b6f6;
	transform: translateY(-1px);
}

.w2w-allen-chat__begin-button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	background: #666;
}

.w2w-allen-chat__error-message {
	/* Same [hidden] override issue as .w2w-allen-chat__terms-overlay above. */
	display: none;
	align-items: center;
	gap: 8px;
	color: #e55263;
	font-size: 14px;
	background-color: rgba(229, 82, 99, 0.1);
	border: 1px solid rgba(229, 82, 99, 0.3);
	border-radius: 8px;
	padding: 12px;
	animation: w2w-allen-fade-in 0.3s ease;
}

.w2w-allen-chat__error-message:not([hidden]) {
	display: flex;
}

.w2w-allen-chat__error-message svg {
	flex-shrink: 0;
	color: #e55263;
}

@keyframes w2w-allen-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes w2w-allen-modal-slide-in {
	from { opacity: 0; transform: scale(0.9) translateY(20px); }
	to { opacity: 1; transform: scale(1) translateY(0); }
}
