/* 前端样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* 顶部导航 */
.top-nav {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
}

.nav-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.points-display {
    background: #667eea;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-outline {
    background: transparent;
    border: 2px solid #667eea;
    color: #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

/* 聊天容器 */
.chat-container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.chat-main {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.message {
    margin-bottom: 25px;
    display: flex;
    gap: 15px;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: #667eea;
    color: white;
}

.message.ai .message-avatar {
    background: #f0f0f0;
    color: #666;
}

.message-content {
    flex: 1;
    max-width: 70%;
}

.message-bubble {
    padding: 15px 20px;
    border-radius: 15px;
    line-height: 1.6;
    word-wrap: break-word;
}

.message.user .message-bubble {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 5px;
}

.message.ai .message-bubble {
    background: #f5f5f5;
    color: #333;
    border-bottom-left-radius: 5px;
}

.message-time {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.compose {
    display: grid;
    grid-template-columns: 1fr 0.18fr;
    gap: 10px;
    align-items: start;
}

.compose-side {
    border: 2px dashed #eee;
    border-radius: 10px;
    padding: 10px;
    min-height: 120px;
    background: #fafafa;
}

.chat-input {
    flex: 1;
    padding: 16px;
    border: 2px solid #eee;
    border-radius: 10px;
    font-size: 16px;
    resize: none;
    font-family: inherit;
    min-height: 140px;
    max-height: 260px;
}
.chat-input-large{width:100%;min-height:120px;font-size:16px}

.chat-input:focus {
    outline: none;
    border-color: #667eea;
}

.compose-actions {
    display: flex;
    justify-content: flex-end;
}

.send-btn {
    padding: 15px 30px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.send-btn:hover {
    background: #5568d3;
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 侧边栏 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.sidebar-card h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

.model-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.model-item {
    padding: 12px;
    border: 2px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.model-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.model-item.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.model-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.model-info {
    font-size: 12px;
    color: #999;
}

.model-item.active .model-info {
    color: rgba(255,255,255,0.9);
}

.points-info {
    text-align: center;
    padding: 15px;
    background: #f8f9ff;
    border-radius: 8px;
    margin-bottom: 15px;
}

.points-info .label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.points-info .value {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
}

/* 底部信息 */
.footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    margin-top: 40px;
    text-align: center;
    color: #666;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #667eea;
}

.footer-copyright {
    font-size: 12px;
}

/* 模态框 */
.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;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 25px;
    text-align: center;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.error-message {
    color: #e74c3c;
    margin-top: 10px;
    padding: 10px;
    background: #fee;
    border-radius: 5px;
    text-align: center;
    font-size: 12px;
}

.chat-toolbar{display:flex;justify-content:space-between;align-items:center;padding:12px 20px;border-bottom:1px solid #eee}
.session-select{flex:1;padding:8px;border:2px solid #eee;border-radius:8px;margin-right:10px}
.toolbar-actions{display:flex;gap:10px}
.prompt-input{width:100%;padding:10px;border:2px solid #eee;border-radius:8px;margin:10px 0}
.input-row{display:flex;gap:10px;align-items:center}
.file-input{padding:8px}
.attachments-preview{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.attachments-preview img{width:60px;height:60px;border-radius:8px;object-fit:cover;border:1px solid #eee}
.attachments-preview .att{background:#f5f5f5;border:1px solid #eee;border-radius:6px;padding:6px 8px;font-size:12px}
.message-actions{display:flex;gap:8px;margin-top:8px}
.icon-btn{padding:6px 10px;border:1px solid #ddd;border-radius:6px;background:#fff;cursor:pointer;font-size:12px;transition:all 0.2s}
.icon-btn:hover{background:#f8f9ff;border-color:#667eea;color:#667eea}

/* 思考状态动画 */
.message.thinking .message-bubble {
    background: #f0f0f0;
    padding: 15px 20px;
}

.thinking-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: thinking-pulse 1.4s ease-in-out infinite;
}

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

.thinking-dot:nth-child(3) {
    animation-delay: 0.4s;
}

.thinking-text {
    color: #666;
    font-size: 14px;
}

@keyframes thinking-pulse {
    0%, 100% {
        opacity: 0.4;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Markdown 样式优化 */
.message-bubble code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.message-bubble pre {
    background: #282c34;
    color: #abb2bf;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
    line-height: 1.5;
}

.message-bubble pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: 0.9em;
}

.message-bubble strong {
    font-weight: 600;
    color: #333;
}

.message-bubble em {
    font-style: italic;
    color: #555;
}

.message-bubble a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.message-bubble a:hover {
    border-bottom-color: #667eea;
}

/* 代码高亮（简单版本） */
.message-bubble pre code.language-php,
.message-bubble pre code.language-javascript,
.message-bubble pre code.language-python,
.message-bubble pre code.language-html,
.message-bubble pre code.language-css,
.message-bubble pre code.language-json {
    display: block;
}
.msg-media{max-width:100%;border-radius:10px}
/* 响应式 */
@media (max-width: 1024px) {
    .chat-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        order: -1;
    }
}

@media (max-width: 768px) {
    .top-nav {
        padding: 10px 15px;
    }
    
    .nav-left {
        font-size: 18px;
    }
    
    .chat-container {
        padding: 0 10px;
    }
    
    .chat-main {
        height: calc(100vh - 150px);
    }
}


