:root {
    --bg-dark: #0f1117;
    --sidebar-bg: #161922;
    --message-user: #3b82f6;
    --message-bot: #262b37;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #6366f1;
    --glass: rgba(255, 255, 255, 0.03);
    --border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Outfit', 'Noto Sans TC', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-header p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
    margin-bottom: 1.5rem;
}

.new-chat-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
}

.chat-history-container {
    flex: 1;
    overflow-y: auto;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.chat-history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s;
}

.history-item:hover {
    background: var(--glass);
    color: var(--text-primary);
}

.history-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    border-left: 3px solid var(--accent);
}

.status-indicator {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: radial-gradient(circle at 50% 50%, #1a1e2e 0%, #0f1117 100%);
}

.chat-header {
    height: 60px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.badge {
    background: var(--glass);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    border: 1px solid var(--border);
    margin-right: 0.5rem;
}

.model-select {
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    max-width: 80%;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 0.95rem;
    animation: fadeIn 0.3s ease-out;
}

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

.user-message {
    align-self: flex-end;
    background: var(--message-user);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message {
    align-self: flex-start;
    background: var(--message-bot);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.system-message {
    align-self: center;
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
}

/* Input Area */
.input-area {
    padding: 2rem;
    background: linear-gradient(transparent, var(--bg-dark));
}

.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px;
    display: flex;
    align-items: flex-end;
    transition: border-color 0.2s;
    gap: 8px;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

.attachment-tools {
    display: flex;
    gap: 4px;
    padding-bottom: 4px;
}

.tool-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: var(--glass);
    color: var(--text-primary);
    border-color: var(--border);
}

.attachment-preview {
    max-width: 800px;
    margin: 0 auto 8px auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-badge {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.remove-attachment {
    cursor: pointer;
    color: #ef4444;
    font-weight: bold;
}

.path-input-container {
    max-width: 800px;
    margin: 8px auto 0 auto;
    display: flex;
    gap: 8px;
    background: var(--glass);
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.path-input-container input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}

.path-input-container button {
    background: var(--message-bot);
    color: white;
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 12px;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    max-height: 200px;
    outline: none;
}

#send-btn {
    background: var(--accent);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    margin-bottom: 4px;
    margin-right: 4px;
}

#send-btn:hover {
    background: #4f46e5;
    transform: scale(1.05);
}

#send-btn svg {
    width: 20px;
    height: 20px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
