/* =====================
   全局樣式
   ===================== */

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

:root {
    --primary-color: #6b4423;
    --primary-light: #8b6934;
    --primary-dark: #5a3818;
    --secondary-color: #f5e6d3;
    --text-color: #2c1810;
    --text-light: #6b5344;
    --border-color: #dcc7b0;
    --bg-color: #ffffff;
    --bg-light: #faf8f5;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    background-color: #f3f4f6;
    color: var(--text-color);
}

/* =====================
   容器布局
   ===================== */

.container {
    display: flex;
    height: 100vh;
    width: 100%;
    background-color: var(--bg-light);
}

/* =====================
   側邊欄樣式
   ===================== */

.sidebar {
    width: 280px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    padding: 0;
}

.sidebar-header {
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-row {
    padding: 20px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    line-height: 2.0;
    flex: 1;
}

.logo-image {
    height: 140px;
    width: auto;
    object-fit: contain;
    display: block;
    margin: 15px auto;
}

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

.logo-text {
    font-size: 18px;
    background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 側邊欄關閉按鍵 */
.btn-close-sidebar {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
    line-height: 1;
}

.btn-close-sidebar:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 新對話按鈕 */
.btn-new-chat {
    margin: 16px 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-new-chat:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.btn-new-chat .icon {
    font-size: 18px;
}

/* 對話歷史部分 */
.conversation-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px;
    min-height: 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 8px;
    margin-bottom: 8px;
}

.section-header h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.btn-icon {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 8px;
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(180deg);
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.conversation-item {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    word-break: break-word;
    display: flex;
    align-items: center;
    justify-content: space-between;
    group: hover;
}

.conversation-item:hover {
    background: rgba(255, 255, 255, 0.2);
    padding-left: 16px;
}

.conversation-item-delete {
    opacity: 0;
    font-size: 12px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}

.conversation-item:hover .conversation-item-delete {
    opacity: 1;
}

.conversation-item-delete:hover {
    background: rgba(255, 0, 0, 0.3);
}

/* 側邊欄底部 */
.sidebar-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.btn-secondary {
    flex: 1 1 calc(50% - 4px);
    min-width: 80px;
    padding: 10px 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.btn-secondary .icon {
    font-size: 16px;
}

/* =====================
   聊天容器
   ===================== */

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-light);
    position: relative;
}

/* 聊天歷史 */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chat-history::-webkit-scrollbar {
    width: 8px;
}

.chat-history::-webkit-scrollbar-track {
    background: transparent;
}

.chat-history::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.chat-history::-webkit-scrollbar-thumb:hover {
    background: #d1d5db;
}

/* 歡迎訊息 */
.welcome-message {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 24px;
}

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

.welcome-content h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 12px;
}

.welcome-content .subtitle {
    font-size: 16px;
    color: var(--text-light);
    margin-bottom: 24px;
}

.welcome-tips {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: left;
    box-shadow: var(--shadow);
}

.welcome-tips p {
    margin-bottom: 12px;
    color: var(--text-color);
    font-size: 14px;
}

.welcome-tips p strong {
    color: var(--primary-color);
}

.welcome-tips ul {
    list-style: none;
    margin-bottom: 16px;
    padding-left: 0;
}

.welcome-tips li {
    padding: 8px 0;
    color: var(--text-color);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.welcome-tips li:before {
    content: "✓";
    color: var(--primary-light);
    font-weight: bold;
}

.disclaimer {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 12px;
    border-radius: 8px;
    color: #92400e;
    font-size: 12px !important;
    margin-top: 16px;
}

/* 聊天訊息 */
.message {
    display: flex;
    margin-bottom: 12px;
    animation: fadeInUp 0.3s ease-out;
}

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

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

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

.message-content {
    max-width: 70%;
    padding: 14px 16px;
    border-radius: var(--border-radius);
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.message-user .message-content {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-assistant .message-content {
    background: var(--bg-color);
    color: var(--text-color);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.message-time {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

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

/* 聊天輸入區域 */
.chat-input-area {
    padding: 16px 24px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

#chatInput {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-color);
    resize: vertical;
    min-height: 44px;
    max-height: 120px;
    transition: var(--transition);
}

#chatInput:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(139, 105, 52, 0.1);
    background: var(--bg-color);
}

.btn-send {
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 80px;
    align-self: stretch;
    box-shadow: 0 2px 8px rgba(107, 68, 35, 0.15);
}

.btn-send:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(107, 68, 35, 0.2);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
}

.btn-send:active:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(107, 68, 35, 0.15);
}

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

.btn-send .icon {
    font-size: 18px;
}

.btn-send .text {
    font-size: 12px;
}

.input-options {
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-light);
    cursor: pointer;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-light);
}

.status-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--success-color, #4CAF50);
    cursor: default;  /* 禁用 pointer cursor，因為無法點擊 */
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background-color: var(--success-color, #4CAF50);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

/* =====================
   按鈕樣式
   ===================== */

.btn-primary {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 68, 35, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* =====================
   模態對話框
   ===================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

.modal-lg {
    max-width: 700px;
}

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

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

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
}

/* 登入模態框特殊樣式 */
.modal-auth .modal-header {
    background: linear-gradient(135deg, #f5f7fa 0%, #ffffff 100%);
}

.modal-auth .modal-header .language-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--text-color);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-color);
    transition: var(--transition);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(139, 105, 52, 0.1);
}

/* 對話文件列表 */
.conversation-files-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.conversation-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.conversation-file-item:hover {
    background: #f0fdf4;
    border-color: var(--primary-light);
}

.file-item-info {
    flex: 1;
}

.file-item-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
    margin-bottom: 4px;
}

.file-item-meta {
    font-size: 12px;
    color: var(--text-light);
}

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

.btn-icon-small {
    padding: 6px 10px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
}

.btn-icon-small:hover {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

/* =====================
   加載指示器
   ===================== */

.loading-indicator {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 32px;
    border-radius: var(--border-radius);
    text-align: center;
    z-index: 2000;
    box-shadow: var(--shadow-lg);
}

.loading-indicator.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* =====================
   通知
   ===================== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    z-index: 9999 !important;
    transform: translateX(500px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--primary-light);
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    display: block !important;
    visibility: visible !important;
}

.notification.show {
    transform: translateX(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.notification.error {
    border-left-color: #dc2626;
    background: #fef2f2;
    color: #7f1d1d;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15), 0 0 0 3px rgba(220, 38, 38, 0.1);
    font-weight: 500;
}

.notification.success {
    border-left-color: #10b981;
    background: #f0fdf4;
    color: #065f46;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15), 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.notification.info {
    border-left-color: var(--primary-light);
    background: #f0fdfa;
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(var(--primary-light-rgb), 0.15);
}

/* =====================
   漢堡菜單樣式
   ===================== */

.hamburger-menu {
    display: none;
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 500;
    background: rgba(107, 68, 35, 0.1);
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.hamburger-menu:hover {
    background: rgba(107, 68, 35, 0.2);
}

.hamburger-menu span {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--primary-color);
    margin: 5px 0;
    border-radius: 2px;
    transition: var(--transition);
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* =====================
   響應式設計
   ===================== */

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

    .hamburger-menu {
        display: block;
    }

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

    .sidebar {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 400;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-header {
        min-width: auto;
        flex-shrink: 0;
    }

    .conversation-section {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }

    .chat-history {
        padding: 16px;
        padding-top: 70px;
    }

    .message-content {
        max-width: 85%;
        font-size: 13px;
    }

    .chat-input-area {
        padding: 12px 16px;
    }

    .modal-content {
        width: 95%;
    }

    .modal-lg {
        max-width: 95%;
    }

    .btn-secondary .text {
        display: none;
    }

    .btn-secondary {
        flex: 1 1 calc(50% - 4px);
    }

    .sidebar-footer {
        flex-wrap: wrap;
        flex-shrink: 0;
        margin-top: auto;
    }
}

@media (max-width: 480px) {
    .welcome-content h2 {
        font-size: 24px;
    }

    .message-content {
        max-width: 90%;
        font-size: 12px;
        padding: 10px 12px;
    }

    .chat-history {
        padding: 12px;
        gap: 8px;
    }

    .disclaimer {
        font-size: 11px !important;
    }
}

/* =====================
   身份驗證樣式
   ===================== */

#loginModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

#loginModal[style*="display: none"] {
    display: none !important;
}

.modal-auth {
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
}

.auth-tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-light);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}

.auth-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.auth-form.active {
    display: flex;
}

.input-field {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(107, 68, 35, 0.1);
}

.auth-hint {
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
    margin-top: 8px;
}

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.btn-icon:hover {
    background-color: var(--bg-light);
}

.user-menu-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 200px;
    display: none;
    flex-direction: column;
    z-index: 1000;
    margin-bottom: 8px;
}

.user-menu-dropdown.show {
    display: flex;
}

.user-menu-username {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

.user-menu-dropdown .btn-secondary {
    border: none;
    margin: 0;
    border-radius: 0;
    text-align: left;
    justify-content: flex-start;
    padding: 12px 16px;
    color: var(--text-color);
    background: white;
}

.user-menu-dropdown .btn-secondary:hover {
    background-color: var(--bg-light);
    color: var(--text-color);
}

#mainContainer {
    display: flex;
    flex: 1;
    width: 100%;
}

.conversation-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: var(--transition);
}

.conversation-file-item:hover {
    background-color: var(--bg-light);
    border-color: var(--primary-light);
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.file-meta {
    font-size: 12px;
    color: var(--text-light);
}

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

/* =====================
   等待訊息動畫
   ===================== */

.waiting-message {
    animation: fadeInUp 0.4s ease-out;
}

.waiting-message.message-assistant .message-content {
    background: linear-gradient(135deg, #e8dcc8 0%, #d4c4ac 100%) !important;
    color: #6b4423 !important;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: none !important;
}

.waiting-text {
    display: inline-flex;
    align-items: center;
    animation: blink 1.5s infinite;
}

.waiting-text::after {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background-color: #6b4423;
    border-radius: 50%;
    margin-left: 2px;
    animation: dotBounce 1.5s infinite;
}

/* 淡入淡出上升動畫 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 點點跳躍動畫 */
@keyframes dotBounce {
    0%, 20%, 50%, 80%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    40% {
        opacity: 0.6;
        transform: scale(0.8);
    }
    60% {
        opacity: 0.3;
        transform: scale(1.2);
    }
}

/* 閃爍動畫 */
@keyframes blink {
    0%, 49%, 100% {
        opacity: 1;
    }
    50%, 99% {
        opacity: 0.7;
    }
}

/* =====================
   語言選擇器樣式
   ===================== */

.language-selector {
    display: flex;
    align-items: center;
}

.language-selector-icon {
    display: flex;
    align-items: center;
    margin-right: 8px;
}

.lang-select {
    padding: 8px 12px;
    border: 2px solid white;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.lang-select:hover {
    background-color: rgba(0, 0, 0, 0.5);
    border-color: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.lang-select-icon {
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 70px;
}

.lang-select-icon:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.lang-select option {
    background-color: var(--primary-color);
    color: white;
    padding: 8px;
}

/* 登入頁面語言選擇器 - 覆蓋深色背景樣式 */
.modal-auth .lang-select {
    background-color: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    font-weight: 600;
}

.modal-auth .lang-select:hover {
    background-color: #faf8f5;
    border-color: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(107, 68, 35, 0.2);
}

.modal-auth .lang-select option {
    background-color: white;
    color: var(--text-color);
    padding: 10px;
}

.modal-auth .language-selector span {
    color: var(--primary-color);
    font-size: 16px;
}

.user-menu-dropdown .lang-select {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    color: #333;
    font-weight: 500;
}

.user-menu-dropdown .lang-select:hover {
    background-color: #efefef;
    border-color: #999;
    box-shadow: none;
}

.user-menu-dropdown .lang-select option {
    background-color: white;
    color: #333;
    padding: 10px;
}

.header-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 暫時隱藏 Save 和 Load 按鈕 */
#btnClearChat ~ button:nth-of-type(2),
#btnClearChat ~ button:nth-of-type(3) {
    display: none;
}
