/* AI设置弹窗样式 */
.ai-settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.ai-settings-modal.show {
    display: flex;
}

.ai-settings-container {
    background: white;
    border-radius: 12px;
    width: 95%;
    max-width: 1000px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.ai-settings-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧预设列表 */
.ai-settings-sidebar {
    width: 280px;
    border-right: 1px solid #e9ecef;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
}

.ai-sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.ai-config-item {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border: 1px solid #eee;
}

.ai-config-item:hover {
    background: #f0f4ff;
    border-color: #667eea;
}

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

.ai-config-item .config-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-config-item .config-actions {
    display: none;
    gap: 5px;
}

.ai-config-item:hover .config-actions {
    display: flex;
}

.ai-config-item.active .config-actions {
    display: flex;
}

.ai-settings-header {
    padding: 15px 24px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-settings-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.ai-settings-close {
    background: rgba(255,255,255,0.2);
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ai-settings-close:hover {
    background: rgba(255,255,255,0.3);
}

.ai-settings-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: white;
}

.ai-settings-group {
    margin-bottom: 20px;
}

.ai-settings-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.ai-settings-group input[type="text"],
.ai-settings-group input[type="password"],
.ai-settings-group input[type="number"],
.ai-settings-group select,
.ai-settings-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.ai-settings-group input:focus,
.ai-settings-group select:focus,
.ai-settings-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-settings-group textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

.ai-settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.ai-settings-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.ai-settings-footer {
    padding: 16px 24px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f8f9fa;
}

/* API Key 输入框带切换按钮 */
.api-key-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.api-key-input-wrapper input {
    padding-right: 45px !important;
}

.api-key-toggle {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    padding: 5px;
}

.api-key-toggle:hover {
    color: #333;
}

/* 模型选择下拉框 */
.model-select-wrapper {
    display: flex;
    gap: 10px;
}

.model-select-wrapper select {
    flex: 1;
}

.model-select-wrapper button {
    white-space: nowrap;
}

/* AI生成按钮样式 */
.btn-ai-generate {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.btn-ai-generate:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-ai-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-ai-generate.generating {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* 批量AI生成按钮 */
.btn-batch-ai {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-batch-ai:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.4);
}

.btn-batch-ai:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* AI设置按钮 */
.btn-ai-settings {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-ai-settings:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* AI生成进度条 */
.ai-progress-container {
    display: none;
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    border-radius: 8px;
    border: 1px solid #e0e4e8;
}

.ai-progress-container.show {
    display: block;
}

.ai-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.ai-progress-status {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.ai-progress-bar {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: #ddd;
}

.ai-progress-bar progress {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
}

.ai-progress-bar progress::-webkit-progress-bar {
    background: #ddd;
    border-radius: 4px;
}

.ai-progress-bar progress::-webkit-progress-value {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

/* 流式生成文本动画 */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.ai-generating-cursor::after {
    content: '▌';
    animation: blink 1s infinite;
    color: #667eea;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-settings-container {
        width: 95%;
        max-height: 90vh;
    }
    
    .ai-settings-row,
    .ai-settings-row-3 {
        grid-template-columns: 1fr;
    }
    
    .ai-settings-body {
        padding: 16px;
    }
}

/* 自定义确认弹窗样式 */
.custom-confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    transition: all 0.3s;
}

.custom-confirm-modal.show {
    display: flex;
}

.custom-confirm-container {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    overflow: hidden;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.custom-confirm-header {
    padding: 20px 24px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.custom-confirm-icon {
    font-size: 28px;
}

.custom-confirm-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

.custom-confirm-body {
    padding: 20px 24px;
}

.custom-confirm-body p {
    margin: 0;
    font-size: 15px;
    color: #555;
    line-height: 1.6;
}

.custom-confirm-footer {
    padding: 16px 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #fafafa;
}

.custom-confirm-footer .btn {
    padding: 10px 24px;
    font-size: 14px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

/* 表情选择器样式优化 */
.emoji-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    background: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #444;
    transition: all 0.2s;
    user-select: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.emoji-item:hover {
    background: #007bff;
    color: #fff;
    border-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.2);
}

/* 为知乎表情增加独特性 */
.emoji-panel .emoji-item:nth-child(odd) {
    background: #f8f9ff;
}

.emoji-item.emoji-unicode {
    font-size: 20px;
    padding: 4px 8px;
    background: #fff !important;
}

.emoji-item.emoji-unicode:hover {
    background: #007bff !important;
}

.emoji-tab-btn {
    border: 1px solid #ddd;
    background: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.emoji-tab-btn:hover {
    background: #e9ecef;
}

.emoji-tab-btn.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}
