/*
 * Hammer & Ledger Tax — Chat Widget Styles
 * Version: 1.0.0
 * Colors are overridden by CSS custom properties injected from PHP settings.
 */

/* =========================================================================
   CSS CUSTOM PROPERTIES (fallback defaults, overridden via inline style)
   ========================================================================= */
:root {
	--hlc-primary:        #1a2e44;
	--hlc-primary-dark:   #0f1d2b;
	--hlc-primary-light:  #253f5e;
	--hlc-accent:         #B4E718;
	--hlc-accent-hover:   #9fce12;
	--hlc-bg:             #ffffff;
	--hlc-bg-alt:         #f4f6f9;
	--hlc-text:           #1a1a2e;
	--hlc-text-muted:     #6b7280;
	--hlc-border:         #e2e8f0;
	--hlc-shadow:         0 8px 32px rgba(0,0,0,0.18);
	--hlc-shadow-sm:      0 2px 8px rgba(0,0,0,0.10);
	--hlc-radius:         14px;
	--hlc-radius-sm:      8px;
	--hlc-radius-pill:    50px;
	--hlc-font:           'Segoe UI', system-ui, -apple-system, sans-serif;
	--hlc-transition:     all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
	--hlc-widget-width:   370px;
	--hlc-widget-height:  540px;
}

/* =========================================================================
   LAUNCHER BUTTON
   ========================================================================= */
.hlc-launcher {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 99998;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 20px 12px 16px;
	background: var(--hlc-accent);
	color: var(--hlc-primary-dark);
	border: none;
	border-radius: var(--hlc-radius-pill);
	cursor: pointer;
	font-family: var(--hlc-font);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.01em;
	box-shadow: 0 8px 22px rgba(180, 231, 24, 0.32);
	transition: var(--hlc-transition);
	outline: none;
}

.hlc-launcher:hover {
	background: var(--hlc-accent-hover);
	transform: translateY(-2px);
	box-shadow: 0 10px 26px rgba(180, 231, 24, 0.38);
}

.hlc-launcher:focus-visible {
	outline: 3px solid var(--hlc-accent);
	outline-offset: 3px;
}

.hlc-launcher-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	transition: var(--hlc-transition);
}

.hlc-launcher.is-open .hlc-launcher-icon svg {
	/* Swap to close icon when open via JS */
	opacity: 0.85;
}

/* Pulse ring animation on launcher */
.hlc-launcher::before {
	content: '';
	position: absolute;
	inset: -4px;
	border-radius: var(--hlc-radius-pill);
	background: var(--hlc-accent);
	opacity: 0;
	animation: hlc-pulse 3s ease-out 2s infinite;
}

@keyframes hlc-pulse {
	0%   { transform: scale(1);   opacity: 0.4; }
	70%  { transform: scale(1.15); opacity: 0;   }
	100% { transform: scale(1.15); opacity: 0;   }
}

/* Hide pulse after first interaction */
.hlc-launcher.has-opened::before {
	display: none;
}

/* =========================================================================
   CHAT WIDGET CONTAINER
   ========================================================================= */
.hlc-widget {
	position: fixed;
	bottom: 88px;
	right: 24px;
	z-index: 99999;
	width: var(--hlc-widget-width);
	max-height: var(--hlc-widget-height);
	background: var(--hlc-bg);
	border-radius: var(--hlc-radius);
	box-shadow: var(--hlc-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	font-family: var(--hlc-font);
	transform-origin: bottom right;
	transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
}

.hlc-widget[hidden] {
	display: none !important;
}

/* Open animation: scale in from bottom-right */
.hlc-widget.is-opening {
	animation: hlc-open 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes hlc-open {
	from { transform: scale(0.6) translateY(30px); opacity: 0; }
	to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

/* =========================================================================
   HEADER
   ========================================================================= */
.hlc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: var(--hlc-accent);
	color: var(--hlc-primary-dark);
	flex-shrink: 0;
}

.hlc-header-info {
	display: flex;
	align-items: center;
	gap: 10px;
}

.hlc-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--hlc-accent);
	color: var(--hlc-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	font-weight: 800;
	flex-shrink: 0;
}

.hlc-title {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
}

.hlc-status {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 11px;
	opacity: 0.85;
	margin-top: 2px;
}

.hlc-status-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #4ade80;
	flex-shrink: 0;
	animation: hlc-blink 2s ease infinite;
}

@keyframes hlc-blink {
	0%, 100% { opacity: 1; }
	50%       { opacity: 0.5; }
}

.hlc-close-btn {
	background: none;
	border: none;
	cursor: pointer;
	color: rgba(255,255,255,0.75);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 4px;
	border-radius: 6px;
	transition: var(--hlc-transition);
}

.hlc-close-btn:hover {
	color: #ffffff;
	background: rgba(255,255,255,0.15);
}

.hlc-close-btn:focus-visible {
	outline: 2px solid var(--hlc-accent);
}

/* =========================================================================
   BODY (scrollable messages area)
   ========================================================================= */
.hlc-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	scroll-behavior: smooth;
}

/* Custom scrollbar */
.hlc-body::-webkit-scrollbar {
	width: 5px;
}
.hlc-body::-webkit-scrollbar-track {
	background: transparent;
}
.hlc-body::-webkit-scrollbar-thumb {
	background: var(--hlc-border);
	border-radius: 3px;
}

/* =========================================================================
   MESSAGE BUBBLES
   ========================================================================= */
.hlc-message {
	display: flex;
	flex-direction: column;
	max-width: 88%;
	animation: hlc-msg-in 0.25s ease forwards;
}

@keyframes hlc-msg-in {
	from { transform: translateY(10px); opacity: 0; }
	to   { transform: translateY(0);    opacity: 1; }
}

/* Bot messages — left aligned */
.hlc-message.hlc-bot {
	align-self: flex-start;
}

.hlc-message.hlc-bot .hlc-bubble {
	background: var(--hlc-bg-alt);
	color: var(--hlc-text);
	border-radius: 4px 14px 14px 14px;
}

/* User messages — right aligned */
.hlc-message.hlc-user {
	align-self: flex-end;
}

.hlc-message.hlc-user .hlc-bubble {
	background: var(--hlc-accent);
	color: var(--hlc-primary-dark);
	border-radius: 14px 14px 4px 14px;
}

.hlc-bubble {
	padding: 10px 14px;
	font-size: 13.5px;
	line-height: 1.55;
	white-space: pre-wrap;
	word-break: break-word;
	box-shadow: var(--hlc-shadow-sm);
}

.hlc-bubble strong {
	font-weight: 700;
}

/* =========================================================================
   QUICK REPLY BUTTONS
   ========================================================================= */
.hlc-quick-replies {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-self: stretch;
	animation: hlc-msg-in 0.3s ease 0.1s both;
}

.hlc-qr-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	background: #ffffff;
	border: 1.5px solid var(--hlc-primary);
	border-radius: var(--hlc-radius-sm);
	color: var(--hlc-primary);
	font-family: var(--hlc-font);
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	text-align: left;
	transition: var(--hlc-transition);
}

.hlc-qr-btn:hover,
.hlc-qr-btn:focus-visible {
	background: var(--hlc-accent);
	color: var(--hlc-primary-dark);
	transform: translateX(3px);
	outline: none;
}

.hlc-qr-btn:focus-visible {
	outline: 2px solid var(--hlc-accent);
	outline-offset: 2px;
}

.hlc-qr-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--hlc-accent);
	color: var(--hlc-primary);
	font-size: 11px;
	font-weight: 800;
	flex-shrink: 0;
	transition: var(--hlc-transition);
}

.hlc-qr-btn:hover .hlc-qr-num {
	background: #ffffff;
}

/* =========================================================================
   FORM INSIDE WIDGET
   ========================================================================= */
.hlc-form-wrap {
	animation: hlc-msg-in 0.25s ease forwards;
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-self: stretch;
}

.hlc-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.hlc-field label {
	font-size: 12px;
	font-weight: 600;
	color: var(--hlc-text-muted);
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

.hlc-field input[type="text"],
.hlc-field input[type="email"],
.hlc-field input[type="tel"],
.hlc-field select,
.hlc-field textarea {
	width: 100%;
	padding: 9px 12px;
	border: 1.5px solid var(--hlc-border);
	border-radius: var(--hlc-radius-sm);
	font-family: var(--hlc-font);
	font-size: 13.5px;
	color: var(--hlc-text);
	background: #fff;
	transition: border-color 0.18s ease;
	outline: none;
	box-sizing: border-box;
}

.hlc-field input:focus,
.hlc-field select:focus,
.hlc-field textarea:focus {
	border-color: var(--hlc-primary);
	box-shadow: 0 0 0 3px rgba(26,46,68,0.08);
}

.hlc-field textarea {
	resize: vertical;
	min-height: 64px;
}

.hlc-radio-group {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.hlc-radio-label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 500;
	color: var(--hlc-text);
	cursor: pointer;
	padding: 7px 12px;
	border: 1.5px solid var(--hlc-border);
	border-radius: var(--hlc-radius-sm);
	transition: var(--hlc-transition);
}

.hlc-radio-label:has(input:checked) {
	border-color: var(--hlc-primary);
	background: var(--hlc-bg-alt);
}

.hlc-radio-label input[type="radio"] {
	accent-color: var(--hlc-primary);
}

/* Submit button */
.hlc-submit-btn {
	padding: 11px 16px;
	background: var(--hlc-accent);
	color: var(--hlc-primary);
	font-family: var(--hlc-font);
	font-size: 14px;
	font-weight: 700;
	border: none;
	border-radius: var(--hlc-radius-sm);
	cursor: pointer;
	transition: var(--hlc-transition);
	letter-spacing: 0.02em;
	margin-top: 4px;
}

.hlc-submit-btn:hover {
	background: var(--hlc-accent-hover);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(232, 160, 32, 0.4);
}

.hlc-submit-btn:disabled {
	opacity: 0.65;
	cursor: not-allowed;
	transform: none;
}

.hlc-submit-btn:focus-visible {
	outline: 3px solid var(--hlc-primary);
	outline-offset: 2px;
}

/* Field validation state */
.hlc-field input.hlc-invalid,
.hlc-field select.hlc-invalid {
	border-color: #ef4444;
}

/* =========================================================================
   ERROR / SUCCESS MESSAGES
   ========================================================================= */
.hlc-error-msg {
	font-size: 12.5px;
	color: #dc2626;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: var(--hlc-radius-sm);
	padding: 8px 12px;
	animation: hlc-msg-in 0.2s ease forwards;
}

.hlc-success-bubble .hlc-bubble {
	background: #f0fdf4;
	border: 1.5px solid #bbf7d0;
	color: #166534;
}

/* =========================================================================
   WHATSAPP CTA BUTTON
   ========================================================================= */
.hlc-whatsapp-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 16px;
	background: #25d366;
	color: #ffffff;
	font-family: var(--hlc-font);
	font-size: 13.5px;
	font-weight: 700;
	border: none;
	border-radius: var(--hlc-radius-sm);
	cursor: pointer;
	text-decoration: none;
	transition: var(--hlc-transition);
	animation: hlc-msg-in 0.3s ease 0.2s both;
	align-self: flex-start;
}

.hlc-whatsapp-btn:hover {
	background: #1fb855;
	transform: translateY(-1px);
	box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
}

.hlc-whatsapp-btn svg {
	flex-shrink: 0;
}

/* =========================================================================
   TYPING INDICATOR
   ========================================================================= */
.hlc-typing {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 12px 16px;
	background: var(--hlc-bg-alt);
	border-radius: 4px 14px 14px 14px;
	width: fit-content;
	animation: hlc-msg-in 0.2s ease forwards;
}

.hlc-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--hlc-text-muted);
	animation: hlc-dot 1.2s ease infinite;
}

.hlc-typing span:nth-child(2) { animation-delay: 0.2s; }
.hlc-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes hlc-dot {
	0%, 60%, 100% { transform: translateY(0);  opacity: 0.5; }
	30%            { transform: translateY(-4px); opacity: 1;   }
}

/* =========================================================================
   FOOTER
   ========================================================================= */
.hlc-footer {
	padding: 8px 16px;
	border-top: 1px solid var(--hlc-border);
	text-align: center;
	flex-shrink: 0;
}

.hlc-footer-text {
	font-size: 11px;
	color: var(--hlc-text-muted);
	margin: 0;
}

/* =========================================================================
   RESPONSIVE — MOBILE
   ========================================================================= */
@media (max-width: 480px) {
	:root {
		--hlc-widget-width:  min(100vw - 24px, 420px);
		--hlc-widget-height: min(100dvh - 24px, 720px);
	}

	.hlc-widget {
		bottom: 12px;
		right: 12px;
		left: 12px;
		width: auto;
		border-radius: var(--hlc-radius);
		max-height: calc(100dvh - 24px);
	}

	.hlc-launcher {
		bottom: 16px;
		right: 16px;
	}
}

/* =========================================================================
   UTILITY
   ========================================================================= */
.hlc-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0,0,0,0);
	white-space: nowrap;
	border: 0;
}

/* Optional field note */
.hlc-optional-note {
	font-size: 11px;
	color: var(--hlc-text-muted);
	margin: 0 0 8px;
}
