:root {
	--primary-gradient: linear-gradient(135deg, #0bab64 0%, #3bb78f 100%);
	--secondary-gradient: linear-gradient(135deg, #42b883 0%, #347474 100%);
	--tech-gradient: linear-gradient(to right, rgba(11, 171, 100, 0.2), rgba(59, 183, 143, 0.05));
	--bg-gradient: linear-gradient(to bottom right, #f5f9f6, #e8f5e9);
	--text-color: #2e7d32;
	--text-dark: #1b5e20;
	--text-light: #4caf50;
	--shadow-color: rgba(76, 175, 80, 0.4);
	--shadow-hover: rgba(59, 183, 143, 0.6);
	--card-bg: rgba(255, 255, 255, 0.95);
	--user-msg-bg: #e8f5e9;
	--bot-msg-bg: #f1f8e9;
	--input-bg: rgba(255, 255, 255, 0.9);
	--button-color: #2e7d32;
	--button-hover: #0bab64;
	--tech-bg: #f0f7f1;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: 'Noto Sans TC', sans-serif;
	background: var(--bg-gradient);
	background-attachment: fixed;
	min-height: 100vh;
	overflow-x: hidden;
	color: var(--text-color);
	display: flex;
}

hr {
	border: 1px solid var(--text-color);
}

/* 整體佈局 */
.container {
	display: flex;
	width: 100%;
	height: 100vh;
	overflow: hidden;
}

/* 左側面板 - 添加科技感設計 */
.side-panel {
	width: 320px;
	flex-shrink: 0;
	background: var(--tech-bg);
	display: flex;
	flex-direction: column;
	padding: 25px;
	z-index: 10;
	overflow-y: auto;
	height: 100vh;
	position: relative;
	border-right: 1px solid rgba(59, 183, 143, 0.2);
	box-shadow: 5px 0 20px rgba(0, 0, 0, 0.05);
}

/* 科技感底紋 */
.side-panel::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-size: 150px 150px, 200px 200px, 180px 180px, 30px 30px, 30px 30px;
	opacity: 0.6;
	z-index: -1;
}

/* 標題樣式 - 增強科技感 */
header {
	text-align: center;
	margin-bottom: 40px;
	position: relative;
	padding-top: 15px;
}

header h1 {
	font-size: 2.4rem;
	background: var(--primary-gradient);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	margin-bottom: 12px;
	position: relative;
	display: inline-block;
	padding: 5px 0;
	font-weight: 700;
	letter-spacing: 1px;
}

header h1::after {
	content: '';
	position: absolute;
	width: 60%;
	height: 3px;
	bottom: 0;
	left: 20%;
	background: var(--primary-gradient);
	border-radius: 5px;
}

header h2 {
	color: var(--text-color);
	font-weight: 400;
	font-size: 1.1rem;
	opacity: 0.9;
	letter-spacing: 1px;
	position: relative;
}

/* 中間空白區域 */
.spacer {
	flex-grow: 1;
}

/* 頁尾樣式 */
footer {
	font-size: 0.9rem;
	color: var(--text-dark);
	text-align: center;
	padding: 20px 0 10px 0;
	position: relative;
	z-index: 1;
}

/* 聊天容器 - 增加科技感視覺 */
.chat-container {
	flex-grow: 1;
	height: 100vh;
	background: white;
	position: relative;
	display: flex;
	flex-direction: column;
	background-image:
		linear-gradient(to right, rgba(59, 183, 143, 0.03) 1px, transparent 1px),
		linear-gradient(to bottom, rgba(59, 183, 143, 0.03) 1px, transparent 1px);
	background-size: 25px 25px;
	font-size: 1.1rem;
}

/* 半透明遮罩 */
.chat-container::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.95) 100%);
	z-index: 0;
}

/* 聊天內容區 - 優化滾動顯示 */
.chat-box {
	flex-grow: 1;
	overflow-y: auto;
	padding: 35px;
	scroll-behavior: smooth;
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	height: calc(100vh - 120px);
	/* 確保有足夠滾動空間 */
}

/* 確保訊息高度根據內容自動調整 */
.bot-message,
.user-message {
	margin-bottom: 25px;
	min-height: fit-content;
	/* 最小高度自適應內容 */
	height: auto;
	/* 自動調整高度 */
	transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 滾動顯示動畫 */
@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* 淡入效果 */
.chat-box .bot-message:last-child,
.chat-box .user-message:last-child {
	animation: fadeInUp 0.4s ease forwards;
}

/* 訊息樣式 - 增加現代感 */
.bot-message,
.user-message {
	max-width: 85%;
	padding: 18px;
	border-radius: 16px;
	line-height: 1.6;
	box-shadow: 0 3px 15px rgba(0, 0, 0, 0.06);
	word-wrap: break-word;
	display: flex;
	align-items: flex-start;
	position: relative;
	overflow: hidden;
}

.bot-message {
	background: var(--bot-msg-bg);
	color: var(--text-dark);
	border-top-left-radius: 2px;
	margin-right: auto;
	margin-left: 5px;
	animation: slideInLeft 0.3s ease forwards;
	align-self: flex-start;
}

.bot-message.highlight {
	border-left: 3px solid var(--text-light);
	padding-left: 20px;
}

/* 打字指示器樣式 */
.bot-message.typing {
	background: var(--bot-msg-bg);
	animation: fade-in 0.3s ease;
}

.user-message {
	background: var(--user-msg-bg);
	color: var(--text-dark);
	border-top-right-radius: 2px;
	margin-left: auto;
	margin-right: 5px;
	animation: slideInRight 0.3s ease forwards;
	flex-direction: row-reverse;
	width: auto;
	max-width: 85%;
	display: inline-flex;
	align-self: flex-end;
}

/* 對話框內容調整 */
.message-content {
	flex: 1;
	font-size: 20px;
	line-height: 1.7;
	height: auto;
	/* 自動調整高度 */
	overflow: visible;
	/* 確保文字不被截斷 */
}

/* 用戶消息特殊處理 */
.user-message .message-content {
	flex: 0 1 auto;
	/* 不強制拉伸，可收縮，自動寬度 */
	word-break: break-word;
	white-space: pre-wrap;
}

/* 消息光效 */
.bot-message::before,
.user-message::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
	transform: translateX(-100%);
	transition: transform 0.6s ease;
}

.bot-message:hover::before,
.user-message:hover::before {
	transform: translateX(100%);
}

.bot-message:hover,
.user-message:hover {
	transform: translateY(-3px);
	box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.avatar {
	width: 46px;
	height: 46px;
	border-radius: 12px;
	background-image: url('../images/Energy_Doctor_icon.PNG');
	background-position: center;
	background-repeat: no-repeat;
	background-size: 95%;
	margin-right: 18px;
	flex-shrink: 0;
	position: relative;
	overflow: hidden;
	box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2), 0 2px 5px rgba(11, 171, 100, 0.3);
	transform: rotate(-5deg);
	display: flex;
	align-items: center;
	justify-content: center;
}

.avatar::before {
	content: '';
	position: absolute;
	top: -3px;
	left: -3px;
	right: -3px;
	bottom: -3px;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, transparent 60%);
	z-index: 1;
	border-radius: 14px;
}

.bot-message strong,
.user-message strong {
	display: block;
	margin-bottom: 8px;
	font-weight: 700;
	color: var(--text-dark);
	font-size: 19px;
	letter-spacing: 0.3px;
}

/* 輸入區域 - 科技感升級 */
.chat-input-area {
	padding: 10px 40px;
	background: rgba(255, 255, 255, 0.9);
	border-top: 1px solid rgba(76, 175, 80, 0.1);
	backdrop-filter: blur(10px);
	display: flex;
	align-items: center;
	position: relative;
	z-index: 5;
}

/* 輸入框科技風格 */
#user-input {
	flex: 1;
	padding: 18px 28px;
	border: 1px solid rgba(76, 175, 80, 0.2);
	border-radius: 35px;
	font-size: 19px;
	background: var(--input-bg);
	color: var(--text-dark);
	outline: none;
	transition: all 0.3s ease;
	box-shadow: 0 2px 10px rgba(76, 175, 80, 0.07);
}

#user-input:focus {
	border-color: var(--text-light);
	box-shadow: 0 5px 15px rgba(76, 175, 80, 0.15);
	transform: translateY(-2px);
}

#user-input::placeholder {
	color: rgba(46, 125, 50, 0.6);
	font-style: italic;
}

/* 科技感發送按鈕 */
.send-btn {
	width: 55px;
	height: 55px;
	margin-left: 15px;
	background: var(--primary-gradient);
	border: none;
	border-radius: 15px;
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 5px 15px rgba(59, 183, 143, 0.3);
	position: relative;
	overflow: hidden;
	transform: rotate(-5deg);
}

.send-btn span {
	font-size: 40px;
	z-index: 2;
}

.send-btn::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(45deg, transparent 25%, rgba(255, 255, 255, 0.2) 50%, transparent 75%);
	background-size: 200% 200%;
	animation: shimmer 2s infinite linear;
	z-index: 1;
}

@keyframes shimmer {
	0% {
		background-position: 200% 0;
	}

	100% {
		background-position: -200% 0;
	}
}

.send-btn:hover {
	transform: translateY(-3px) rotate(-5deg);
	box-shadow: 0 8px 20px rgba(59, 183, 143, 0.4);
}

.send-btn:active {
	transform: scale(0.95) rotate(-5deg);
}

/* 警告區域樣式 */
.warning-area {
	padding: 5px 5px 10px;
	background: rgba(255, 255, 255, 0.8);
	text-align: center;
}

.warning-area p {
	color: var(--text-color);
	font-size: 14px;
	font-weight: 500;
	margin: 0;
	opacity: 0.8;
}

/* 波紋效果 */
.ripple {
	position: absolute;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.4);
	transform: scale(0);
	animation: ripple 0.6s linear;
	pointer-events: none;
	z-index: 3;
}

@keyframes ripple {
	to {
		transform: scale(4);
		opacity: 0;
	}
}

/* 打字動畫 - 更現代的視覺效果 */
.typing-animation {
	display: flex;
	align-items: center;
	height: 20px;
	margin-top: 5px;
}

.typing-dot {
	width: 7px;
	height: 7px;
	margin: 0 3px;
	background-color: var(--text-color);
	border-radius: 50%;
	opacity: 0.6;
	animation: typingAnimation 1.5s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
	animation-delay: 0s;
	background: linear-gradient(135deg, #0bab64 0%, #3bb78f 100%);
}

.typing-dot:nth-child(2) {
	animation-delay: 0.3s;
	background: linear-gradient(135deg, #1cb074 0%, #2ca37e 100%);
}

.typing-dot:nth-child(3) {
	animation-delay: 0.6s;
	background: linear-gradient(135deg, #2cb57e 0%, #1e9469 100%);
}

@keyframes typingAnimation {

	0%,
	100% {
		transform: translateY(0);
	}

	50% {
		transform: translateY(-6px);
	}
}

/* 漂浮環保元素 - 更現代的設計 */
.floating-elements {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 0;
}

.leaf,
.water-drop,
.sun,
.recycle {
	position: absolute;
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	opacity: 0.35;
	filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.03));
	transition: opacity 0.5s ease;
}

/* 添加動畫和互動性 */
@keyframes floatLeaf {

	0%,
	100% {
		transform: translate(0, 0) rotate(0deg);
	}

	25% {
		transform: translate(15px, 10px) rotate(15deg);
	}

	50% {
		transform: translate(5px, -15px) rotate(-10deg);
	}

	75% {
		transform: translate(-10px, 5px) rotate(5deg);
	}
}

@keyframes floatDrop {

	0%,
	100% {
		transform: translate(0, 0) scale(1);
	}

	33% {
		transform: translate(10px, 15px) scale(1.1);
	}

	66% {
		transform: translate(-8px, 8px) scale(0.95);
	}
}

@keyframes floatSun {

	0%,
	100% {
		transform: translate(0, 0) rotate(0deg);
	}

	33% {
		transform: translate(-10px, 10px) rotate(20deg);
	}

	66% {
		transform: translate(12px, -5px) rotate(-15deg);
	}
}

@keyframes floatRecycle {

	0%,
	100% {
		transform: translate(0, 0) rotate(0deg);
	}

	33% {
		transform: translate(10px, 5px) rotate(15deg);
	}

	66% {
		transform: translate(-5px, 10px) rotate(-15deg);
	}
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(-20px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes slideInLeft {
	from {
		opacity: 0;
		transform: translateX(-20px);
	}

	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes slideInRight {
	from {
		opacity: 0;
		transform: translateX(20px);
	}

	to {
		opacity: 1;
		transform: translateX(0);
	}
}

/* 手機版菜單按鈕 - 科技風格 */
.menu-toggle {
	display: none;
	position: fixed;
	top: 15px;
	left: 15px;
	z-index: 1000;
	width: 50px;
	height: 50px;
	border-radius: 12px;
	background: var(--primary-gradient);
	color: white;
	border: none;
	box-shadow: 0 5px 15px rgba(59, 183, 143, 0.3);
	cursor: pointer;
	align-items: center;
	justify-content: center;
	transform: rotate(-5deg);
	transition: all 0.3s ease;
}

.menu-toggle:hover {
	transform: translateY(-3px) rotate(-5deg);
	box-shadow: 0 8px 20px rgba(59, 183, 143, 0.4);
}

/* 遮罩層 */
.overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(3px);
	z-index: 998;
	transition: opacity 0.3s ease;
	opacity: 0;
}

.overlay.active {
	display: block;
	opacity: 1;
}

/* 響應式設計 */
@media (max-width: 1024px) {
	.side-panel {
		width: 280px;
	}
}

@media (max-width: 768px) {
	.container {
		flex-direction: column;
	}

	.side-panel {
		position: fixed;
		left: -320px;
		width: 280px;
		height: 100%;
		transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
		box-shadow: 0 0 25px rgba(0, 0, 0, 0.2);
		z-index: 999;
	}

	.side-panel.active {
		left: 0;
	}

	.menu-toggle {
		display: flex;
	}

	.chat-box {
		padding: 25px;
		padding-top: 75px;
	}

	.chat-input-area {
		padding: 10px 20px;
	}

	.warning-area {
		padding: 8px 10px 10px;
	}

	.warning-area p {
		font-size: 13px;
	}

	.bot-message,
	.user-message {
		max-width: 90%;
		padding: 16px;
	}

	.message-content {
		font-size: 18px;
	}
}

@media (max-width: 480px) {
	.side-panel {
		width: 250px;
		left: -250px;
	}

	.chat-box {
		padding: 15px;
		padding-top: 60px;
	}

	.chat-input-area {
		padding: 10px 15px;
	}

	.warning-area {
		padding: 6px 10px 10px;
	}

	.warning-area p {
		font-size: 12px;
	}

	#user-input {
		padding: 14px 18px;
		font-size: 17px;
	}

	.send-btn {
		width: 45px;
		height: 45px;
	}

	.bot-message,
	.user-message {
		max-width: 90%;
		padding: 12px;
	}

	.message-content {
		font-size: 17px;
	}
}

/* 優化滾動條樣式，但保持原風格 */
.chat-box::-webkit-scrollbar {
	width: 6px;
}

.chat-box::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.04);
	border-radius: 10px;
}

.chat-box::-webkit-scrollbar-thumb {
	background: var(--text-light);
	border-radius: 10px;
}

.chat-box::-webkit-scrollbar-thumb:hover {
	background: var(--text-dark);
}

/* 機器人消息頭像和名稱的水平容器 */
.bot-message .header-container {
	display: flex;
	align-items: flex-end;
	margin-bottom: 10px;
	width: 100%;
}

/* 機器人名稱樣式 */
.bot-message .bot-name {
	font-weight: 700;
	color: var(--text-dark);
	font-size: 19px;
	letter-spacing: 0.3px;
	margin-left: 5px;
}

/* 機器人消息內容調整 */
.bot-message .message-content {
	width: 100%;
	padding-left: 5px;
}

/* 重設機器人消息的布局 */
.bot-message {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

/* 移除消息內容中的名稱樣式（因為名稱現在是單獨的元素） */
.bot-message .message-content strong {
	display: none;
}

/* 增強消息內容中的HTML元素樣式 */
.message-content p {
	margin-bottom: 15px;
	line-height: 2rem;
}

.message-content p:last-child {
	margin-bottom: 0;
}

/* 列表樣式 */
.message-content ul {
	margin: 8px 0 15px 0;
	padding-left: 20px;
	list-style-type: disc;
}

/* 嵌套列表樣式 */
.message-content ul ul {
	margin: 5px 0 5px 0;
	padding-left: 20px;
	list-style-type: circle;
}

/* 再嵌套的列表樣式 */
.message-content ul ul ul {
	list-style-type: square;
}

.message-content li {
	margin-bottom: 5px;
	padding-left: 5px;
}

.message-content li:last-child {
	margin-bottom: 0;
}

/* 列表中的粗體文字 */
.message-content li strong {
	font-weight: bold;
	display: inline;
}

/* 通用粗體樣式 */
.message-content strong {
	font-weight: bold;
	display: inline;
}

/* 調整機器人消息中的內容樣式 */
.bot-message .message-content {
	text-align: left;
	width: 100%;
}

/* 用戶名稱樣式 */
.user-message .user-name {
	font-weight: 700;
	color: var(--text-dark);
	font-size: 19px;
	letter-spacing: 0.3px;
	display: block;
	/* 讓名稱獨佔一行 */
	margin-bottom: 8px;
	/* 添加底部間距 */
}

/* 用戶文本樣式 */
.user-message .user-text {
	display: block;
	/* 確保在名稱下方顯示 */
	font-size: 20px;
	line-height: 1.7;
}

/* 調整用戶消息內容布局 */
.user-message .message-content {
	display: block;
	/* 塊級顯示 */
	text-align: left;
}

/* 確保不會破壞現有布局 */
.user-message strong {
	display: inline;
}

/* 消息文本樣式 */
.message-content span {
	font-size: 20px;
	line-height: 1.7;
}

/* Markdown轉換後的HTML樣式 */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
	margin-top: 16px;
	margin-bottom: 8px;
	font-weight: 600;
	line-height: 1.25;
	color: var(--text-dark);
}

.message-content h1 {
	font-size: 26px;
}

.message-content h2 {
	font-size: 24px;
}

.message-content h3 {
	font-size: 22px;
}

.message-content h4 {
	font-size: 20px;
}

.message-content h5 {
	font-size: 18px;
}

.message-content h6 {
	font-size: 16px;
}

.message-content p {
	margin-bottom: 16px;
	line-height: 1.7;
}

.message-content p:last-child {
	margin-bottom: 0;
}

.message-content ul,
.message-content ol {
	margin-bottom: 16px;
	padding-left: 2em;
}

.message-content ul {
	list-style-type: disc;
}

.message-content ol {
	list-style-type: decimal;
}

.message-content ul ul,
.message-content ol ul {
	list-style-type: circle;
}

.message-content ul ul ul,
.message-content ol ul ul {
	list-style-type: square;
}

.message-content li {
	margin-bottom: 4px;
}

.message-content code {
	padding: 0.2em 0.4em;
	margin: 0;
	font-size: 85%;
	background-color: rgba(27, 31, 35, 0.05);
	border-radius: 3px;
	font-family: monospace;
}

.message-content pre {
	margin-bottom: 16px;
	padding: 16px;
	overflow: auto;
	font-size: 85%;
	line-height: 1.45;
	background-color: rgba(27, 31, 35, 0.05);
	border-radius: 3px;
}

.message-content pre code {
	padding: 0;
	margin: 0;
	background-color: transparent;
	border: 0;
	overflow-x: auto;
	display: block;
	white-space: pre;
	font-family: monospace;
}

.message-content a {
	color: #0366d6;
	text-decoration: none;
}

.message-content a:hover {
	text-decoration: underline;
}

.message-content img {
	max-width: 100%;
	height: auto;
	margin: 8px 0;
	border-radius: 4px;
}

.message-content strong {
	font-weight: 600;
	display: inline;
}

.message-content em {
	font-style: italic;
}

/* 用戶訊息特定樣式 */
.user-message .user-name {
	font-weight: 700;
	color: var(--text-dark);
	font-size: 19px;
	letter-spacing: 0.3px;
	display: block;
	margin-bottom: 8px;
}

.user-message .user-text {
	display: block;
	font-size: 20px;
	line-height: 1.7;
}