/*
 * HospediaPro Chat Lite — front end.
 * Colors come from CSS variables set by the plugin (Customizer): --hpcl-btn-bg / --hpcl-btn-color.
 */

:root {
	--hpcl-btn-bg: #009944;
	--hpcl-btn-color: #ffffff;
	--hpcl-radius: 999px;
	--hpcl-z: 99990;
}

/* ---------- Floating button ---------- */

.hpcl-btn {
	position: fixed;
	bottom: calc(20px + var(--hpcl-btn-offset, 0px) + env(safe-area-inset-bottom, 0px));
	z-index: var(--hpcl-z);
	display: inline-flex;
	align-items: center;
	gap: 10px;
	max-width: calc(100vw - 32px);
	margin: 0;
	padding: 13px 20px;
	border: 0;
	border-radius: var(--hpcl-radius);
	background: var(--hpcl-btn-bg);
	color: var(--hpcl-btn-color);
	font: 600 15px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	text-decoration: none;
	cursor: pointer;
	box-shadow: 0 6px 16px rgba(0, 0, 0, .22), 0 2px 6px rgba(0, 0, 0, .16);
	transition: transform .15s ease, box-shadow .15s ease;
	-webkit-tap-highlight-color: transparent;
}

.hpcl-btn[data-position="bottom-right"] { right: calc(20px + env(safe-area-inset-right, 0px)); }
.hpcl-btn[data-position="bottom-left"]  { left: calc(20px + env(safe-area-inset-left, 0px)); }

.hpcl-btn:hover,
.hpcl-btn:focus-visible {
	color: var(--hpcl-btn-color);
	text-decoration: none;
}

.hpcl-btn:focus-visible,
.hpcl-submit:focus-visible,
.hpcl-close:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 3px;
}

.hpcl-btn-icon {
	display: inline-flex;
	font-size: 22px;
	line-height: 1;
}

.hpcl-btn-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.hpcl-svg {
	display: block;
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/* Animations (chosen in the Customizer). A soft, even shadow throughout — no hard-edged "lip". */
.hpcl-anim-push:hover  { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0, 0, 0, .26), 0 3px 8px rgba(0, 0, 0, .18); }
.hpcl-anim-push:active { transform: translateY(0);    box-shadow: 0 3px 8px rgba(0, 0, 0, .2), 0 1px 3px rgba(0, 0, 0, .14); }

@keyframes hpcl-pulse  { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes hpcl-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes hpcl-shake  { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes hpcl-glow {
	0%, 100% { box-shadow: 0 6px 16px rgba(0, 0, 0, .22), 0 0 0 0 var(--hpcl-btn-bg); }
	50%      { box-shadow: 0 6px 16px rgba(0, 0, 0, .22), 0 0 18px 4px var(--hpcl-btn-bg); }
}

.hpcl-anim-pulse  { animation: hpcl-pulse 1.6s ease-in-out infinite; }
.hpcl-anim-bounce { animation: hpcl-bounce 1.4s ease-in-out infinite; }
.hpcl-anim-shake  { animation: hpcl-shake 2s ease-in-out infinite; }
.hpcl-anim-glow   { animation: hpcl-glow 1.8s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
	.hpcl-btn[class*="hpcl-anim-"] { animation: none !important; }
	.hpcl-btn { transition: none; }
}

/* ---------- Modal ---------- */

html.hpcl-open { overflow: hidden; }

.hpcl-modal {
	width: min(460px, calc(100vw - 24px));
	max-height: calc(100vh - 24px);
	max-height: calc(100dvh - 24px);
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: 14px;
	background: #ffffff;
	color: #1f2937;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
	overflow: auto;
	font: 400 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.hpcl-modal::backdrop { background: rgba(15, 23, 42, .6); }

/* Fallback when <dialog>.showModal() is not available. */
.hpcl-modal[open]:not(:modal) {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: calc(var(--hpcl-z) + 1);
}

.hpcl-modal-box { position: relative; padding: 28px 24px 24px; }

.hpcl-close {
	position: absolute;
	top: 10px;
	right: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #6b7280;
	font-size: 18px;
	cursor: pointer;
}
.hpcl-close:hover { background: #f3f4f6; color: #111827; }

.hpcl-modal-title { margin: 0 32px 6px 0; font-size: 22px; line-height: 1.25; color: #111827; }
.hpcl-modal-subtitle { margin: 0 0 18px; color: #4b5563; }

.hpcl-field { margin: 0 0 14px; }
.hpcl-field label { display: block; margin: 0 0 4px; font-weight: 600; font-size: 14px; color: #111827; }

.hpcl-field input[type="text"],
.hpcl-field input[type="tel"],
.hpcl-field input[type="email"],
.hpcl-field select {
	display: block;
	width: 100%;
	box-sizing: border-box;
	min-height: 44px;
	padding: 10px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	background: #ffffff;
	color: #111827;
	font: inherit;
}

.hpcl-field input:focus,
.hpcl-field select:focus {
	border-color: var(--hpcl-btn-bg);
	outline: 2px solid var(--hpcl-btn-bg);
	outline-offset: 1px;
}

.hpcl-field [aria-invalid="true"] { border-color: #b91c1c; }

.hpcl-error { min-height: 0; margin: 4px 0 0; font-size: 13px; color: #b91c1c; }
.hpcl-error:empty { display: none; }

/* Honeypot: off-screen instead of display:none (bots skip display:none fields). */
.hpcl-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.hpcl-info { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 12px; font-size: 13px; color: #4b5563; }
.hpcl-info-icon { flex: 0 0 auto; margin-top: 3px; font-size: 14px; }
.hpcl-info a { color: inherit; text-decoration: underline; }

.hpcl-check { display: flex !important; gap: 10px; align-items: flex-start; font-weight: 400 !important; font-size: 14px !important; }
.hpcl-check input { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--hpcl-btn-bg); }

.hpcl-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 48px;
	padding: 12px 18px;
	border: 0;
	border-radius: 10px;
	background: var(--hpcl-btn-bg);
	color: var(--hpcl-btn-color);
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
}
.hpcl-submit .hpcl-svg { font-size: 20px; }
.hpcl-submit:disabled { opacity: .7; cursor: progress; }

.hpcl-status { margin: 10px 0 0; font-size: 13px; color: #92400e; }
.hpcl-status:empty { display: none; }

.hpcl-success { padding: 12px 0 4px; text-align: center; }
.hpcl-success[hidden] { display: none; }
.hpcl-success-icon { margin: 0 auto 8px; font-size: 48px; color: var(--hpcl-btn-bg); }
.hpcl-icon-warn { display: none; color: #b45309; }
.hpcl-success--warning .hpcl-icon-ok { display: none; }
.hpcl-success--warning .hpcl-icon-warn { display: block; }
.hpcl-success-text { margin: 0 0 12px; font-size: 16px; color: #111827; }
.hpcl-again { font-size: 14px; color: #1f2937; text-decoration: underline; }

@media (max-width: 480px) {
	.hpcl-btn { padding: 12px 16px; font-size: 14px; }
	.hpcl-modal { border-radius: 12px; }
	.hpcl-modal-box { padding: 24px 18px 18px; }
}
