/**
 * EXGOV AI Assistant — Frontend Styles v1.2
 */

:root {
	--exgov-primary: #0B1F3A;
	--exgov-accent: #c9a646;
	--exgov-primary-light: #132d52;
	--exgov-gradient: linear-gradient(135deg, #0B1F3A 0%, #132d52 100%);
	--exgov-accent-gradient: linear-gradient(135deg, #c9a646 0%, #d4b55e 100%);
	--exgov-shadow: 0 4px 24px rgba(11, 31, 58, 0.3);
	--exgov-radius: 14px;
	--exgov-radius-full: 50px;
	--exgov-text: #0B1F3A;
	--exgov-bg: #ffffff;
	--exgov-border: rgba(11, 31, 58, 0.12);
}

/* ─── Buttons ─── */
.exgov-ai-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 13px 26px;
	background: var(--exgov-gradient);
	color: #fff !important;
	border: none;
	border-radius: var(--exgov-radius-full);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: var(--exgov-shadow);
	transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
	text-decoration: none !important;
	line-height: 1.4;
}

.exgov-ai-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 28px rgba(11, 31, 58, 0.35);
	color: #fff !important;
	opacity: 0.95;
}

.exgov-ai-btn-secondary {
	background: #f4f6f9;
	color: var(--exgov-text) !important;
	box-shadow: none;
	border: 1px solid var(--exgov-border);
}

.exgov-ai-btn-secondary:hover {
	background: #e8ecf2;
	color: var(--exgov-text) !important;
}

/* ─── Platform bar (auto-inject) ─── */
.exgov-ai-platform-bar {
	width: 100%;
	padding: 20px 0 28px;
	margin: 0 auto 8px;
}

.exgov-ai-platform-bar-inner {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	justify-content: center;
	align-items: center;
	max-width: 900px;
	margin: 0 auto;
	padding: 0 16px;
}

.exgov-ai-platform-ask-btn,
.exgov-ai-platform-fit-btn {
	min-width: 240px;
	border: 2px solid transparent !important;
}

.exgov-ai-platform-fit-btn {
	font-weight: 700;
}

/* ─── Robot floating button (RIGHT side) — robot + speech bubble ─── */
button#exgov-ai-floating-btn.exgov-ai-floating-btn,
button#exgov-ai-floating-btn.exgov-ai-floating-btn:hover,
button#exgov-ai-floating-btn.exgov-ai-floating-btn:focus,
button#exgov-ai-floating-btn.exgov-ai-floating-btn:active {
	background: transparent !important;
	background-color: transparent !important;
	border: none !important;
	box-shadow: none !important;
	outline: none !important;
	-webkit-tap-highlight-color: transparent;
}

.exgov-ai-floating-btn {
	position: fixed;
	bottom: 24px;
	right: 24px;
	left: auto;
	z-index: 99990;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0;
	padding: 0;
	margin: 0;
	background: transparent;
	color: #fff;
	border: none;
	border-radius: 0;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: none;
	transition: transform 0.25s;
	appearance: none;
}

.exgov-ai-floating-btn:hover {
	transform: translateY(-4px);
	background: transparent !important;
}

.exgov-ai-floating-bubble {
	position: relative;
	display: block;
	max-width: 160px;
	padding: 8px 14px;
	margin-bottom: 8px;
	background: #fff;
	color: var(--exgov-primary);
	border: 2px solid var(--exgov-accent);
	border-radius: 16px;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
	text-align: center;
	box-shadow: 0 4px 16px rgba(11, 31, 58, 0.2);
}

.exgov-ai-floating-bubble::after {
	content: '';
	position: absolute;
	bottom: -8px;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 8px solid transparent;
	border-right: 8px solid transparent;
	border-top: 8px solid var(--exgov-accent);
}

.exgov-ai-robot-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	background: none !important;
	border-radius: 0;
	flex-shrink: 0;
	filter: drop-shadow(0 4px 12px rgba(11, 31, 58, 0.35));
	pointer-events: none;
}

.exgov-ai-floating-bubble {
	pointer-events: none;
}

.exgov-ai-robot-arm {
	transform-origin: 48px 30.5px;
	animation: exgov-wave 2s ease-in-out infinite;
}

@keyframes exgov-wave {
	0%, 100% { transform: rotate(0deg); }
	25% { transform: rotate(-18deg); }
	75% { transform: rotate(12deg); }
}

@media (max-width: 480px) {
	.exgov-ai-floating-btn {
		right: 12px;
		bottom: 12px;
	}
	.exgov-ai-floating-bubble {
		max-width: 130px;
		font-size: 11px;
		padding: 6px 10px;
	}
	.exgov-ai-robot {
		width: 52px;
		height: 52px;
	}
}

/* ─── Overlay ─── */
.exgov-ai-overlay {
	position: fixed;
	inset: 0;
	background: rgba(11, 31, 58, 0.55);
	z-index: 99991;
	backdrop-filter: blur(2px);
}

/* ─── Chat Widget (RIGHT side) ─── */
.exgov-ai-chat-widget {
	position: fixed;
	bottom: 100px;
	right: 28px;
	left: auto;
	width: 390px;
	max-width: calc(100vw - 24px);
	max-height: calc(100vh - 130px);
	background: var(--exgov-bg);
	border-radius: var(--exgov-radius);
	border: 1px solid var(--exgov-border);
	box-shadow: 0 12px 48px rgba(11, 31, 58, 0.25);
	z-index: 99992;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.exgov-ai-widget-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 18px;
	background: var(--exgov-gradient);
	color: #fff;
	border-bottom: 3px solid var(--exgov-accent);
	flex-shrink: 0;
}

.exgov-ai-widget-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 700;
	font-size: 15px;
}

.exgov-ai-widget-avatar {
	font-size: 22px;
}

.exgov-ai-widget-close {
	background: none !important;
	border: none;
	color: #fff !important;
	font-size: 28px;
	font-weight: 300;
	cursor: pointer;
	line-height: 1;
	width: auto;
	height: auto;
	padding: 0 4px;
	border-radius: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0.9;
	transition: opacity 0.2s;
}

.exgov-ai-widget-close:hover {
	opacity: 1;
	background: none !important;
}

/* Scrollable body: messages + quick actions */
.exgov-ai-widget-body {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

.exgov-ai-widget-messages {
	padding: 16px;
	flex-shrink: 0;
}

.exgov-ai-message {
	margin-bottom: 12px;
	padding: 12px 16px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.7;
	white-space: pre-wrap;
	word-break: break-word;
}

.exgov-ai-message-bot {
	background: #f4f6f9;
	color: var(--exgov-text);
	border: 1px solid var(--exgov-border);
	border-start-start-radius: 4px;
}

.exgov-ai-message-user {
	background: var(--exgov-gradient);
	color: #fff;
	margin-inline-start: 32px;
	border: 1px solid var(--exgov-primary-light);
	border-start-end-radius: 4px;
}

.exgov-ai-message-loading span {
	width: 8px;
	height: 8px;
	background: var(--exgov-accent);
	border-radius: 50%;
	animation: exgov-bounce 1.4s infinite ease-in-out both;
}

.exgov-ai-message-loading span:nth-child(1) { animation-delay: -0.32s; }
.exgov-ai-message-loading span:nth-child(2) { animation-delay: -0.16s; }

@keyframes exgov-bounce {
	0%, 80%, 100% { transform: scale(0); }
	40% { transform: scale(1); }
}

/* Quick actions — grid side by side */
.exgov-ai-quick-actions {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0 16px 16px;
	flex-shrink: 0;
}

.exgov-ai-quick-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 1 1 calc(50% - 4px);
	min-width: calc(50% - 4px);
	max-width: 100%;
	padding: 9px 10px;
	background: #fff;
	border: 1.5px solid var(--exgov-accent);
	border-radius: 10px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	color: var(--exgov-primary);
	text-align: center;
	transition: all 0.2s;
	line-height: 1.4;
}

.exgov-ai-quick-action:hover {
	background: var(--exgov-accent);
	color: var(--exgov-primary);
	border-color: var(--exgov-accent);
}

/* Input area */
.exgov-ai-widget-input-wrap {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	padding: 14px 16px;
	border-top: 1px solid var(--exgov-border);
	background: #fafbfc;
	flex-shrink: 0;
}

.exgov-ai-widget-input {
	flex: 1;
	border: 2px solid var(--exgov-border);
	border-radius: 12px;
	padding: 11px 16px;
	font-size: 14px;
	resize: none;
	max-height: 100px;
	font-family: inherit;
	background: #fff;
	color: var(--exgov-text);
	transition: border-color 0.2s;
}

.exgov-ai-widget-input:focus {
	outline: none;
	border-color: var(--exgov-accent);
	box-shadow: 0 0 0 3px rgba(201, 166, 70, 0.2);
}

.exgov-ai-widget-send {
	min-width: 72px;
	height: 44px;
	padding: 0 12px;
	border: none;
	border-radius: 12px;
	background: var(--exgov-accent-gradient);
	color: var(--exgov-primary);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	flex-shrink: 0;
	transition: transform 0.2s;
	font-size: 13px;
	font-weight: 700;
	font-family: inherit;
}

.exgov-ai-send-label {
	color: var(--exgov-primary);
	line-height: 1;
}

.exgov-ai-widget-send svg {
	flex-shrink: 0;
}

.exgov-ai-widget-send:hover {
	transform: scale(1.05);
}

/* ─── Smart Search ─── */
.exgov-ai-search-wrap {
	position: relative;
}

.exgov-ai-search-header {
	min-width: 260px;
}

.exgov-ai-search-menu-item {
	list-style: none !important;
	display: flex;
	align-items: center;
}

.exgov-ai-search-inner {
	display: flex;
	align-items: center;
	gap: 10px;
	background: rgba(11, 31, 58, 0.6) !important;
	border: 1.5px solid rgba(201, 166, 70, 0.6) !important;
	border-radius: 30px;
	padding: 10px 18px;
	transition: border-color 0.2s, box-shadow 0.2s;
	box-shadow: none !important;
}

.exgov-ai-search-inner:focus-within {
	border-color: var(--exgov-accent) !important;
	box-shadow: 0 0 0 2px rgba(201, 166, 70, 0.25) !important;
	background: rgba(11, 31, 58, 0.75) !important;
}

.exgov-ai-search-icon {
	color: var(--exgov-accent);
	flex-shrink: 0;
	opacity: 1;
}

.exgov-ai-search-input,
.exgov-ai-search-wrap input.exgov-ai-search-input {
	border: none !important;
	background: transparent !important;
	box-shadow: none !important;
	outline: none !important;
	-webkit-appearance: none;
	appearance: none;
	font-size: 13px;
	width: 100%;
	min-width: 180px;
	color: #fff !important;
	padding: 0 !important;
	margin: 0 !important;
	border-radius: 0 !important;
	height: auto !important;
	line-height: 1.4;
}

.exgov-ai-search-input::placeholder {
	color: rgba(255, 255, 255, 0.6) !important;
}

.exgov-ai-search-shortcode .exgov-ai-search-inner {
	background: #fff;
	border-color: var(--exgov-border);
}

.exgov-ai-search-shortcode .exgov-ai-search-input {
	color: var(--exgov-text);
}

.exgov-ai-search-shortcode .exgov-ai-search-input::placeholder {
	color: #8899aa;
}

.exgov-ai-search-results {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid var(--exgov-border);
	border-radius: var(--exgov-radius);
	box-shadow: 0 12px 40px rgba(11, 31, 58, 0.18);
	max-height: 400px;
	overflow-y: auto;
	z-index: 99999;
}

.exgov-ai-search-result {
	display: block;
	padding: 14px 18px;
	border-bottom: 1px solid var(--exgov-border);
	text-decoration: none !important;
	color: var(--exgov-text) !important;
	transition: background 0.2s;
}

.exgov-ai-search-result:hover {
	background: #f4f6f9;
}

.exgov-ai-search-result-type {
	display: inline-block;
	font-size: 11px;
	background: var(--exgov-accent);
	color: var(--exgov-primary);
	padding: 2px 10px;
	border-radius: 10px;
	margin-bottom: 6px;
	font-weight: 600;
}

.exgov-ai-search-result-title {
	font-weight: 700;
	font-size: 14px;
	margin-bottom: 4px;
	color: var(--exgov-primary);
}

.exgov-ai-search-result-desc {
	font-size: 12px;
	color: #667788;
}

.exgov-ai-search-no-results {
	padding: 18px;
	text-align: center;
	color: #667788;
}

/* ─── Modals ─── */
.exgov-ai-modal {
	position: fixed;
	inset: 0;
	z-index: 99993;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(11, 31, 58, 0.6);
	padding: 20px;
	backdrop-filter: blur(3px);
}

.exgov-ai-modal-content {
	background: #fff;
	border-radius: var(--exgov-radius);
	width: 100%;
	max-width: 560px;
	max-height: 90vh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 16px 56px rgba(11, 31, 58, 0.3);
	border: 1px solid var(--exgov-border);
}

.exgov-ai-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 24px;
	background: var(--exgov-gradient);
	color: #fff;
	border-bottom: 3px solid var(--exgov-accent);
}

.exgov-ai-modal-title,
.exgov-ai-modal-header h3 {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	color: #ffffff !important;
	line-height: 1.5;
	flex: 1;
}

.exgov-ai-modal-close {
	background: none !important;
	border: none;
	color: #fff !important;
	font-size: 32px;
	font-weight: 300;
	cursor: pointer;
	width: auto;
	height: auto;
	padding: 0 0 0 12px;
	line-height: 1;
	opacity: 0.9;
	flex-shrink: 0;
}

.exgov-ai-modal-close:hover {
	opacity: 1;
	background: none !important;
}

.exgov-ai-modal-body {
	padding: 24px;
	overflow-y: auto;
	flex: 1;
}

.exgov-ai-modal-body h4 {
	margin: 0 0 16px;
	font-size: 16px;
	color: var(--exgov-primary);
}

.exgov-ai-modal-footer {
	padding: 16px 24px;
	border-top: 1px solid var(--exgov-border);
	display: flex;
	gap: 12px;
	justify-content: flex-end;
}

.exgov-ai-options {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.exgov-ai-option {
	padding: 14px 18px;
	border: 2px solid var(--exgov-border);
	border-radius: var(--exgov-radius);
	cursor: pointer;
	transition: all 0.2s;
	font-size: 14px;
	color: var(--exgov-text);
}

.exgov-ai-option:hover {
	border-color: var(--exgov-accent);
	background: rgba(201, 166, 70, 0.08);
}

.exgov-ai-option.selected {
	border-color: var(--exgov-accent);
	background: rgba(201, 166, 70, 0.15);
	font-weight: 600;
}

/* Recommendations */
.exgov-ai-rec-card {
	padding: 18px;
	border: 1px solid var(--exgov-border);
	border-radius: var(--exgov-radius);
	margin-bottom: 12px;
	border-inline-start: 4px solid var(--exgov-accent);
}

.exgov-ai-rec-score {
	background: var(--exgov-accent-gradient);
	color: var(--exgov-primary);
	padding: 4px 14px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 700;
}

.exgov-ai-fit-score-circle {
	width: 100px;
	height: 100px;
	border-radius: 50%;
	background: var(--exgov-gradient);
	color: var(--exgov-accent);
	border: 4px solid var(--exgov-accent);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28px;
	font-weight: 700;
	margin: 0 auto 16px;
}

/* Platform questions */
.exgov-ai-platform-questions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

.exgov-ai-quick-q {
	padding: 8px 14px;
	background: #fff;
	border: 1.5px solid var(--exgov-accent);
	border-radius: 20px;
	font-size: 13px;
	cursor: pointer;
	color: var(--exgov-primary);
	transition: all 0.2s;
}

.exgov-ai-quick-q:hover {
	background: var(--exgov-accent);
}

/* Phase notice */
.exgov-ai-phase-notice {
	padding: 20px;
	background: #f4f6f9;
	border-radius: var(--exgov-radius);
	text-align: center;
	color: #667788;
	border: 1px solid var(--exgov-border);
}

/* Hide theme scroll-to-top (conflicts with AI chat button position) */
#exgovScrollTopBtn,
button#exgovScrollTopBtn,
.exgov-scroll-top,
.exgov-grc-back-top,
#exgov-grc-back-top,
a.exgov-grc-back-top,
button.exgov-grc-back-top {
	display: none !important;
	visibility: hidden !important;
	opacity: 0 !important;
	pointer-events: none !important;
	width: 0 !important;
	height: 0 !important;
	overflow: hidden !important;
}

/* RTL */
[dir="rtl"] .exgov-ai-chat-widget,
[dir="rtl"] .exgov-ai-modal,
.exgov-ai-rtl .exgov-ai-chat-widget {
	direction: rtl;
	text-align: right;
}

@media (max-width: 768px) {
	.exgov-ai-chat-widget {
		bottom: 0;
		right: 0;
		left: 0;
		width: 100%;
		max-width: 100%;
		border-radius: var(--exgov-radius) var(--exgov-radius) 0 0;
		max-height: 88vh;
	}

	.exgov-ai-platform-bar-inner {
		flex-direction: column;
	}

	.exgov-ai-platform-ask-btn,
	.exgov-ai-platform-fit-btn {
		width: 100%;
		min-width: unset;
	}

	.exgov-ai-search-header {
		min-width: auto;
		width: 100%;
	}
}
