/* GDI AI Chatbot Widget */

#gac-chat-bubble {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--gac-color, #1a5276);
	color: #fff;
	border: none;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	z-index: 99998;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s, box-shadow 0.2s;
}
#gac-chat-bubble:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
#gac-chat-bubble svg {
	width: 28px;
	height: 28px;
	fill: #fff;
}
#gac-chat-bubble .gac-close-icon {
	display: none;
}
#gac-chat-bubble.gac-open .gac-chat-icon { display: none; }
#gac-chat-bubble.gac-open .gac-close-icon { display: block; }

/* Chat window */
#gac-chat-window {
	position: fixed;
	bottom: 88px;
	right: 20px;
	width: 380px;
	height: 520px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
	z-index: 99999;
	display: none;
	flex-direction: column;
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.5;
}
#gac-chat-window.gac-visible {
	display: flex;
	animation: gacSlideUp 0.25s ease-out;
}
#gac-chat-window [hidden] {
	display: none !important;
}
#gac-chat-window.gac-contact-locked .gac-escalate-bar,
#gac-chat-window.gac-contact-locked .gac-input-area {
	display: none !important;
}

@keyframes gacSlideUp {
	from { opacity: 0; transform: translateY(16px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Header */
.gac-header {
	background: var(--gac-color, #1a5276);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}
.gac-header-title {
	font-size: 15px;
	font-weight: 600;
	margin: 0;
}
.gac-header-mode {
	font-size: 11px;
	opacity: 0.8;
	background: rgba(255,255,255,0.15);
	padding: 2px 8px;
	border-radius: 10px;
	margin-left: 8px;
}
.gac-mode-switcher {
	display: inline-flex;
	margin-left: 8px;
	gap: 2px;
}
.gac-mode-btn {
	font-size: 10px;
	background: rgba(255,255,255,0.12);
	color: rgba(255,255,255,0.7);
	border: none;
	padding: 2px 8px;
	cursor: pointer;
	font-family: inherit;
	line-height: 1.4;
	transition: background 0.15s, color 0.15s;
}
.gac-mode-btn:first-child { border-radius: 10px 0 0 10px; }
.gac-mode-btn:last-child { border-radius: 0 10px 10px 0; }
.gac-mode-btn:hover { background: rgba(255,255,255,0.25); color: #fff; }
.gac-mode-btn.gac-mode-active {
	background: rgba(255,255,255,0.3);
	color: #fff;
	font-weight: 600;
}
.gac-header-actions button {
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 4px;
	opacity: 0.8;
	font-size: 18px;
}
.gac-header-actions button:hover { opacity: 1; }

/* Messages area */
.gac-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.gac-message {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 12px;
	word-wrap: break-word;
	overflow-wrap: break-word;
}
.gac-message-user {
	background: var(--gac-color, #1a5276);
	color: #fff;
	align-self: flex-end;
	border-bottom-right-radius: 4px;
}
.gac-message-assistant {
	background: #f0f2f5;
	color: #1a1a1a;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}
.gac-message-system {
	background: #fff3e0;
	color: #795548;
	align-self: center;
	font-size: 13px;
	text-align: center;
	border-radius: 8px;
}
.gac-contact-gate {
	margin-top: 8px;
}
.gac-contact-gate-card {
	padding: 16px;
	border: 1px solid #dbe5ec;
	border-radius: 12px;
	background: #f8fbfd;
}
.gac-contact-gate-card h3 {
	margin: 0 0 6px;
	font-size: 15px;
	color: #0f172a;
}
.gac-contact-gate-card p {
	margin: 0 0 12px;
	color: #475569;
	font-size: 13px;
}
.gac-contact-gate-card label {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 10px;
	color: #334155;
	font-size: 12px;
	font-weight: 600;
}
.gac-contact-gate-card input {
	border: 1px solid #d5d9de;
	border-radius: 10px;
	padding: 10px 12px;
	font: inherit;
	font-size: 14px;
}
.gac-contact-gate-card input:focus {
	outline: none;
	border-color: var(--gac-color, #1a5276);
	box-shadow: 0 0 0 3px rgba(26, 82, 118, 0.12);
}
.gac-contact-gate-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 14px;
}
.gac-contact-gate-status {
	color: #92400e;
	font-size: 12px;
}
.gac-contact-gate-submit {
	border-radius: 999px;
	padding: 8px 14px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	background: var(--gac-color, #1a5276);
	border: 1px solid var(--gac-color, #1a5276);
	color: #fff;
}
.gac-contact-gate-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}
.gac-identity-gate {
	margin-top: 10px;
}
.gac-identity-gate-card {
	padding: 16px;
	border: 1px solid #d8e7d9;
	border-radius: 12px;
	background: #f7fcf8;
}
.gac-identity-gate-card h3 {
	margin: 0 0 6px;
	font-size: 15px;
	color: #14532d;
}
.gac-identity-gate-card p {
	margin: 0 0 12px;
	color: #3f6212;
	font-size: 13px;
}
.gac-identity-gate-card label {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 10px;
	color: #334155;
	font-size: 12px;
	font-weight: 600;
}
.gac-identity-gate-card input {
	border: 1px solid #cdd5df;
	border-radius: 10px;
	padding: 10px 12px;
	font: inherit;
	font-size: 14px;
}
.gac-identity-gate-card input:focus {
	outline: none;
	border-color: var(--gac-color, #1a5276);
	box-shadow: 0 0 0 3px rgba(26, 82, 118, 0.12);
}
.gac-identity-gate-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 14px;
}
.gac-identity-gate-status {
	color: #166534;
	font-size: 12px;
	flex: 1;
}
.gac-identity-gate-submit,
.gac-identity-gate-secondary {
	border-radius: 999px;
	padding: 8px 14px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.gac-identity-gate-submit {
	background: var(--gac-color, #1a5276);
	border: 1px solid var(--gac-color, #1a5276);
	color: #fff;
}
.gac-identity-gate-secondary {
	background: #fff;
	border: 1px solid #cbd5e1;
	color: #0f172a;
}
.gac-identity-gate-submit:disabled,
.gac-identity-gate-secondary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}
.gac-history-picker {
	margin-top: 10px;
}
.gac-history-picker-card {
	padding: 16px;
	border: 1px solid #d7e3f4;
	border-radius: 12px;
	background: #f8fbff;
}
.gac-history-picker-card h3 {
	margin: 0 0 6px;
	font-size: 15px;
	color: #1e3a8a;
}
.gac-history-picker-card p {
	margin: 0 0 12px;
	color: #334155;
	font-size: 13px;
}
.gac-history-picker-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.gac-history-picker-primary,
.gac-history-picker-secondary,
.gac-history-picker-item {
	font: inherit;
	cursor: pointer;
}
.gac-history-picker-primary,
.gac-history-picker-secondary {
	border-radius: 999px;
	padding: 8px 14px;
	font-weight: 600;
}
.gac-history-picker-primary {
	background: var(--gac-color, #1a5276);
	border: 1px solid var(--gac-color, #1a5276);
	color: #fff;
}
.gac-history-picker-secondary {
	background: #fff;
	border: 1px solid #cbd5e1;
	color: #0f172a;
}
.gac-history-picker-primary:disabled,
.gac-history-picker-secondary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}
.gac-history-picker-status {
	display: block;
	margin-top: 10px;
	font-size: 12px;
	color: #1d4ed8;
}
.gac-history-picker-list {
	display: grid;
	gap: 8px;
	margin-top: 12px;
}
.gac-history-picker-item {
	display: flex;
	flex-direction: column;
	gap: 6px;
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #dbe5f2;
	border-radius: 12px;
	background: #fff;
	text-align: left;
}
.gac-history-picker-item:hover {
	border-color: #bfdbfe;
	background: #f8fbff;
}
.gac-history-picker-item-top,
.gac-history-picker-item-meta,
.gac-history-picker-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}
.gac-history-picker-item-top {
	justify-content: space-between;
	color: #0f172a;
}
.gac-history-picker-item-meta {
	font-size: 12px;
	color: #64748b;
}
.gac-history-picker-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
}
.gac-history-picker-badge.is-open {
	background: #dcfce7;
	color: #166534;
}
.gac-history-picker-badge.is-closed {
	background: #e2e8f0;
	color: #475569;
}
.gac-history-picker-badge.is-status-active {
	background: #dbeafe;
	color: #1d4ed8;
}
.gac-history-picker-badge.is-status-handoff {
	background: #ede9fe;
	color: #6d28d9;
}
.gac-history-picker-badge.is-status-closed {
	background: #fee2e2;
	color: #b91c1c;
}
.gac-history-picker-empty {
	padding: 12px;
	border-radius: 10px;
	background: #fff;
	color: #64748b;
	font-size: 13px;
}

.gac-message a {
	color: inherit;
	text-decoration: underline;
}
.gac-message-user a { color: #fff; }

/* Typing indicator */
.gac-typing {
	display: none;
	align-self: flex-start;
	padding: 12px 16px;
	background: #f0f2f5;
	border-radius: 12px;
	border-bottom-left-radius: 4px;
}
.gac-typing.gac-visible { display: flex; }
.gac-typing span {
	display: inline-block;
	width: 8px;
	height: 8px;
	background: #999;
	border-radius: 50%;
	margin: 0 2px;
	animation: gacBounce 1.4s infinite;
}
.gac-typing span:nth-child(2) { animation-delay: 0.2s; }
.gac-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes gacBounce {
	0%, 80%, 100% { transform: translateY(0); }
	40% { transform: translateY(-6px); }
}

/* Input area */
.gac-input-area {
	border-top: 1px solid #e4e6ea;
	padding: 12px;
	display: flex;
	gap: 8px;
	align-items: flex-end;
	flex-shrink: 0;
}
.gac-input-area textarea {
	flex: 1;
	border: 1px solid #ddd;
	border-radius: 20px;
	padding: 8px 14px;
	font-size: 14px;
	font-family: inherit;
	line-height: 1.4;
	resize: none;
	max-height: 80px;
	outline: none;
}
.gac-input-area textarea:focus {
	border-color: var(--gac-color, #1a5276);
}
.gac-send-btn {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--gac-color, #1a5276);
	color: #fff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: opacity 0.2s;
}
.gac-send-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
.gac-send-btn svg {
	width: 18px;
	height: 18px;
	fill: #fff;
}
.gac-upload-btn {
	width: 36px;
	height: 36px;
	background: none;
	border: none;
	cursor: pointer;
	color: #999;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.gac-upload-btn:hover { color: #333; }
.gac-upload-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
.gac-upload-btn svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

/* Escalate button */
.gac-escalate-bar {
	text-align: center;
	padding: 6px 12px;
	border-top: 1px solid #e4e6ea;
	flex-shrink: 0;
}
.gac-handoff-reason {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 10px 0 6px;
	text-align: left;
}
.gac-handoff-reason-label {
	font-size: 12px;
	font-weight: 600;
	color: #444;
}
.gac-handoff-reason textarea {
	width: 100%;
	border: 1px solid #d5d9de;
	border-radius: 10px;
	padding: 10px 12px;
	font: inherit;
	line-height: 1.4;
	resize: vertical;
	min-height: 70px;
	max-height: 120px;
}
.gac-handoff-reason textarea:focus {
	outline: none;
	border-color: var(--gac-color, #1a5276);
	box-shadow: 0 0 0 3px rgba(26, 82, 118, 0.12);
}
.gac-handoff-reason-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}
.gac-handoff-cancel,
.gac-handoff-submit {
	border-radius: 999px;
	padding: 7px 12px;
	font: inherit;
	cursor: pointer;
}
.gac-handoff-cancel {
	background: #fff;
	border: 1px solid #d5d9de;
	color: #555;
}
.gac-handoff-submit {
	background: var(--gac-color, #1a5276);
	border: 1px solid var(--gac-color, #1a5276);
	color: #fff;
}
.gac-handoff-cancel:disabled,
.gac-handoff-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}
.gac-escalate-btn {
	background: none;
	border: none;
	color: #666;
	font-size: 12px;
	cursor: pointer;
	text-decoration: underline;
}
.gac-escalate-btn:hover { color: #333; }

/* Welcome message */
.gac-welcome {
	text-align: center;
	padding: 20px;
	color: #666;
}
.gac-welcome p {
	margin: 8px 0;
}

/* Markdown in messages */
.gac-message strong { font-weight: 600; }
.gac-message ul, .gac-message ol {
	margin: 4px 0;
	padding-left: 20px;
}
.gac-message li { margin: 2px 0; }

/* Responsive */
@media (max-width: 480px) {
	#gac-chat-window {
		width: calc(100vw - 16px);
		height: calc(100vh - 120px);
		bottom: 80px;
		right: 8px;
		border-radius: 12px;
	}

	.gac-contact-gate-actions {
		flex-direction: column;
		align-items: stretch;
	}

	.gac-identity-gate-actions {
		flex-direction: column;
		align-items: stretch;
	}

	.gac-history-picker-actions {
		flex-direction: column;
	}
}
