﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

:root {
    --primary-color: #1890ff;           /* 更专业的蓝色 */
    --primary-light: #f0f8ff;           /* 浅蓝背景 */
    --primary-dark: #096dd9;            /* 深蓝 */
    --secondary-color: #fafafa;         /* 更柔和的背景 */
    --tertiary-color: #f5f5f5;          /* 三级背景 */
    --text-primary: #141414;            /* 更深的文字 */
    --text-secondary: #8c8c8c;          /* 次要文字 */
    --text-tertiary: #bfbfbf;           /* 三级文字 */
    --border-color: #e8e8e8;            /* 边框色 */
    --border-light: #f0f0f0;            /* 浅边框 */
    --success-color: #52c41a;           /* 成功绿 */
    --warning-color: #faad14;           /* 警告橙 */
    --error-color: #ff4d4f;             /* 错误红 */
    --like-color: #52c41a;              /* 点赞绿 */
    --dislike-color: #ff4d4f;           /* 点踩红 */
    --hover-bg: #f8f9fa;                /* 悬停背景 */
    --active-bg: #e6f7ff;               /* 激活背景 */
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #ffffff 100%);
    height: 100vh;
    overflow: hidden;
    color: var(--text-primary);
}

.app-container {
    display: flex;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    box-shadow: 0 0 40px rgba(0,0,0,0.08);
}

/* ========== 侧边栏 - 更简洁现代 ========== */
.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0,0,0,0.04);
}

.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-header h2 {
    color: var(--primary-color);
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.sidebar-header h2 i {
    font-size: 22px;
    color: var(--primary-color);
}

.new-chat-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    justify-content: center;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.new-chat-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(24,144,255,0.3);
}

.sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* 滚动条美化 */
.sessions-list::-webkit-scrollbar {
    width: 4px;
}
.sessions-list::-webkit-scrollbar-track {
    background: transparent;
}
.sessions-list::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 2px;
}

.session-item {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.session-item:hover {
    background: var(--hover-bg);
    transform: translateX(2px);
}

.session-item.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(24,144,255,0.1);
}

.session-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.session-preview {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

/* ========== 主内容区 - 更开阔现代 ========== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.chat-header {
    padding: 24px 24px 20px;
    border-bottom: 1px solid var(--border-light);
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--error-color);
    transition: all 0.3s ease;
}

.status-dot.connected {
    background: var(--success-color);
}

.status-dot.connecting {
    background: var(--warning-color);
    animation: pulse 1.5s infinite;
}

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

/* ========== 聊天区域 - 更大气舒适 ========== */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px 24px;
    background: white;
    background-image:
            radial-gradient(circle at 25px 25px, rgba(24,144,255,0.03) 2px, transparent 0),
            radial-gradient(circle at 75px 75px, rgba(24,144,255,0.03) 2px, transparent 0);
    background-size: 100px 100px;
}

/* 超大滚动条 */
.chat-container::-webkit-scrollbar {
    width: 6px;
}
.chat-container::-webkit-scrollbar-track {
    background: transparent;
}
.chat-container::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}
.chat-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.message {
    display: flex;
    margin-bottom: 32px;
    animation: fadeIn 0.4s ease;
    position: relative;
}

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

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.message.user .message-avatar {
    background: var(--primary-color);
    color: white;
    margin-left: 16px;
}

.message.bot .message-avatar {
    background: var(--secondary-color);
    color: var(--text-primary);
    margin-right: 16px;
    border: 1px solid var(--border-light);
}

.message-content {
    max-width: 75%;
    position: relative;
}

.message-bubble {
    padding: 16px 20px;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 15px;
    word-wrap: break-word;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    border: 1px solid transparent;
}

.message.user .message-bubble {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 12px rgba(24,144,255,0.15);
}

.message.bot .message-bubble {
    background: var(--tertiary-color);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
    border: 1px solid var(--border-light);
}

.message-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 8px;
    text-align: right;
}

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

.message.bot .message-time {
    text-align: left;
}

.message-image {
    max-width: 320px;
    max-height: 320px;
    border-radius: 12px;
    margin-top: 12px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.message-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.message-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-top: 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 13px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.message-file:hover {
    background: var(--hover-bg);
    border-color: var(--border-color);
    transform: translateY(-1px);
}

.file-icon {
    font-size: 16px;
    color: var(--primary-color);
}

.generated-image {
    max-width: 320px;
    max-height: 320px;
    border-radius: 12px;
    margin-top: 12px;
    border: 2px solid var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 12px rgba(24,144,255,0.2);
}

.generated-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(24,144,255,0.3);
}

/* ========== 输入区域 - 更现代简洁 ========== */
.input-area {
    padding: 24px;
    background: white;
    border-top: 1px solid var(--border-light);
    position: relative;
}

.mode-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    background: var(--tertiary-color);
    padding: 4px;
    border-radius: 12px;
}

.mode-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.mode-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    font-weight: 600;
}

.input-container {
    position: relative;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    background: white;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.input-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(24,144,255,0.1);
}

.textarea-wrapper {
    position: relative;
}

.message-input {
    width: 100%;
    min-height: 64px;
    max-height: 200px;
    padding: 18px 60px 18px 20px;
    border: none;
    border-radius: 16px;
    resize: none;
    font-size: 15px;
    line-height: 1.6;
    outline: none;
    font-family: inherit;
    background: transparent;
}

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

.input-actions {
    position: absolute;
    right: 16px;
    bottom: 16px;
    display: flex;
    gap: 6px;
}

.action-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    font-size: 14px;
}

.action-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    transform: scale(1.05);
}

.action-btn.primary {
    background: var(--primary-color);
    color: white;
    font-size: 14px;
}

.action-btn.primary:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(24,144,255,0.3);
}

.action-btn.stop {
    background: var(--error-color);
    color: white;
    font-size: 14px;
}

.action-btn.stop:hover {
    background: #d9363e;
    transform: scale(1.05);
}

.action-btn.upload-file {
    background: var(--primary-color);
    color: white;
    font-size: 14px;
}

.action-btn.upload-file:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.drop-zone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(24,144,255,0.05);
    border: 2px dashed var(--primary-color);
    border-radius: 16px;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 10;
    transition: all 0.2s ease;
}

.drop-zone.active {
    display: flex;
}

.drop-zone i {
    color: var(--primary-color);
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.drop-zone p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
    text-align: center;
}

.upload-preview {
    display: flex;
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    gap: 12px;
    flex-wrap: wrap;
}

.file-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.file-item:hover {
    transform: scale(1.05);
}

.file-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(255,77,79,0.9);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    z-index: 2;
    transition: all 0.2s ease;
}

.file-remove:hover {
    background: var(--error-color);
    transform: scale(1.1);
}

/* ========== 消息操作 - 更优雅 ========== */
.message-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.message:hover .message-actions {
    opacity: 1;
}

.action-btn-small {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
    transition: all 0.2s ease;
}

.action-btn-small:hover {
    background: var(--hover-bg);
    border-color: var(--border-color);
    transform: scale(1.05);
}

.action-btn-small.copy:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.action-btn-small.like.active {
    background: var(--like-color);
    color: white;
    border-color: var(--like-color);
}

.action-btn-small.dislike.active {
    background: var(--dislike-color);
    color: white;
    border-color: var(--dislike-color);
}

.action-btn-small i {
    font-size: 12px;
}

/* ========== 反馈和状态 ========== */
.message-feedback {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.feedback-text {
    font-size: 11px;
    opacity: 0.8;
}

.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 0;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: bounce 1.4s infinite;
}

.thinking-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.0);
        opacity: 1;
    }
}

/* ========== 工具类和优化 ========== */
/* 按钮点击效果 */
.action-btn:active,
.message-avatar:active,
.file-item:active {
    transform: scale(0.95);
}

/* 焦点状态优化 */
.message-input:focus {
    outline: none;
}

/* 加载状态 */
.status-dot.connecting {
    animation: pulse 1.5s infinite;
}

/* 响应式优化（如果需要） */
@media (max-width: 768px) {
    .sidebar { width: 100%; }
    .message-content { max-width: 85%; }
    .chat-container { padding: 20px 16px; }
    .input-area { padding: 16px; }
}

/* ========== 终极视觉优化 ========== */
/* 消息气泡圆角优化 */
.message.user .message-bubble {
    border-bottom-right-radius: 8px;
}

.message.bot .message-bubble {
    border-bottom-left-radius: 8px;
}

/* 头像字体大小 */
.message-avatar {
    font-size: 16px;
    font-weight: 600;
}

/* 输入框智能调整 */
.message-input {
    font-size: 15px;
    line-height: 1.6;
}

/* 欢迎消息特殊样式 */
.message.bot:first-child .message-bubble {
    background: linear-gradient(135deg, var(--tertiary-color) 0%, #f0f8ff 100%);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.7;
}

/* 最终的整体视觉提升 */
.app-container {
    backdrop-filter: blur(0px);
}

/* 消除默认样式干扰 */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}