/* =========================================================
   SmartUp Academy AI Chat Widget
   All styles scoped under .su-widget so they won't collide
   with the WordPress theme.
   ========================================================= */

.su-widget {
	--su-orange: #F37535;
	--su-orange-dark: #DB5F1F;
	--su-orange-light: #FFB088;
	--su-orange-faint: #FFE9DA;
	--su-text: #2D3748;
	--su-text-muted: #718096;
	--su-bg: #ffffff;
	--su-bg-soft: #F4F6F9;
	--su-border: #E5E8EE;
	--su-shadow: 0 18px 50px rgba(218, 95, 31, 0.18), 0 6px 20px rgba(0, 0, 0, 0.08);
	--su-radius: 14px;
	--su-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.su-widget *,
.su-widget *::before,
.su-widget *::after {
	box-sizing: border-box;
}

/* ======= LAUNCHER (collapsed tab on right edge) =======
   The SVG itself contains the orange gradient background,
   drop shadow, lightbulb icon, sparkles, and "AI Chat" text
   — so the button just acts as a transparent click target.
   ======================================================= */
.su-launcher {
	position: fixed;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	background: transparent;
	border: none;
	padding: 0;
	margin: 0;
	cursor: pointer;
	z-index: 9998;
	line-height: 0;
	font-family: var(--su-font);
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
				opacity 0.25s ease;
}
.su-launcher svg {
	display: block;
	width: 68px;
	height: 72px;
}
.su-launcher:hover {
	transform: translateY(-50%) translateX(-3px);
}
.su-launcher:focus-visible {
	outline: 3px solid rgba(243, 117, 53, 0.5);
	outline-offset: 2px;
	border-radius: 14px 0 0 14px;
}
.su-launcher.is-hidden {
	transform: translateY(-50%) translateX(110%);
	opacity: 0;
	pointer-events: none;
}

/* ======= BACKDROP (dims the page when chat is open) ======= */
.su-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.42);
	z-index: 9997;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}
.su-backdrop.is-open {
	opacity: 1;
	pointer-events: auto;
}

/* ======= PANEL ======= */
.su-panel {
	position: fixed;
	right: 24px;
	bottom: 24px;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 640px;
	max-height: calc(100vh - 32px);
	background: var(--su-bg);
	border-radius: 18px;
	box-shadow: var(--su-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 9999;
	font-family: var(--su-font);
	color: var(--su-text);
	transform: translateY(20px) scale(0.96);
	opacity: 0;
	pointer-events: none;
	transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
				opacity 0.28s ease;
}
.su-panel.is-open {
	transform: translateY(0) scale(1);
	opacity: 1;
	pointer-events: auto;
}

/* Close tab attached to the panel's left edge — matches launcher styling */
.su-side-toggle {
	position: absolute;
	left: -44px;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 64px;
	background: linear-gradient(135deg, #FF6900 0%, #FF9B55 100%);
	color: white;
	border: none;
	border-radius: 14px 0 0 14px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: -6px 8px 24px rgba(243, 117, 53, 0.4);
	transition: transform 0.2s ease, filter 0.2s ease;
}
.su-side-toggle:hover {
	transform: translateY(-50%) translateX(-2px);
	filter: brightness(1.05);
}
.su-side-toggle:focus-visible {
	outline: 3px solid rgba(255, 255, 255, 0.6);
	outline-offset: -6px;
}
.su-side-toggle svg { width: 22px; height: 22px; }

/* ======= HEADER ======= */
.su-header {
	background: linear-gradient(125deg, #F37535 0%, #FF8E5A 100%);
	color: white;
	padding: 18px 20px;
	display: flex;
	align-items: center;
	gap: 12px;
	position: relative;
	flex-shrink: 0;
}
.su-header::after {
	content: '';
	position: absolute;
	inset: 0;
	background-image:
		radial-gradient(circle at 85% 25%, rgba(255, 255, 255, 0.22) 0%, transparent 55%),
		radial-gradient(circle at 15% 110%, rgba(0, 0, 0, 0.06) 0%, transparent 60%);
	pointer-events: none;
}
.su-header > * { position: relative; z-index: 1; }
.su-header .logo {
	width: 38px;
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.su-header .logo svg {
	width: 100%;
	height: 100%;
}
.su-header .title {
	flex: 1;
	font-weight: 600;
	font-size: 16px;
	letter-spacing: 0.2px;
}
.su-header .icon-btn {
	background: transparent;
	border: none;
	color: white;
	cursor: pointer;
	padding: 7px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, transform 0.4s ease;
}
.su-header .icon-btn:hover { background: rgba(255, 255, 255, 0.18); }
.su-header .icon-btn:active { transform: rotate(-360deg); }

/* ======= BODY (scrollable conversation area) ======= */
.su-body {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 22px 20px 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	scroll-behavior: smooth;
}
.su-body::-webkit-scrollbar { width: 6px; }
.su-body::-webkit-scrollbar-track { background: transparent; }
.su-body::-webkit-scrollbar-thumb {
	background: var(--su-border);
	border-radius: 3px;
}
.su-body::-webkit-scrollbar-thumb:hover { background: var(--su-orange-light); }

/* ======= ENTRY FORM ======= */
.su-entry { padding: 8px 4px 4px; }
.su-entry h2 {
	text-align: center;
	font-size: 17px;
	font-weight: 700;
	margin: 12px 0 6px;
	color: var(--su-text);
}
.su-entry .subtitle {
	text-align: center;
	font-size: 14px;
	color: var(--su-text-muted);
	margin: 0 0 22px;
	line-height: 1.5;
}
.su-field { margin-bottom: 14px; }
.su-field label {
	display: block;
	font-size: 13px;
	font-weight: 500;
	margin-bottom: 6px;
	color: var(--su-text);
}
.su-field input {
	width: 100%;
	padding: 11px 14px;
	border: 1.5px solid var(--su-border);
	border-radius: 9px;
	font-size: 14px;
	font-family: inherit;
	color: var(--su-text);
	background: var(--su-bg);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.su-field input:focus {
	outline: none;
	border-color: var(--su-orange);
	box-shadow: 0 0 0 3px rgba(243, 117, 53, 0.15);
}
.su-field input::placeholder { color: #B0B7C3; }

.su-captcha {
	background: #F9F9F9;
	border: 1px solid #D3D3D3;
	border-radius: 4px;
	padding: 10px 12px;
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 18px 0;
	font-size: 13px;
	color: #444;
}
.su-captcha .checkbox {
	width: 22px;
	height: 22px;
	border: 2px solid #C1C1C1;
	border-radius: 2px;
	background: white;
	cursor: pointer;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: border-color 0.15s ease;
}
.su-captcha .checkbox.checked { border-color: var(--su-orange); }
.su-captcha .checkbox.checked::after {
	content: '';
	width: 12px;
	height: 6px;
	border-left: 2.5px solid var(--su-orange);
	border-bottom: 2.5px solid var(--su-orange);
	transform: rotate(-45deg) translate(1px, -2px);
}
.su-captcha .label-text { flex: 1; user-select: none; cursor: pointer; }
.su-captcha .recap {
	font-size: 9px;
	color: #888;
	text-align: right;
	line-height: 1.3;
	letter-spacing: 0.3px;
}
.su-captcha .recap strong {
	display: block;
	font-size: 11px;
	color: #555;
	font-weight: 700;
}

.su-start-btn {
	width: 100%;
	background: var(--su-orange);
	color: white;
	border: none;
	border-radius: 999px;
	padding: 13px;
	font-size: 13.5px;
	font-weight: 700;
	letter-spacing: 0.6px;
	cursor: pointer;
	font-family: inherit;
	transition: background 0.15s ease, transform 0.1s ease;
}
.su-start-btn:hover:not(:disabled) { background: var(--su-orange-dark); }
.su-start-btn:active:not(:disabled) { transform: scale(0.98); }
.su-start-btn:disabled {
	background: #D5D9DF;
	color: white;
	cursor: not-allowed;
}

/* ======= WELCOME ======= */
.su-welcome {
	text-align: center;
	padding: 14px 4px 4px;
	animation: suFadeUp 0.4s ease both;
}
.su-welcome h2 {
	font-size: 16.5px;
	font-weight: 700;
	margin: 8px 0 12px;
	color: var(--su-text);
}
.su-welcome p {
	font-size: 13.5px;
	color: var(--su-text-muted);
	line-height: 1.55;
	margin: 0;
}

/* ======= SUGGESTION / FOLLOW-UP CARDS ======= */
.su-suggestion-list {
	display: flex;
	flex-direction: column;
	gap: 9px;
}
.su-suggestion {
	background: white;
	border: 1.5px solid var(--su-orange-light);
	border-radius: 10px;
	padding: 11px 14px;
	font-size: 13px;
	color: var(--su-text);
	text-align: left;
	cursor: pointer;
	font-family: inherit;
	line-height: 1.45;
	transition: all 0.15s ease;
	animation: suFadeUp 0.4s ease both;
}
.su-suggestion:hover {
	border-color: var(--su-orange);
	background: var(--su-orange-faint);
	transform: translateX(2px);
}
.su-suggestion:nth-child(1) { animation-delay: 0.05s; }
.su-suggestion:nth-child(2) { animation-delay: 0.12s; }
.su-suggestion:nth-child(3) { animation-delay: 0.19s; }
.su-suggestion:nth-child(4) { animation-delay: 0.26s; }

/* ======= MESSAGES ======= */
.su-message {
	display: flex;
	animation: suFadeUp 0.32s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.su-message.user { justify-content: flex-end; }
.su-message.bot { justify-content: flex-start; flex-direction: column; gap: 12px; }

.su-bubble {
	max-width: 85%;
	padding: 11px 15px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.55;
	word-wrap: break-word;
}
.su-message.user .su-bubble {
	background: var(--su-orange);
	color: white;
	border-bottom-right-radius: 5px;
	box-shadow: 0 2px 8px rgba(243, 117, 53, 0.25);
}
.su-message.bot .su-text {
	color: var(--su-text);
	font-size: 14px;
	line-height: 1.6;
	white-space: pre-wrap;
}
.su-message.bot .su-text .highlight {
	color: var(--su-orange);
	font-weight: 600;
}

/* Typing indicator */
.su-typing {
	display: inline-flex;
	gap: 4px;
	padding: 8px 0 4px;
}
.su-typing span {
	width: 7px;
	height: 7px;
	background: var(--su-orange-light);
	border-radius: 50%;
	animation: suBounce 1.2s infinite;
}
.su-typing span:nth-child(2) { animation-delay: 0.15s; }
.su-typing span:nth-child(3) { animation-delay: 0.3s; }

/* ======= INPUT AREA ======= */
.su-input-area {
	border-top: 1px solid var(--su-border);
	padding: 12px 16px 6px;
	background: var(--su-bg);
	flex-shrink: 0;
}
.su-input-wrap {
	display: flex;
	align-items: center;
	background: var(--su-bg-soft);
	border-radius: 999px;
	padding: 4px 4px 4px 18px;
	gap: 8px;
	border: 1.5px solid transparent;
	transition: border-color 0.15s ease, background 0.15s ease;
}
.su-input-wrap:focus-within {
	border-color: var(--su-orange-light);
	background: white;
}
.su-input-wrap input {
	flex: 1;
	border: none;
	background: transparent;
	outline: none;
	font-size: 14px;
	font-family: inherit;
	padding: 8px 0;
	color: var(--su-text);
	min-width: 0;
}
.su-input-wrap input::placeholder { color: #A0A8B5; }

.su-send {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--su-orange);
	border: none;
	color: white;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.15s ease, transform 0.1s ease;
}
.su-send:hover:not(:disabled) { background: var(--su-orange-dark); }
.su-send:active:not(:disabled) { transform: scale(0.92); }
.su-send:disabled { background: #D5D9DF; cursor: not-allowed; }

/* ======= FOOTER ======= */
.su-footer {
	text-align: center;
	font-size: 10.5px;
	color: var(--su-text-muted);
	padding: 4px 16px 10px;
	background: var(--su-bg);
	flex-shrink: 0;
}
.su-footer a {
	color: var(--su-orange);
	text-decoration: none;
	font-weight: 500;
}
.su-footer a:hover { text-decoration: underline; }

/* ======= ANIMATIONS ======= */
@keyframes suFadeUp {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}
@keyframes suBounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-5px); opacity: 1; }
}

/* ======= MOBILE ======= */
@media (max-width: 480px) {
	.su-backdrop { display: none; }
	.su-panel {
		right: 0; left: 0; bottom: 0; top: 0;
		width: 100%;
		max-width: 100%;
		height: 100vh;
		height: 100dvh;
		max-height: 100vh;
		max-height: 100dvh;
		border-radius: 0;
	}
	.su-side-toggle {
		left: auto;
		right: 12px;
		top: 14px;
		transform: none;
		width: 36px;
		height: 36px;
		border-radius: 50%;
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	}
	.su-side-toggle:hover { transform: none; }
	.su-side-toggle svg { transform: rotate(180deg); width: 18px; height: 18px; }
}
