/* ==================== AI对话全屏界面 ==================== */

.chat-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #121212;
    z-index: 3100;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.chat-fullscreen.active {
    visibility: visible;
    opacity: 1;
}

.chat-container {
    display: flex;
    width: 100%;
    height: 100%;
    background: #1C1C1E;
}

/* ==================== 左侧边栏 ==================== */
.chat-sidebar {
    width: 260px;
    background: #161618;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.chat-sidebar-logo {
    padding: 20px 16px 12px 16px;
    font-size: 20px;
    font-weight: 700;
    color: white;
    letter-spacing: 1px;
}

.chat-sidebar-header {
    padding: 0 16px 16px 16px;
}

.chat-new-btn {
    width: 100%;
    background: rgba(10, 132, 255, 0.15);
    color: #0A84FF;
    border: 1px solid rgba(10, 132, 255, 0.3);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.chat-new-btn:hover {
    background: rgba(10, 132, 255, 0.25);
    border-color: #0A84FF;
}

.chat-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.chat-history-item {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
    background: rgba(255, 255, 255, 0.03);
    position: relative;
}

.chat-history-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.chat-history-item.active {
    background: rgba(10, 132, 255, 0.15);
    border-left: 3px solid #0A84FF;
}

.chat-history-title {
    font-size: 14px;
    color: white;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 24px;
}

.chat-history-preview {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-history-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 13px;
}

.chat-history-delete {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #888;
    font-size: 14px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.chat-history-item:hover .chat-history-delete {
    opacity: 1;
}

.chat-history-delete:hover {
    color: #FF453A;
    background: rgba(255, 69, 58, 0.1);
}

/* 侧边栏底部控件 */
.chat-sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: auto;
}

.chat-sidebar-settings {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-sidebar-settings-btn {
    width: 40px;
    height: 40px;
    background: #2C2C2E;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}

.chat-sidebar-settings-btn:hover {
    background: #3C3C3E;
    border-color: #0A84FF;
}

/* 自定义模型下拉弹窗 */
.chat-model-dropdown {
    flex: 1;
    position: relative;
    min-width: 0;
}

.chat-model-selected {
    width: 100%;
    height: 40px;
    background: #2C2C2E;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0 12px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-model-selected:hover {
    border-color: #0A84FF;
}

.chat-model-options {
    position: absolute;
    bottom: 48px;
    left: 0;
    right: 0;
    background: #2C2C2E;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.chat-model-options.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chat-model-option {
    padding: 12px;
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-model-option:last-child {
    border-bottom: none;
}

.chat-model-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-model-option.selected {
    background: rgba(10, 132, 255, 0.2);
    color: #0A84FF;
}

/* ==================== 右侧主区域 ==================== */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

/* 消息气泡 */
.chat-message {
    display: flex;
    margin-bottom: 20px;
    padding: 0 20px;
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.assistant {
    justify-content: flex-start;
}

.chat-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 20px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-message.user .chat-message-content {
    background: #0A84FF;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .chat-message-content {
    background: #2C2C2E;
    color: #E0E0E0;
    border-bottom-left-radius: 4px;
}

/* 加载动画 */
.chat-loading {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.chat-loading span {
    width: 8px;
    height: 8px;
    background: #888;
    border-radius: 50%;
    animation: chatLoading 1.4s infinite ease-in-out both;
}

.chat-loading span:nth-child(1) {
    animation-delay: -0.32s;
}

.chat-loading span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes chatLoading {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==================== 底部输入栏 ==================== */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #1C1C1E;
    margin-top: auto;
}

.chat-input {
    flex: 1;
    background: #2C2C2E;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 10px 16px;
    color: white;
    font-size: 14px;
    resize: none;
    outline: none;
    font-family: inherit;
    min-height: 40px;
    max-height: 120px;
    line-height: 1.4;
}

.chat-input:focus {
    border-color: #0A84FF;
}

.chat-send-btn {
    background: #0A84FF;
    color: white;
    border: none;
    padding: 0 20px;
    height: 40px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.chat-send-btn:hover {
    background: #0A6ED0;
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 更多按钮（^ 变成 X 时） */
.chat-more-btn {
    width: 40px;
    height: 40px;
    background: #2C2C2E;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: rgba(255, 255, 255, 0.8);
}

.chat-more-btn:hover {
    background: #3C3C3E;
    border-color: #FF453A;
    color: #FF453A;
}

.chat-more-btn.chat-exit-active {
    background: rgba(255, 69, 58, 0.15);
    border-color: rgba(255, 69, 58, 0.3);
    color: #FF453A;
}

.chat-more-btn.chat-exit-active:hover {
    background: rgba(255, 69, 58, 0.25);
}

/* ==================== 设置浮层 ==================== */
.chat-settings-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 400px;
    max-width: 85%;
    background: #2C2C2E;
    border-radius: 20px;
    z-index: 3200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-settings-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.chat-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.chat-settings-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.2s;
}

.chat-settings-close:hover {
    color: white;
}

.chat-settings-content {
    padding: 20px;
}

.chat-settings-item {
    margin-bottom: 16px;
}

.chat-settings-item label {
    display: block;
    font-size: 13px;
    color: #aaa;
    margin-bottom: 6px;
}

.chat-settings-item input,
.chat-settings-item textarea {
    width: 100%;
    background: #1C1C1E;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px 12px;
    color: white;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}

.chat-settings-item input:focus,
.chat-settings-item textarea:focus {
    border-color: #0A84FF;
}

.chat-settings-item textarea {
    resize: vertical;
}

.chat-settings-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.chat-settings-save {
    flex: 1;
    background: #0A84FF;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.chat-settings-save:hover {
    background: #0A6ED0;
}

.chat-settings-refresh {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.chat-settings-refresh:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #0A84FF;
}

.chat-settings-clear {
    flex: 1;
    background: rgba(255, 69, 58, 0.15);
    color: #FF453A;
    border: 1px solid rgba(255, 69, 58, 0.3);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.chat-settings-clear:hover {
    background: rgba(255, 69, 58, 0.25);
    border-color: #FF453A;
}

.chat-model-status {
    font-size: 12px;
    color: #888;
    margin-top: 8px;
    text-align: center;
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar,
.chat-history-list::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.chat-history-list::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.chat-history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* 响应式 */
@media (max-width: 768px) {
    .chat-sidebar {
        position: absolute;
        left: -260px;
        top: 0;
        bottom: 0;
        z-index: 3160;
        transition: left 0.3s ease;
    }
    
    .chat-sidebar.open {
        left: 0;
    }
}
/* 模型下拉搜索框样式 */
.chat-model-search {
    width: calc(100% - 20px);
    margin: 8px 10px;
    padding: 8px 12px;
    background: #1C1C1E;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.chat-model-search:focus {
    border-color: #0A84FF;
}

.chat-model-search::placeholder {
    color: #666;
}

.chat-model-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 0;
}

.chat-model-no-result {
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: #888;
}

.chat-model-custom {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 4px;
    color: #0A84FF;
}

.chat-model-custom:hover {
    background: rgba(10, 132, 255, 0.15);
}
.chat-model-options-container {
    max-height: 250px;
    overflow-y: auto;
}