/* --- 變數定義 --- */
:root {
    --primary: #2563eb;
    --primary-bg: #eff6ff;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-chat: #f1f5f9;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --bubble-bot: #ffffff;
    --bubble-user: #2563eb;
    --bubble-user-text: #ffffff;
}

[data-theme="dark"] {
    --primary: #60a5fa;
    --primary-bg: #1e293b;
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-chat: #020617;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.5);
    --bubble-bot: #334155;
    --bubble-user: #3b82f6;
    --bubble-user-text: #ffffff;
}

body { margin: 0; font-family: 'Noto Sans TC', sans-serif; background: var(--bg-body); color: var(--text-main); line-height: 1.6; transition: background 0.3s, color 0.3s; }
.container { max-width: 900px; margin: 0 auto; padding: 0 20px; }

/* Navbar */
.navbar { background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 10px 0; position: sticky; top: 0; z-index: 100; }
.nav-content { display: flex; justify-content: space-between; align-items: center; }
.logo { font-weight: 700; color: var(--primary); font-size: 1.2rem; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.theme-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 5px; border-radius: 50%; }
.theme-btn:hover { background: var(--border); }
[data-theme="light"] .icon-moon { display: inline; } [data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; } [data-theme="dark"] .icon-sun { display: inline; color: #fbbf24; }
select { background: var(--bg-body); color: var(--text-main); border: 1px solid var(--border); padding: 5px; border-radius: 5px; }

/* Hero */
.hero { text-align: center; padding: 60px 0; }
.hero h1 { font-size: 2rem; margin-bottom: 10px; }
.hero-buttons { display: flex; justify-content: center; gap: 15px; margin-top: 30px; flex-wrap: wrap; }
.cta-btn { padding: 10px 25px; border-radius: 50px; cursor: pointer; font-weight: 600; border: 2px solid var(--primary); transition: 0.2s; }
.cta-btn.primary { background: var(--primary); color: white; }
.cta-btn.outline { background: transparent; color: var(--primary); }
.cta-btn:hover { transform: translateY(-2px); opacity: 0.9; }

/* Chat */
.chat-section { padding: 30px 0; background: var(--bg-chat); min-height: 80vh; }
.chat-interface { background: var(--bg-card); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; height: 75vh; }
.chat-header-bar { padding: 15px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.status-dot { width: 8px; height: 8px; background: #10b981; border-radius: 50%; display: inline-block; margin-right: 5px; }
.export-btn { background: var(--border); border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; color: var(--text-main); }

/* Quick Actions */
.quick-actions-bar { padding: 10px 15px; background: var(--primary-bg); display: flex; gap: 10px; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; border-bottom: 1px solid var(--border); }
.quick-actions-bar::-webkit-scrollbar { height: 0; }
.chip-btn { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-main); padding: 6px 12px; border-radius: 20px; cursor: pointer; flex-shrink: 0; transition: 0.2s; font-size: 0.9rem; }
.chip-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Messages */
.chat-box { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.message { display: flex; width: 100%; }
.message.user { justify-content: flex-end; }
.message.bot { justify-content: flex-start; }
.bubble { max-width: 85%; padding: 12px 16px; border-radius: 18px; font-size: 0.95rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.message.bot .bubble { background: var(--bubble-bot); color: var(--text-main); border: 1px solid var(--border); border-bottom-left-radius: 2px; }
.message.user .bubble { background: var(--bubble-user); color: var(--bubble-user-text); border-bottom-right-radius: 2px; }

/* Input */
.input-area { padding: 15px; border-top: 1px solid var(--border); background: var(--bg-card); display: flex; gap: 10px; align-items: flex-end; }
textarea { flex: 1; padding: 10px; border: 1px solid var(--border); background: var(--bg-body); color: var(--text-main); border-radius: 10px; resize: none; outline: none; font-size: 1rem; max-height: 120px; font-family: inherit; }
textarea:focus { border-color: var(--primary); }
#sendBtn, #stopBtn { width: 40px; height: 40px; color: white; border: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }
#sendBtn { background: var(--primary); }
#sendBtn:hover, #stopBtn:hover { opacity: 0.9; transform: scale(1.05); }

/* Cursor Animation */
.cursor { display: inline-block; width: 8px; height: 18px; background-color: var(--primary); margin-left: 2px; vertical-align: middle; animation: blink 1s step-end infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

@media (max-width: 768px) {
    .hero h1 { font-size: 1.6rem; }
    .chat-interface { height: 80vh; border-radius: 0; }
    .container { padding: 0 15px; }
}