/* Support Chat 悬浮 widget — 全局右下角 */

.tooo-chat-fab {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: #10B981;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.5rem;
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
	cursor: pointer;
	z-index: 1050;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	user-select: none;
}
.tooo-chat-fab:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}
.tooo-chat-fab:active { transform: scale(0.95); }

.tooo-chat-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	background: #ef4444;
	color: #fff;
	font-size: 0.7rem;
	min-width: 18px;
	height: 18px;
	border-radius: 9px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
	font-weight: 600;
}

.tooo-chat-panel {
	position: fixed;
	bottom: 92px;
	right: 24px;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 120px);
	background: var(--bs-body-bg, #fff);
	color: var(--bs-body-color, #212529);
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0,0,0,0.25);
	display: flex;
	flex-direction: column;
	z-index: 1050;
	overflow: hidden;
	border: 1px solid rgba(0,0,0,0.08);
}

.tooo-chat-header {
	background: #10B981;
	color: #fff;
	padding: 12px 16px;
	display: flex;
	align-items: center;
	gap: 8px;
}
.tooo-chat-title { font-weight: 600; }
.tooo-chat-status { font-size: 0.8rem; opacity: 0.85; flex: 1; }
.tooo-chat-close, .tooo-chat-end {
	background: transparent;
	border: 0;
	color: #fff;
	font-size: 1.0rem;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 4px;
}
.tooo-chat-close:hover, .tooo-chat-end:hover { background: rgba(255,255,255,0.15); }
.tooo-chat-end { font-size: 0.95rem; opacity: 0.85; }

.tooo-chat-banner {
	padding: 8px 14px;
	background: #fef3c7;
	color: #78350f;
	font-size: 0.85rem;
	border-bottom: 1px solid rgba(0,0,0,0.05);
}
.tooo-chat-banner.tooo-banner-success {
	background: #d1fae5;
	color: #065f46;
}
.tooo-chat-banner.tooo-banner-info {
	background: #dbeafe;
	color: #1e40af;
}

.tooo-chat-msgs {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: var(--bs-tertiary-bg, #f8f9fa);
}

.tooo-chat-msg {
	max-width: 80%;
	padding: 8px 12px;
	border-radius: 14px;
	font-size: 0.9rem;
	line-height: 1.4;
	word-break: break-word;
	white-space: pre-wrap;
}
.tooo-chat-msg-visitor {
	background: #10B981;
	color: #fff;
	align-self: flex-end;
	border-bottom-right-radius: 4px;
}
.tooo-chat-msg-ai, .tooo-chat-msg-admin {
	background: var(--bs-body-bg, #fff);
	color: var(--bs-body-color, #212529);
	align-self: flex-start;
	border-bottom-left-radius: 4px;
	border: 1px solid rgba(0,0,0,0.08);
}
.tooo-chat-msg-admin {
	background: #ecfdf5;
	border-color: #a7f3d0;
}
.tooo-chat-msg-system {
	background: transparent;
	color: var(--bs-secondary-color, #6c757d);
	align-self: center;
	font-size: 0.8rem;
	text-align: center;
	max-width: 90%;
	font-style: italic;
}
.tooo-chat-msg-pending {
	opacity: 0.6;
}
.tooo-chat-msg-meta {
	font-size: 0.7rem;
	opacity: 0.7;
	margin-top: 2px;
}

.tooo-chat-typing {
	color: var(--bs-secondary-color, #6c757d);
	font-size: 0.8rem;
	font-style: italic;
	align-self: flex-start;
	padding: 4px 8px;
}
.tooo-chat-typing::after {
	content: '...';
	animation: tooo-dots 1.4s steps(4) infinite;
}
@keyframes tooo-dots {
	0%, 33% { content: ''; }
	34%, 66% { content: '.'; }
	67%, 89% { content: '..'; }
	90%, 100% { content: '...'; }
}

.tooo-chat-tools {
	padding: 4px 12px;
	border-top: 1px solid rgba(0,0,0,0.05);
	display: flex;
	justify-content: flex-end;
}
.tooo-chat-link {
	background: transparent;
	border: 0;
	color: #10B981;
	font-size: 0.8rem;
	cursor: pointer;
	padding: 4px 8px;
	text-decoration: underline;
}
.tooo-chat-link:hover { color: #047857; }

/* v9.3.2 contact form：訪客留聯絡信息 */
.tooo-chat-contact {
	border-top: 1px solid rgba(0,0,0,0.08);
	padding: 12px;
	background: var(--bs-tertiary-bg, #f8f9fa);
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.tooo-chat-contact-row {
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.tooo-chat-contact-label {
	font-size: 0.8rem;
	color: var(--bs-secondary-color, #6c757d);
	font-weight: 500;
}
.tooo-chat-contact-input, .tooo-chat-contact-textarea {
	border: 1px solid rgba(0,0,0,0.15);
	border-radius: 6px;
	padding: 6px 8px;
	font-size: 0.9rem;
	font-family: inherit;
	background: var(--bs-body-bg, #fff);
	color: var(--bs-body-color, #212529);
}
.tooo-chat-contact-textarea { resize: vertical; max-height: 80px; }
.tooo-chat-contact-input:focus, .tooo-chat-contact-textarea:focus {
	outline: none;
	border-color: #10B981;
	box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}
.tooo-chat-contact-err {
	font-size: 0.8rem;
	color: #ef4444;
}
.tooo-chat-contact-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 4px;
}
.tooo-chat-contact-skip, .tooo-chat-contact-submit {
	border: 0;
	border-radius: 6px;
	padding: 6px 14px;
	font-size: 0.85rem;
	cursor: pointer;
}
.tooo-chat-contact-skip {
	background: transparent;
	color: var(--bs-secondary-color, #6c757d);
}
.tooo-chat-contact-skip:hover { background: rgba(0,0,0,0.05); }
.tooo-chat-contact-submit {
	background: #10B981;
	color: #fff;
}
.tooo-chat-contact-submit:hover { background: #047857; }
.tooo-chat-contact-submit:disabled { background: #9ca3af; cursor: not-allowed; }

.tooo-chat-input {
	border-top: 1px solid rgba(0,0,0,0.08);
	padding: 10px 12px;
	display: flex;
	gap: 8px;
	align-items: flex-end;
}
.tooo-chat-input textarea {
	flex: 1;
	border: 1px solid rgba(0,0,0,0.15);
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 0.9rem;
	resize: none;
	max-height: 100px;
	font-family: inherit;
	background: var(--bs-body-bg, #fff);
	color: var(--bs-body-color, #212529);
}
.tooo-chat-input textarea:focus {
	outline: none;
	border-color: #10B981;
	box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}
.tooo-chat-send {
	background: #10B981;
	color: #fff;
	border: 0;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
}
.tooo-chat-send:hover { background: #047857; }
.tooo-chat-send:disabled { background: #9ca3af; cursor: not-allowed; }

/* dark theme */
[data-bs-theme="dark"] .tooo-chat-banner { background: #422006; color: #fed7aa; }
[data-bs-theme="dark"] .tooo-chat-banner.tooo-banner-success { background: #064e3b; color: #a7f3d0; }
[data-bs-theme="dark"] .tooo-chat-banner.tooo-banner-info { background: #1e3a8a; color: #bfdbfe; }
[data-bs-theme="dark"] .tooo-chat-msg-admin { background: #064e3b; border-color: #065f46; color: #d1fae5; }

@media (max-width: 480px) {
	.tooo-chat-panel {
		bottom: 0;
		right: 0;
		left: 0;
		width: 100%;
		max-width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
	}
	.tooo-chat-fab { bottom: 16px; right: 16px; }
}
