/* Shinbu AI 客服(方向 D:紙面+品牌紅) */

#sbai-root { --sbai-red: #E60012; --sbai-ink: #1F2124; --sbai-paper: #F6F5F1; --sbai-line: #E3E0D8; }

/* 浮動鈕 */
.sbai-fab {
	position: fixed;
	right: 1.4rem;
	bottom: 1.4rem;
	z-index: 9000;
	display: flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.7rem 1.1rem;
	background: var(--sbai-ink);
	color: #fff;
	border: none;
	cursor: pointer;
	font-size: 0.85rem;
	letter-spacing: 0.12em;
	box-shadow: 0 6px 22px rgba(31, 33, 36, 0.28);
	transition: background 0.2s ease, transform 0.2s ease;
}
.sbai-fab svg { width: 18px; height: 18px; }
.sbai-fab:hover { background: var(--sbai-red); transform: translateY(-2px); }
.sbai-fab.is-hidden { display: none; }

/* 面板 */
/* hidden 屬性必須贏過下面的 display:flex,否則面板關不掉 */
.sbai-panel[hidden] { display: none; }
.sbai-panel {
	position: fixed;
	right: 1.4rem;
	bottom: 1.4rem;
	z-index: 9001;
	width: min(370px, calc(100vw - 2rem));
	height: min(520px, calc(100vh - 6rem));
	display: flex;
	flex-direction: column;
	background: var(--sbai-paper);
	border: 1px solid var(--sbai-line);
	border-top: 3px solid var(--sbai-red);
	box-shadow: 0 18px 48px rgba(31, 33, 36, 0.24);
}
.sbai-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.8rem 1rem;
	border-bottom: 1px solid var(--sbai-line);
	background: #fff;
}
.sbai-head strong { font-size: 0.92rem; letter-spacing: 0.12em; color: var(--sbai-ink); }
.sbai-close {
	border: none;
	background: none;
	font-size: 1.5rem;
	line-height: 1;
	color: #8a8f94;
	cursor: pointer;
	padding: 0 0.2rem;
}
.sbai-close:hover { color: var(--sbai-red); }

/* 訊息區 */
.sbai-msgs {
	flex: 1;
	overflow-y: auto;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}
.sbai-hint { font-size: 0.82rem; color: #8a8f94; line-height: 1.8; margin: 0.4rem 0.2rem; }
.sbai-m {
	max-width: 85%;
	padding: 0.55rem 0.8rem;
	font-size: 0.86rem;
	line-height: 1.8;
	word-break: break-word;
}
.sbai-m--user {
	align-self: flex-end;
	background: var(--sbai-ink);
	color: #fff;
	border-radius: 10px 10px 2px 10px;
}
.sbai-m--assistant {
	align-self: flex-start;
	background: #fff;
	color: var(--sbai-ink);
	border: 1px solid var(--sbai-line);
	border-radius: 10px 10px 10px 2px;
}
/* 打字中 */
.sbai-typing { display: flex; gap: 4px; padding: 0.8rem; }
.sbai-typing i {
	width: 6px; height: 6px;
	background: #b9bdc1;
	border-radius: 50%;
	animation: sbaiB 1.2s infinite ease-in-out;
}
.sbai-typing i:nth-child(2) { animation-delay: 0.15s; }
.sbai-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes sbaiB { 0%, 60%, 100% { transform: none; opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* 輸入列 */
.sbai-form {
	display: flex;
	gap: 0.5rem;
	padding: 0.7rem;
	border-top: 1px solid var(--sbai-line);
	background: #fff;
}
.sbai-input {
	flex: 1;
	border: 1px solid var(--sbai-line);
	padding: 0.5rem 0.7rem;
	font-size: 0.86rem;
	background: var(--sbai-paper);
	min-width: 0;
}
.sbai-input:focus { outline: none; border-color: var(--sbai-red); }
.sbai-send {
	border: none;
	background: var(--sbai-red);
	color: #fff;
	padding: 0 1rem;
	font-size: 0.82rem;
	letter-spacing: 0.1em;
	cursor: pointer;
	flex: none;
}
.sbai-send:disabled { opacity: 0.45; cursor: default; }

@media (max-width: 480px) {
	.sbai-panel { right: 0.6rem; bottom: 0.6rem; }
	.sbai-fab span { display: none; }
	.sbai-fab { padding: 0.85rem; border-radius: 50%; }
}
