* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;
    --text-primary: #e5e5e5;
    --text-secondary: #888;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --border: #2a2a2a;
    --success: #22c55e;
    --error: #ef4444;
    --user-bubble: #2563eb;
    --ai-bubble: #262626;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    justify-content: center;
}

/* 主聊天区域 */
.chat-main {
    flex: 1;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
}

.logo i {
    color: var(--accent);
    font-size: 24px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.model-selector select {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

.model-selector select:focus {
    border-color: var(--accent);
}

.login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.login-btn:hover {
    background: var(--accent-hover);
}

/* 欢迎界面 */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.welcome-icon i {
    font-size: 36px;
    color: var(--accent);
}

.welcome-screen h1 {
    font-size: 32px;
    margin-bottom: 12px;
}

.welcome-screen p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 32px;
}

.feature-tags {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.feature-tags span {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.feature-tags span i {
    color: var(--accent);
}

/* 消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.message {
    display: flex;
    gap: 16px;
    max-width: 800px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    flex-direction: row-reverse;
    margin-left: auto;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.message.ai .message-avatar {
    background: var(--accent);
}

.message.user .message-avatar {
    background: var(--user-bubble);
}

.message-content {
    padding: 14px 18px;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 15px;
}

.message.ai .message-content {
    background: var(--ai-bubble);
    border-bottom-left-radius: 4px;
}

.message.user .message-content {
    background: var(--user-bubble);
    border-bottom-right-radius: 4px;
}

/* 输入区域 */
.chat-input-area {
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border);
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px 12px;
    transition: border-color 0.2s;
}

.input-container:focus-within {
    border-color: var(--accent);
}

.attach-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.attach-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    outline: none;
    max-height: 150px;
    line-height: 1.5;
    padding: 8px 0;
}

#messageInput::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    padding: 8px 4px 0;
    font-size: 12px;
    color: var(--text-secondary);
}

/* 弹窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-header {
    text-align: center;
    margin-bottom: 32px;
}

.modal-logo {
    width: 56px;
    height: 56px;
    background: var(--bg-tertiary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.modal-logo i {
    font-size: 24px;
    color: var(--accent);
}

.modal-header h2 {
    font-size: 22px;
    margin-bottom: 8px;
}

.modal-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 表单 */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
}

.form-group label .required {
    color: var(--error);
    font-size: 12px;
    font-weight: normal;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 14px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
}

.input-wrapper i {
    color: var(--text-secondary);
    font-size: 14px;
}

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    padding: 14px 0;
    outline: none;
}

.input-wrapper input::placeholder {
    color: var(--text-secondary);
}

.form-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.submit-btn:hover {
    background: var(--accent-hover);
}

.form-footer {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.form-footer a {
    color: var(--accent);
    text-decoration: none;
    margin-left: 4px;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 响应式 */
@media (max-width: 768px) {
    .chat-header {
        padding: 12px 16px;
    }
    
    .logo span {
        display: none;
    }
    
    .chat-input-area {
        padding: 12px 16px 16px;
    }
    
    .modal {
        margin: 16px;
        padding: 24px;
    }
}
