/**
 * Authorie chat widget styles.
 *
 * Visual language mirrors the Authorie assistant chat in the Authora Sales
 * Dashboard (AssistantChat.tsx):
 *  - header          : #071D4C with Chat-background.svg, avatar + name + "online"
 *  - surface         : #fcfcfb, wash #f1f1ef, ink #0b0b0b, muted #898781
 *  - user bubbles    : #2a78d6 with white text
 *  - brand gradient  : linear-gradient(135deg, #F4B6B5 0%, #9C96F2 100%)
 *
 * Every selector is prefixed with the #authorie-widget ID and critical
 * visual properties carry !important, so Elementor/theme globals (button,
 * input, img rules) can never restyle the widget.
 */

#authorie-widget,
#authorie-widget * {
	box-sizing: border-box !important;
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
	text-transform: none !important;
	letter-spacing: normal !important;
}

#authorie-widget img {
	max-width: none !important;
	border: 0;
	display: block;
}

#authorie-widget button {
	-webkit-appearance: none !important;
	appearance: none !important;
	text-decoration: none !important;
	text-shadow: none !important;
}

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

#authorie-widget .authorie-toggle {
	position: fixed !important;
	right: 24px !important;
	bottom: 24px !important;
	left: auto !important;
	top: auto !important;
	z-index: 999990 !important;
	width: 60px !important;
	height: 60px !important;
	min-height: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: linear-gradient(135deg, #F4B6B5 0%, #9C96F2 100%) !important;
	color: #ffffff !important;
	cursor: pointer;
	display: flex !important;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 24px rgba(7, 29, 76, 0.35) !important;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#authorie-widget .authorie-toggle:hover,
#authorie-widget .authorie-toggle:focus-visible {
	transform: scale(1.06);
	background: linear-gradient(135deg, #F4B6B5 0%, #9C96F2 100%) !important;
	box-shadow: 0 10px 28px rgba(7, 29, 76, 0.45) !important;
}

#authorie-widget .authorie-toggle-icon {
	width: 28px !important;
	height: 28px !important;
}

/* One short attention wiggle, triggered by JS ~10s after arrival. */
@keyframes authorie-wiggle {
	0%, 100% { transform: rotate(0deg); }
	15% { transform: rotate(-14deg); }
	35% { transform: rotate(11deg); }
	55% { transform: rotate(-7deg); }
	75% { transform: rotate(4deg); }
}

#authorie-widget .authorie-toggle.authorie-wiggle {
	animation: authorie-wiggle 0.9s ease-in-out 1;
}

/* Badge: red circle with "1". Hidden on arrival; JS pops it in after ~5s
   (like a message arriving just now) and it then stays visible, also
   after the chat has been opened. */
#authorie-widget .authorie-badge {
	position: absolute !important;
	top: -2px !important;
	right: -2px !important;
	min-width: 20px !important;
	height: 20px !important;
	padding: 0 5px !important;
	border-radius: 10px !important;
	background: #E53E3E !important;
	color: #fff !important;
	font-size: 12px !important;
	font-weight: 700 !important;
	line-height: 20px !important;
	text-align: center !important;
	display: none !important;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

@keyframes authorie-badge-pop {
	0% { transform: scale(0); }
	70% { transform: scale(1.3); }
	100% { transform: scale(1); }
}

#authorie-widget.authorie-has-badge .authorie-badge {
	display: block !important;
	animation: authorie-badge-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) 1;
}

/* ---------- Panel ---------- */

#authorie-widget .authorie-panel {
	position: fixed !important;
	right: 24px !important;
	bottom: 96px !important;
	left: auto !important;
	top: auto !important;
	z-index: 999991 !important;
	display: flex !important;
	flex-direction: column !important;
	/* Min. 400px wide on desktop: required for the Calendly inline embed. */
	width: min(420px, calc(100vw - 48px)) !important;
	min-width: 400px !important;
	height: min(640px, calc(100vh - 120px)) !important;
	background: #fcfcfb !important;
	color: #0b0b0b !important;
	border: 1px solid rgba(11, 11, 11, 0.1) !important;
	border-radius: 16px !important;
	overflow: hidden !important;
	box-shadow: 0 16px 48px rgba(7, 29, 76, 0.25) !important;
	font-size: 14px !important;
	line-height: 1.5 !important;
	text-align: left !important;
}

#authorie-widget .authorie-panel[hidden] {
	display: none !important;
}

/* ---------- Header: avatar + name + online (dashboard chat header) ---------- */

#authorie-widget .authorie-header {
	display: flex !important;
	align-items: center !important;
	gap: 12px !important;
	padding: 12px 16px !important;
	background-color: #071D4C !important;
	background-image: url("../img/Chat-background.svg") !important;
	background-position: right center !important;
	background-size: cover !important;
	background-repeat: no-repeat !important;
	flex: 0 0 auto !important;
}

#authorie-widget .authorie-header-avatar {
	width: 36px !important;
	height: 36px !important;
	border-radius: 50% !important;
	object-fit: cover !important;
	flex: 0 0 auto !important;
}

#authorie-widget .authorie-header-info {
	display: flex !important;
	flex-direction: column !important;
	min-width: 0 !important;
	flex: 1 1 auto !important;
	gap: 1px !important;
}

#authorie-widget .authorie-header-title {
	font-weight: 600 !important;
	font-size: 14px !important;
	line-height: 1.25 !important;
	color: #fff !important;
}

#authorie-widget .authorie-header-status {
	display: inline-flex !important;
	align-items: center !important;
	gap: 6px !important;
	font-size: 11px !important;
	line-height: 1.3 !important;
	color: rgba(255, 255, 255, 0.85) !important;
}

#authorie-widget .authorie-header-dot {
	width: 6px !important;
	height: 6px !important;
	border-radius: 50% !important;
	background: #4ade80 !important;
	display: inline-block !important;
}

/* Restart ("new conversation") button, like the redo button in the
   dashboard chat header. */
#authorie-widget .authorie-restart {
	border: 0 !important;
	background: transparent !important;
	color: rgba(255, 255, 255, 0.85) !important;
	cursor: pointer;
	width: 32px !important;
	height: 32px !important;
	min-height: 0 !important;
	padding: 0 !important;
	border-radius: 50% !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	box-shadow: none !important;
	flex: 0 0 auto !important;
}

#authorie-widget .authorie-restart svg {
	width: 15px !important;
	height: 15px !important;
}

#authorie-widget .authorie-restart:hover,
#authorie-widget .authorie-restart:focus-visible {
	background: rgba(255, 255, 255, 0.12) !important;
	color: #fff !important;
}

#authorie-widget .authorie-close {
	border: 0 !important;
	background: transparent !important;
	color: rgba(255, 255, 255, 0.85) !important;
	font-size: 26px !important;
	line-height: 1 !important;
	cursor: pointer;
	padding: 0 4px !important;
	min-height: 0 !important;
	box-shadow: none !important;
	flex: 0 0 auto !important;
}

#authorie-widget .authorie-close:hover,
#authorie-widget .authorie-close:focus-visible {
	background: transparent !important;
	color: #fff !important;
}

/* ---------- Messages ---------- */

#authorie-widget .authorie-messages {
	flex: 1 1 auto !important;
	overflow-y: auto !important;
	padding: 16px !important;
	display: flex !important;
	flex-direction: column !important;
	gap: 12px !important;
	background: #f1f1ef !important;
	scroll-behavior: smooth;
}

/* Bot row: avatar next to the bubble, like the dashboard chat. */
#authorie-widget .authorie-row {
	display: flex !important;
	align-items: flex-end !important;
	gap: 8px !important;
	max-width: 100% !important;
}

#authorie-widget .authorie-avatar {
	width: 32px !important;
	height: 32px !important;
	border-radius: 50% !important;
	border: 1px solid rgba(11, 11, 11, 0.1) !important;
	object-fit: cover !important;
	flex: 0 0 auto !important;
}

#authorie-widget .authorie-msg {
	max-width: 80% !important;
	padding: 10px 14px !important;
	border-radius: 16px !important;
	white-space: pre-wrap !important;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	font-size: 14px !important;
	line-height: 1.55 !important;
}

#authorie-widget .authorie-msg--bot {
	background: #fcfcfb !important;
	color: #0b0b0b !important;
	border-bottom-left-radius: 6px !important;
	box-shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 2px 6px rgba(11, 11, 11, 0.06) !important;
}

#authorie-widget .authorie-msg--user {
	align-self: flex-end !important;
	background: #9c96f2 !important;
	color: #fff !important;
	border-bottom-right-radius: 6px !important;
	box-shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 2px 6px rgba(11, 11, 11, 0.06) !important;
}

#authorie-widget .authorie-msg--error {
	background: #fdf1f1 !important;
	color: #0b0b0b !important;
	border: 1px solid #d03b3b !important;
}

#authorie-widget .authorie-msg a {
	color: #2a78d6 !important;
	text-decoration: underline !important;
}

/* Typing indicator */
#authorie-widget .authorie-typing {
	display: inline-flex !important;
	gap: 4px !important;
	padding: 14px !important;
	background: #fcfcfb !important;
	border-radius: 16px !important;
	border-bottom-left-radius: 6px !important;
	box-shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 2px 6px rgba(11, 11, 11, 0.06) !important;
}

#authorie-widget .authorie-typing span {
	width: 7px !important;
	height: 7px !important;
	border-radius: 50% !important;
	background: #9C96F2 !important;
	animation: authorie-blink 1.2s infinite ease-in-out;
}

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

@keyframes authorie-blink {
	0%, 80%, 100% { opacity: 0.25; }
	40% { opacity: 1; }
}

/* ---------- Choice buttons & consent ---------- */

/* Indented to align under the avatar, like the quick questions in the
   dashboard chat. */
#authorie-widget .authorie-choices {
	display: flex !important;
	flex-direction: column !important;
	gap: 8px !important;
	align-self: flex-start !important;
	align-items: flex-start !important;
	max-width: 85% !important;
	margin-left: 40px !important;
}

/* Pill with brand gradient border (border-box trick from the dashboard). */
#authorie-widget .authorie-choice {
	border: 1.5px solid transparent !important;
	border-radius: 999px !important;
	padding: 9px 16px !important;
	min-height: 0 !important;
	background-image: linear-gradient(#fcfcfb, #fcfcfb), linear-gradient(135deg, #F4B6B5 0%, #9C96F2 100%) !important;
	background-origin: border-box !important;
	background-clip: padding-box, border-box !important;
	color: #0b0b0b !important;
	font-size: 13px !important;
	font-weight: 500 !important;
	line-height: 1.4 !important;
	cursor: pointer;
	text-align: left !important;
	box-shadow: none !important;
	transition: background-image 0.15s ease, color 0.15s ease;
}

#authorie-widget .authorie-choice:hover,
#authorie-widget .authorie-choice:focus-visible {
	background-image: linear-gradient(135deg, #F4B6B5 0%, #9C96F2 100%), linear-gradient(135deg, #F4B6B5 0%, #9C96F2 100%) !important;
	color: #ffffff !important;
}

#authorie-widget .authorie-choices[data-done="1"] .authorie-choice {
	opacity: 0.45 !important;
	pointer-events: none !important;
}

#authorie-widget .authorie-consent {
	align-self: flex-start !important;
	max-width: 85% !important;
	margin-left: 40px !important;
	background: #fcfcfb !important;
	border-radius: 16px !important;
	border-bottom-left-radius: 6px !important;
	box-shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 2px 6px rgba(11, 11, 11, 0.06) !important;
	padding: 12px 14px !important;
	display: flex !important;
	flex-direction: column !important;
	gap: 10px !important;
}

#authorie-widget .authorie-consent label {
	display: flex !important;
	gap: 10px !important;
	align-items: flex-start !important;
	cursor: pointer;
	font-size: 13px !important;
	line-height: 1.5 !important;
	color: #0b0b0b !important;
}

#authorie-widget .authorie-consent input[type="checkbox"] {
	-webkit-appearance: checkbox !important;
	appearance: checkbox !important;
	margin: 3px 0 0 !important;
	width: 16px !important;
	height: 16px !important;
	accent-color: #2a78d6 !important;
	flex: 0 0 auto !important;
	opacity: 1 !important;
	position: static !important;
}

#authorie-widget .authorie-consent a {
	color: #2a78d6 !important;
	text-decoration: underline !important;
}

#authorie-widget .authorie-consent .authorie-choice {
	align-self: flex-start !important;
}

/* ---------- Calendly embed ---------- */

#authorie-widget .authorie-booking {
	align-self: stretch !important;
	background: #fff !important;
	border-radius: 12px !important;
	overflow: hidden !important;
	min-height: 520px !important;
	box-shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 2px 6px rgba(11, 11, 11, 0.06) !important;
}

#authorie-widget .authorie-booking .calendly-inline-widget {
	min-width: 320px !important;
	height: 520px !important;
}

/* ---------- Input row ---------- */

/* Dashboard look: pill input with the send icon sitting inside the
   field on the right (ghost button, no circle). */
#authorie-widget .authorie-input-row {
	position: relative !important;
	display: flex !important;
	align-items: center !important;
	padding: 12px !important;
	background: #fcfcfb !important;
	border-top: 1px solid rgba(11, 11, 11, 0.1) !important;
	flex: 0 0 auto !important;
	margin: 0 !important;
}

#authorie-widget .authorie-input {
	flex: 1 1 auto !important;
	width: 100% !important;
	min-height: 40px !important;
	border: 1px solid rgba(11, 11, 11, 0.1) !important;
	border-radius: 999px !important;
	background: #f1f1ef !important;
	color: #0b0b0b !important;
	padding: 10px 46px 10px 16px !important;
	font-size: 14px !important;
	line-height: 1.4 !important;
	outline: none !important;
	box-shadow: none !important;
}

#authorie-widget .authorie-input:focus {
	border-color: rgba(11, 11, 11, 0.2) !important;
	background: #f1f1ef !important;
	box-shadow: none !important;
	outline: none !important;
}

#authorie-widget .authorie-input:disabled {
	opacity: 0.4 !important;
}

#authorie-widget .authorie-input::placeholder {
	color: #898781 !important;
	opacity: 1 !important;
}

#authorie-widget .authorie-send {
	position: absolute !important;
	right: 18px !important;
	top: 50% !important;
	transform: translateY(-50%) !important;
	flex: 0 0 auto !important;
	width: 32px !important;
	height: 32px !important;
	min-height: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: transparent !important;
	color: #0b0b0b !important;
	cursor: pointer;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	box-shadow: none !important;
}

#authorie-widget .authorie-send:hover:not(:disabled),
#authorie-widget .authorie-send:focus-visible {
	background: rgba(11, 11, 11, 0.06) !important;
	color: #0b0b0b !important;
}

#authorie-widget .authorie-send svg {
	width: 15px !important;
	height: 15px !important;
}

#authorie-widget .authorie-send:disabled {
	background: transparent !important;
	color: #898781 !important;
	opacity: 0.6 !important;
	cursor: default;
}

/* Honeypot: visually gone, still in the DOM for bots. */
#authorie-widget .authorie-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

/* ---------- Mobile: floating card with the site still visible ---------- */

@media (max-width: 600px) {
	#authorie-widget .authorie-panel {
		right: 12px !important;
		bottom: 88px !important;
		width: calc(100vw - 24px) !important;
		min-width: 0 !important;
		height: min(600px, calc(100dvh - 108px)) !important;
		border-radius: 16px !important;
	}

	#authorie-widget .authorie-toggle {
		right: 16px !important;
		bottom: 16px !important;
	}

	/* iOS Safari auto-zooms into any input with font-size below 16px. */
	#authorie-widget .authorie-input {
		font-size: 16px !important;
	}
}
