/* Zelthra AI Chatbot — widget styles. Self-contained, scoped under
   #zac-widget-root so it can't leak into or be leaked into by the host
   site's own CSS. */

#zac-widget-root {
	--zac-primary: #C9A24B;
	--zac-primary-ink: #0F1720;
	--zac-bg: #ffffff;
	--zac-bg-alt: #FAFAF7;
	--zac-ink: #14181F;
	--zac-ink-soft: #52565F;
	--zac-border: #E6E4DE;
	--zac-radius: 16px;
	--zac-radius-sm: 8px;
	--zac-shadow: 0 20px 60px rgba(15, 23, 32, 0.16);
	--zac-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--zac-font-display: 'Space Grotesk', var(--zac-font);

	position: fixed;
	z-index: 999999;
	font-family: var(--zac-font);
	box-sizing: border-box;
}
#zac-widget-root *, #zac-widget-root *::before, #zac-widget-root *::after {
	box-sizing: border-box;
}
#zac-widget-root[data-theme="dark"] {
	--zac-bg: #161B22;
	--zac-bg-alt: #0B0F14;
	--zac-ink: #F5F1E6;
	--zac-ink-soft: #ABA79C;
	--zac-border: rgba(255,255,255,0.1);
	--zac-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.zac-position-bottom-right { bottom: 20px; right: 20px; }
.zac-position-bottom-left { bottom: 20px; left: 20px; }

/* ---------- Launcher button ---------- */
.zac-launcher {
	width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
	background: var(--zac-primary); color: var(--zac-primary-ink);
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 10px 30px rgba(0,0,0,0.25);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	position: relative;
}
.zac-launcher:hover { transform: scale(1.06); box-shadow: 0 14px 36px rgba(0,0,0,0.3); }
.zac-launcher__badge {
	position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px;
	border-radius: 10px; background: #EF4444; color: #fff; font-size: 0.68rem; font-weight: 700;
	display: none; align-items: center; justify-content: center; line-height: 1;
	border: 2px solid var(--zac-bg); box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.zac-launcher__badge.is-visible { display: flex; }
.zac-launcher__icon-chat, .zac-launcher__icon-close {
	position: absolute; width: 26px; height: 26px;
	transition: opacity 0.2s ease, transform 0.2s ease;
}
.zac-launcher__icon-chat svg, .zac-launcher__icon-close svg { width: 100%; height: 100%; }
.zac-launcher__icon-close { opacity: 0; transform: scale(0.6) rotate(-45deg); }
#zac-widget-root.is-open .zac-launcher__icon-chat { opacity: 0; transform: scale(0.6) rotate(45deg); }
#zac-widget-root.is-open .zac-launcher__icon-close { opacity: 1; transform: scale(1) rotate(0deg); }

/* ---------- Panel ---------- */
.zac-panel {
	position: absolute; bottom: 76px; right: 0;
	width: 380px; max-width: calc(100vw - 40px);
	height: 600px; max-height: calc(100vh - 120px);
	background: var(--zac-bg); border-radius: var(--zac-radius); box-shadow: var(--zac-shadow);
	border: 1px solid var(--zac-border);
	display: flex; flex-direction: column; overflow: hidden;
	opacity: 0; visibility: hidden; transform: translateY(16px) scale(0.98);
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
}
.zac-position-bottom-left .zac-panel { right: auto; left: 0; }
#zac-widget-root.is-open .zac-panel {
	opacity: 1; visibility: visible; transform: translateY(0) scale(1);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.zac-panel__header {
	display: flex; align-items: center; justify-content: space-between;
	padding: 16px 18px; background: var(--zac-primary); color: var(--zac-primary-ink); flex-shrink: 0;
}
.zac-panel__header-info { display: flex; flex-direction: column; gap: 2px; }
.zac-panel__title { font-family: var(--zac-font-display); font-weight: 600; font-size: 1rem; }
.zac-panel__status { font-size: 0.76rem; opacity: 0.75; display: flex; align-items: center; gap: 6px; }
.zac-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #1a7a3d; display: inline-block; }
.zac-panel__header-actions { display: flex; gap: 6px; }
.zac-panel__theme-toggle, .zac-panel__minimize {
	width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer;
	background: rgba(15,23,32,0.12); color: var(--zac-primary-ink);
	display: flex; align-items: center; justify-content: center;
	transition: background 0.2s ease;
}
.zac-panel__theme-toggle:hover, .zac-panel__minimize:hover { background: rgba(15,23,32,0.22); }
.zac-panel__theme-toggle svg, .zac-panel__minimize svg { width: 16px; height: 16px; }

.zac-panel__messages {
	flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px;
	background: var(--zac-bg-alt);
}

.zac-message { display: flex; flex-direction: column; gap: 6px; max-width: 88%; }
.zac-message--user { align-self: flex-end; align-items: flex-end; }
.zac-message--assistant { align-self: flex-start; align-items: flex-start; }
.zac-message__content {
	padding: 10px 14px; border-radius: 14px; font-size: 0.9rem; line-height: 1.55;
	word-wrap: break-word; overflow-wrap: break-word;
}
.zac-message--user .zac-message__content { background: var(--zac-primary); color: var(--zac-primary-ink); border-bottom-right-radius: 4px; }
.zac-message--assistant .zac-message__content { background: var(--zac-bg); color: var(--zac-ink); border: 1px solid var(--zac-border); border-bottom-left-radius: 4px; }
.zac-message__content code {
	background: rgba(0,0,0,0.08); padding: 2px 5px; border-radius: 4px; font-size: 0.85em;
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.zac-message--user .zac-message__content code { background: rgba(15,23,32,0.12); }
.zac-message__content a { color: inherit; text-decoration: underline; }

.zac-codeblock { margin: 8px 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--zac-border); }
.zac-codeblock__bar {
	display: flex; align-items: center; justify-content: space-between;
	padding: 6px 10px; background: rgba(0,0,0,0.06);
	font-size: 0.72rem; font-family: ui-monospace, monospace; color: var(--zac-ink-soft);
}
.zac-codeblock__copy {
	border: none; background: none; cursor: pointer; color: var(--zac-primary);
	font-size: 0.72rem; font-weight: 600;
}
.zac-codeblock pre {
	margin: 0; padding: 10px 12px; overflow-x: auto;
	background: #16152B; color: #F1F0FA; font-size: 0.82rem; line-height: 1.5;
}
.zac-codeblock code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: none; padding: 0; }

.zac-message__actions { display: flex; gap: 4px; }
.zac-message__action {
	width: 26px; height: 26px; border-radius: 6px; border: none; cursor: pointer;
	background: transparent; color: var(--zac-ink-soft);
	display: flex; align-items: center; justify-content: center;
	transition: background 0.2s ease, color 0.2s ease;
}
.zac-message__action svg { width: 14px; height: 14px; }
.zac-message__action:hover { background: var(--zac-bg-alt); color: var(--zac-ink); }
.zac-message__action.is-active { color: var(--zac-primary); background: var(--zac-bg-alt); }

/* ---------- Quick replies ---------- */
.zac-quick-replies { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 2px; }
.zac-quick-reply {
	border: 1px solid var(--zac-border); border-radius: 999px; padding: 7px 14px;
	background: var(--zac-bg); color: var(--zac-primary); font-size: 0.82rem; font-weight: 600;
	cursor: pointer; transition: background 0.2s ease, transform 0.15s ease;
}
.zac-quick-reply:hover { background: var(--zac-bg-alt); transform: translateY(-1px); }

.zac-typing { display: flex; gap: 4px; padding: 6px 4px; }
.zac-typing span {
	width: 6px; height: 6px; border-radius: 50%; background: var(--zac-ink-soft);
	animation: zac-typing-bounce 1.1s infinite ease-in-out;
}
.zac-typing span:nth-child(2) { animation-delay: 0.15s; }
.zac-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes zac-typing-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

.zac-panel__inputbar {
	display: flex; align-items: flex-end; gap: 8px; padding: 12px;
	border-top: 1px solid var(--zac-border); background: var(--zac-bg); flex-shrink: 0;
}
.zac-panel__input {
	flex: 1; resize: none; border: 1px solid var(--zac-border); border-radius: 12px;
	padding: 10px 12px; font-size: 0.9rem; font-family: inherit; color: var(--zac-ink);
	background: var(--zac-bg-alt); max-height: 120px; line-height: 1.4;
}
.zac-panel__input:focus { outline: none; border-color: var(--zac-primary); }
.zac-panel__send {
	width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer; flex-shrink: 0;
	background: var(--zac-primary); color: var(--zac-primary-ink);
	display: flex; align-items: center; justify-content: center;
	transition: opacity 0.2s ease, transform 0.2s ease;
}
.zac-panel__send svg { width: 16px; height: 16px; }
.zac-panel__send:hover { transform: scale(1.05); }
.zac-panel__send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------- Lead capture form ---------- */
.zac-lead-form { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.zac-lead-form__intro { font-size: 0.86rem; color: var(--zac-ink); margin: 0 0 4px; }
.zac-lead-form__input {
	border: 1px solid var(--zac-border); border-radius: 10px; padding: 9px 12px;
	font-size: 0.86rem; font-family: inherit; background: var(--zac-bg); color: var(--zac-ink);
}
.zac-lead-form__input:focus { outline: none; border-color: var(--zac-primary); }
.zac-lead-form__submit {
	border: none; border-radius: 10px; padding: 10px; margin-top: 4px; cursor: pointer;
	background: var(--zac-primary); color: var(--zac-primary-ink); font-weight: 600; font-size: 0.86rem;
}
.zac-lead-form__submit:disabled { opacity: 0.6; cursor: not-allowed; }
.zac-lead-form__status { font-size: 0.78rem; color: #EF4444; min-height: 1em; }
.zac-lead-form__success { font-size: 0.9rem; color: var(--zac-ink); margin: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
	.zac-panel {
		width: calc(100vw - 24px); height: calc(100vh - 100px);
		bottom: 76px; right: 12px;
	}
	.zac-position-bottom-left .zac-panel { left: 12px; }
	.zac-position-bottom-right { right: 12px; bottom: 12px; }
	.zac-position-bottom-left { left: 12px; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
	.zac-launcher, .zac-panel, .zac-launcher__icon-chat, .zac-launcher__icon-close,
	.zac-panel__theme-toggle, .zac-panel__minimize, .zac-panel__send, .zac-typing span {
		transition: none !important; animation: none !important;
	}
}
