:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --text-primary: #eaeaea;
    --text-secondary: #a8a8a8;
    --border-color: #2d3e5f;
    --accent-color: #41585c;
    --success-color: #22c55e;
    --error-color: #ff6b6b;
    --warning-color: #fbbf24;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #efefef;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border-color: #d0d0d0;
    --accent-color: #0084ff;
}

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

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

.app-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
}

/* 側邊欄 */
.sidebar {
    width: 280px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    min-width: 0;
}

.logo-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--accent-color);
}

.logo-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.close-sidebar-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

/* 快速操作 */
.quick-actions {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.quick-action-btn {
    flex: 1;
    padding: 10px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.quick-action-btn .icon {
    font-size: 14px;
}

.quick-action-btn .label {
    display: none;
}

/* 搜尋 */
.search-section {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    position: relative;
    margin-bottom: 8px;
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 8px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
}

.advanced-search {
    display: flex;
    gap: 4px;
}

.search-filter-btn {
    flex: 1;
    padding: 6px;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

.search-filter-btn.active {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* 聊天歷史 */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.history-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.section-header {
    padding: 8px 12px 4px;
    margin-bottom: 4px;
}

.section-header h3 {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
}

.section-content {
    display: flex;
    flex-direction: column;
}

.chat-item {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
    margin: 0 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.chat-item:hover {
    background-color: var(--bg-tertiary);
}

.chat-item.active {
    background-color: var(--accent-color);
    color: white;
}

.chat-item.active .chat-item-meta {
    color: rgba(255, 255, 255, 0.7);
}

.chat-item-header {
    margin-bottom: 6px;
}

.chat-item-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: flex;
    gap: 8px;
}

.chat-model {
    background-color: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.chat-item.active .chat-model {
    background-color: rgba(255, 255, 255, 0.2);
}

.chat-item-title {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-footer {
    display: none;
    gap: 6px;
    font-size: 12px;
}

.chat-item:hover .chat-item-footer {
    display: flex;
}

.chat-star-btn,
.chat-menu-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 12px;
}

.chat-item.active .chat-star-btn,
.chat-item.active .chat-menu-btn {
    color: white;
}

/* 側邊欄底部 */
.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subscription-banner {
    padding: 12px;
    background: linear-gradient(135deg, var(--accent-color), #1a9970);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.banner-icon {
    font-size: 20px;
}

.banner-content {
    flex: 1;
}

.banner-title {
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.banner-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.user-section {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
}

.user-avatar {
    font-size: 20px;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
}

.user-status {
    font-size: 11px;
    color: var(--text-secondary);
}

.footer-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    flex: 1;
    padding: 8px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 側邊欄遮罩 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* 主容器 */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 頂部導航 */
.top-navbar {
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
    background-color: var(--bg-secondary);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.breadcrumb {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.navbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.model-switcher {
    min-width: 150px;
}

.model-select {
    width: 100%;
    padding: 8px 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.model-select:hover {
    border-color: var(--accent-color);
}

.model-select optgroup {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.model-select option {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.navbar-right {
    display: flex;
    gap: 12px;
}

.navbar-action-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: all 0.2s ease;
}

.navbar-action-btn:hover {
    color: var(--accent-color);
}

/* 聊天主區域 */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.welcome-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow-y: auto;
}

.welcome-card {
    text-align: center;
    max-width: 600px;
}

.welcome-header {
    margin-bottom: 40px;
}

.welcome-header h1 {
    font-size: 36px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent-color), #1a9970);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-header p {
    font-size: 18px;
    color: var(--text-secondary);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.feature-item {
    padding: 16px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s ease;
}

.feature-item:hover {
    border-color: var(--accent-color);
    background-color: rgba(0, 212, 255, 0.05);
}

.feature-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.feature-item h4 {
    font-size: 14px;
}

.prompt-showcase {
    text-align: center;
}

.prompt-showcase h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.prompt-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.prompt-card {
    padding: 16px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.prompt-card:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.prompt-category {
    font-size: 20px;
    display: block;
    margin-bottom: 8px;
}

.prompt-card h4 {
    font-size: 13px;
    font-weight: 600;
}

/* 訊息容器 */
.messages-container {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.messages-container.active {
    display: flex;
}

.messages-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

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

.user-message {
    justify-content: flex-end;
}

.user-message .message-content {
    background-color: var(--accent-color);
    color: white;
}

.bot-message {
    justify-content: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 14px;
}

/* 消息內容 */
.message-content {
    padding: 12px 16px;
    background-color: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    min-height: 24px;
}

.message-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.user-message .message-meta {
    text-align: right;
}

.image-message {
    padding: 8px !important;
}

.image-message img {
    max-width: 100%;
    border-radius: 8px;
}

/* 輸入區域 */
.input-section {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    display: flex;
    justify-content: center;
}

.input-editor {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 960px;
}

.input-editor:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

.editor-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.message-input {
    width: 100%;
    min-height: 40px;
    max-height: 200px;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
}

.message-input::placeholder {
    color: var(--text-secondary);
}

.uploaded-images-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
}

.uploaded-image-card {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
}

.uploaded-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

.remove-image-btn:hover {
    background-color: rgba(0, 0, 0, 0.9);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.input-stats {
    display: flex;
    align-items: center;
    gap: 8px;
}

.char-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.char-count.warning {
    color: var(--warning-color);
}

.char-count.error {
    color: var(--error-color);
}

.voice-input-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-input-btn:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.voice-input-btn.recording {
    background-color: var(--error-color);
    border-color: var(--error-color);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(255, 107, 107, 0);
    }
}

.input-actions {
    display: flex;
    gap: 8px;
}

.action-icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-icon-btn:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.send-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    background: linear-gradient(135deg, var(--accent-color), #1a9970);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.send-btn:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
    transform: translateY(-2px);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 右側面板 */
.right-panel {
    width: 300px;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 998;
    overflow: hidden;
}

.right-panel.active {
    transform: translateX(0);
}

.panel-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.right-panel-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 997;
}

.right-panel-overlay.active {
    display: block;
}

/* 側面板 */
.side-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.side-modal-overlay.active {
    display: block;
}

.side-modal {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100%;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    z-index: 1000;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.3);
}

.side-modal.active {
    right: 0;
}

.side-modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.side-modal-header h2 {
    font-size: 18px;
}

.side-modal-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

.side-modal-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-weight: 600;
}

.setting-item {
    margin-bottom: 16px;
}

.setting-item label {
    display: block;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.theme-selector {
    display: flex;
    gap: 8px;
}

.theme-option {
    flex: 1;
    padding: 8px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.theme-option.active {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.setting-item.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-item.checkbox input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.setting-item.checkbox label {
    margin: 0;
    cursor: pointer;
}

.help-section {
    margin-bottom: 24px;
}

.help-section h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-weight: 600;
}

.shortcut-item {
    display: flex;
    gap: 12px;
    padding: 8px;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 13px;
}

.shortcut-item code {
    background-color: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    color: var(--accent-color);
}
/* 輸入區域底部 */
.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    gap: 12px;
}

.input-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.char-count {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.char-count.warning {
    color: var(--warning-color);
}

.char-count.error {
    color: var(--error-color);
}

/* 操作按鈕組 */
.input-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 清除按鈕 */
.action-icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.action-icon-btn:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: scale(1.05);
}

.action-icon-btn:active {
    transform: scale(0.95);
}

/* 語音輸入按鈕 */
.voice-input-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
}

.voice-input-btn:hover {
    background-color: rgba(0, 212, 255, 0.15);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: scale(1.05);
}

.voice-input-btn:active {
    transform: scale(0.95);
}

/* 語音錄音中的脈衝效果 */
.voice-input-btn.recording {
    background-color: var(--error-color);
    border-color: var(--error-color);
    color: white;
    animation: recordingPulse 1.5s ease-in-out infinite;
}

.voice-input-btn.recording:hover {
    background-color: var(--error-color);
    border-color: var(--error-color);
    transform: scale(1.05);
}

@keyframes recordingPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 107, 107, 0);
    }
}

/* 發送按鈕 */
.send-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    background: linear-gradient(135deg, var(--accent-color), #1a9970);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
    font-weight: 600;
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 212, 255, 0.5);
}

.send-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.95);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
}

.send-icon {
    display: inline-block;
    transition: transform 0.2s ease;
}

.send-btn:hover:not(:disabled) .send-icon {
    transform: translateX(2px);
}

/* 語音錄音浮窗 */
.voice-recorder-modal {
    display: none;
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 360px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

.voice-recorder-modal.active {
    display: flex;
    flex-direction: column;
}

.voice-recorder-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.recorder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.recorder-header h3 {
    font-size: 16px;
    margin: 0;
    color: var(--text-primary);
}

.recorder-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: all 0.2s ease;
}

.recorder-close:hover {
    color: var(--accent-color);
    transform: rotate(90deg);
}

.recorder-body {
    padding: 20px 16px;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: center;
}

/* 波形容器 */
.recorder-waveform {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 4px;
    height: 80px;
}

.waveform-bar {
    width: 4px;
    background: linear-gradient(180deg, var(--accent-color), #1a9970);
    border-radius: 2px;
    opacity: 0.6;
    transition: all 0.1s ease;
}

/* 動畫波形 */
.voice-recorder-modal.active .waveform-bar {
    animation: wave 0.6s ease-in-out infinite;
}

.waveform-bar:nth-child(1) { animation-delay: 0s; }
.waveform-bar:nth-child(2) { animation-delay: 0.1s; }
.waveform-bar:nth-child(3) { animation-delay: 0.2s; }
.waveform-bar:nth-child(4) { animation-delay: 0.3s; }
.waveform-bar:nth-child(5) { animation-delay: 0.4s; }
.waveform-bar:nth-child(6) { animation-delay: 0.3s; }
.waveform-bar:nth-child(7) { animation-delay: 0.2s; }
.waveform-bar:nth-child(8) { animation-delay: 0.1s; }
.waveform-bar:nth-child(9) { animation-delay: 0s; }

@keyframes wave {
    0%, 100% {
        height: 20%;
        opacity: 0.6;
    }
    50% {
        height: 100%;
        opacity: 1;
    }
}

/* 計時器 */
.recorder-time {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent-color);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* 狀態文字 */
.recorder-status {
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.recorder-status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #22c55e;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* 轉錄文本框 */
.recorder-transcript {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.2s ease;
}

.recorder-transcript small {
    display: block;
    line-height: 1.5;
}

.recorder-transcript.has-text {
    border-color: var(--accent-color);
    background-color: rgba(0, 212, 255, 0.05);
    color: var(--text-primary);
}

/* 底部按鈕區域 */
.recorder-footer {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.recorder-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recorder-btn.cancel {
    background-color: rgba(168, 168, 168, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.recorder-btn.cancel:hover:not(:disabled) {
    background-color: var(--border-color);
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.recorder-btn.send {
    background: linear-gradient(135deg, var(--accent-color), #1a9970);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.recorder-btn.send:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(0, 212, 255, 0.5);
    transform: translateY(-1px);
}

.recorder-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1100;
}

.toast {
    padding: 12px 16px;
    background-color: var(--success-color);
    color: white;
    border-radius: 6px;
    font-size: 13px;
    animation: slideUp 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.toast.error {
    background-color: var(--error-color);
}

.toast.warning {
    background-color: var(--warning-color);
    color: #000;
}

.toast.info {
    background-color: var(--accent-color);
    color: white;
}

/* 加載指示器 */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out;
}

.loading-indicator.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(0, 212, 255, 0.2);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 打字機效果和加載指示 */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 12px 0;
    align-items: center;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-color);
    animation: typing 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 100% {
        opacity: 0.4;
        transform: translateY(0px);
    }
    50% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

/* 訊息文本容器 */
.message-text-container {
    min-height: 24px;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        height: 100vh;
        top: 0;
        transition: left 0.3s ease;
        z-index: 1000;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-toggle-btn {
        display: block;
    }

    .close-sidebar-btn {
        display: block;
    }

    .quick-action-btn .label {
        display: none;
    }

    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .prompt-grid {
        grid-template-columns: 1fr;
    }

    .message-content {
        max-width: 100%;
    }

    .side-modal {
        width: 100%;
        right: -100%;
    }

    .right-panel {
        width: 100%;
        right: -100%;
    }

    .voice-recorder-modal {
        width: calc(100% - 40px);
        right: 20px;
        bottom: 100px;
    }
}