/* Chat页面样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #ffffff;
    color: #2d333a;
    overflow-x: auto;
    min-width: 1500px;
}

.hero-section {
    width: 100%;
    min-height: 100vh;
    background-color: #ffffff;
    background-image: url('../images/back.jpg');
    background-size: 100% 900px;
    background-position: center top;
    background-repeat: no-repeat;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    padding-top: 108px;
    padding-left: 40px;
    padding-right: 40px;
    padding-bottom: 40px;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 900px;
    background: rgba(0, 0, 0, 0.1);
}

.chat-page-container.white-container {
    position: relative;
    z-index: 10;
    background: #ffffff;
    border-radius: 20px;
    padding: 0;
    width: 1420px;
    max-width: calc(100% - 80px);
    min-height: 800px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-container {
    display: flex;
    height: 800px; /* 固定高度以适应白色容器 */
    max-width: 100%;
    margin: 0;
    background: transparent; /* 透明背景，使用容器的白色背景 */
    flex: 1;
}

.chat-sidebar {
    width: 280px;
    background: #f9fafb; /* 浅灰色背景以区分 */
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    background: #10a37f;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.new-chat-btn:hover {
    background: #0d8c6d;
}

.chat-sessions {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.session-item {
    padding: 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.session-item:hover {
    background: #ffffff;
}

.session-item.active {
    background: #e5e7eb;
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-name {
    font-size: 14px;
    font-weight: 500;
    color: #2d333a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-preview {
    font-size: 12px;
    color: #6e6e80;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.session-actions {
    display: none;
    gap: 4px;
}

.session-item:hover .session-actions {
    display: flex;
}

.session-action-btn {
    padding: 4px 8px;
    background: none;
    border: none;
    color: #6e6e80;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
}

.session-action-btn:hover {
    background: #e5e7eb;
    color: #2d333a;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.chat-header {
    display: none;
}

.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-in;
}

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

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #10a37f;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: #5436da;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-role {
    font-size: 12px;
    font-weight: 600;
    color: #2d333a;
    margin-bottom: 8px;
}

.message-text {
    font-size: 15px;
    line-height: 1.6;
    color: #2d333a;
    word-wrap: break-word;
}

.message-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.message-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-image:hover {
    transform: scale(1.05);
}

.message-text pre {
    background: #f3f4f6;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-text code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

.chat-input-container {
    padding: 16px 24px 24px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.chat-input-wrapper {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.input-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #6e6e80;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 16px;
}

.tool-btn:hover {
    background: #f3f4f6;
    color: #2d333a;
}

.model-select {
    padding: 6px 12px 6px 32px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    background: white url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%2310a37f"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"/></svg>') no-repeat 8px center;
    background-size: 18px 18px;
    font-size: 13px;
    cursor: pointer;
    min-width: 180px;
    color: #2d333a;
    font-weight: 500;
    transition: all 0.2s;
}

.model-select:hover {
    border-color: #d1d5db;
    background-color: #f9fafb;
}

.model-select:focus {
    outline: none;
    border-color: #10a37f;
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.model-info {
    font-size: 12px;
    color: #6e6e80;
    display: flex;
    align-items: center;
    gap: 4px;
}

.attachments-preview {
    padding: 12px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 13px;
}

.attachment-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.attachment-item i.fas.fa-file {
    font-size: 20px;
    color: #6e6e80;
}

.attachment-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-remove {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #6e6e80;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: background 0.2s;
}

.attachment-remove:hover {
    background: #ef4444;
}

.input-box-wrapper {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    background: white;
    transition: all 0.2s;
}

.input-box-wrapper:focus-within {
    border-color: #10a37f;
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.chat-input {
    width: 100%;
    min-height: 52px;
    max-height: 200px;
    padding: 14px 100px 14px 14px;
    border: none;
    border-radius: 20px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    line-height: 1.5;
}

.chat-input::placeholder {
    color: #9ca3af;
}

.input-tools-right {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: flex;
    gap: 6px;
    align-items: center;
}

.send-btn {
    width: 36px;
    height: 36px;
    background: #10a37f;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-size: 16px;
}

.send-btn:hover:not(:disabled) {
    background: #0d8c6d;
}

.send-btn:disabled {
    background: #e5e7eb;
    cursor: not-allowed;
    color: #9ca3af;
}

.drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(16, 163, 127, 0.05);
    border: 2px dashed #10a37f;
    border-radius: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.drag-overlay.active {
    display: flex;
}

.drag-text {
    font-size: 14px;
    color: #10a37f;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-hint {
    margin-top: 8px;
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
}

.input-hint span {
    display: inline-block;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state-icon {
    font-size: 64px;
    color: #e5e7eb;
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 24px;
    font-weight: 600;
    color: #2d333a;
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 14px;
    color: #6e6e80;
    max-width: 400px;
}

.chat-sessions::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-sessions::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: #f9fafb;
}

.chat-sessions::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.chat-sessions::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 由于设置了 min-width: 1500px，移除小屏幕媒体查询 */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #10a37f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

