/* MCP 配置页面样式 */
.mcp-container {
    display: flex;
    height: calc(100vh - 120px);
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
}

/* 左侧面板 - 配置编辑器 */
.mcp-left-panel {
    flex: 1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    min-width: 400px;
}

.panel-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.panel-header h4 {
    margin: 0;
    color: #495057;
    font-size: 16px;
    font-weight: 600;
}

.panel-header h5 {
    margin: 0;
    color: #495057;
    font-size: 14px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.editor-container {
    flex: 1;
    padding: 0;
    position: relative;
}

#mcpConfigEditor {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    padding: 20px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    background: #fefefe;
    color: #333;
    outline: none;
}

#mcpConfigEditor:focus {
    background: #fff;
}

.editor-footer {
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.editor-footer i {
    width: 14px;
    height: 14px;
    margin-right: 5px;
}

/* 中间面板 - 控制面板 */
.mcp-center-panel {
    width: 200px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.control-section {
    width: 100%;
    text-align: center;
}

.control-section button {
    width: 100%;
    height: 50px;
    border-radius: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.control-section button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.control-section button i {
    width: 18px;
    height: 18px;
}

.validation-result {
    margin-top: 15px;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    text-align: left;
    display: none;
}

.validation-result.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.validation-result.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.status-section {
    margin-top: auto;
    width: 100%;
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 13px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc3545;
}

.status-dot.status-connected {
    background: #28a745;
}

.status-dot.status-disconnected {
    background: #6c757d;
}

.status-dot.status-loading {
    background: #ffc107;
    animation: pulse 1.5s infinite;
}

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

/* 右侧面板 - 服务信息 */
.mcp-right-panel {
    flex: 1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    min-width: 350px;
}

.panel-subheader {
    padding: 15px 20px 10px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.servers-container, .tools-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* 允许flex子项收缩 */
}

.tools-container {
    max-height: 500px; /* 限制工具容器的最大高度 */
}

.servers-list {
    max-height: 350px;
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.tools-list {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: 300px;
}

/* 自定义滚动条样式 */
.servers-list::-webkit-scrollbar,
.tools-list::-webkit-scrollbar {
    width: 8px;
}

.servers-list::-webkit-scrollbar-track,
.tools-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.servers-list::-webkit-scrollbar-thumb,
.tools-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.servers-list::-webkit-scrollbar-thumb:hover,
.tools-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    text-align: center;
    color: #6c757d;
}

.empty-state i {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    margin: 0 0 8px 0;
    font-weight: 500;
}

.empty-state small {
    font-size: 12px;
    opacity: 0.8;
}

/* 服务项 */
.server-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.server-item:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.server-item .server-name {
    font-weight: 600;
    color: #007bff;
    margin-bottom: 8px;
    font-size: 14px;
}

.server-item .server-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin-bottom: 8px;
}

.server-item .server-status .status-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
}

.server-item .server-status .status-badge.running {
    background: #d4edda;
    color: #155724;
}

.server-item .server-status .status-badge.stopped {
    background: #f8d7da;
    color: #721c24;
}

.server-item .server-details {
    font-size: 11px;
    color: #6c757d;
    line-height: 1.4;
}

/* 服务器切换标签 */
.server-tabs {
    display: flex;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 15px;
    overflow-x: auto;
    padding: 0 20px;
}

.server-tab {
    padding: 8px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #6c757d;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s ease;
    min-width: 80px;
    text-align: center;
}

.server-tab:hover {
    color: #007bff;
    background: #f8f9fa;
}

.server-tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background: #f8f9fa;
}

.server-tab-badge {
    background: #6c757d;
    color: white;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 10px;
    margin-left: 4px;
}

.server-tab.active .server-tab-badge {
    background: #007bff;
}

/* 工具项 */
.tool-item {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.tool-item:hover {
    background: #f8f9fa;
    border-color: #007bff;
    cursor: pointer;
}

.tool-item .tool-name {
    font-weight: 600;
    color: #007bff;
    margin-bottom: 4px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tool-item .tool-server {
    font-size: 10px;
    color: #6c757d;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: normal;
}

.tool-item .tool-description {
    font-size: 11px;
    color: #6c757d;
    line-height: 1.4;
    margin-bottom: 8px;
}

.tool-item .tool-schema {
    border-radius: 4px;
    padding: 8px;
    font-family: monospace;
    font-size: 10px;
    color: #495057;
    max-height: 100px;
    overflow-y: auto;
}



/* 可视化配置样式 */
.servers-config-list {
    max-height: 500px;
    overflow-y: auto;
}

.server-config-item {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    background: #f8f9fa;
    position: relative;
}

.server-config-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 15px;
}

.server-config-title {
    font-weight: 600;
    color: #495057;
    margin: 0;
    flex: 1;
}

.server-config-remove {
    color: #dc3545;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.server-config-remove:hover {
    background-color: #f8d7da;
}

.config-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: end;
}

.config-form-group {
    flex: 1;
}

.config-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 13px;
    color: #495057;
}

.config-form-group input,
.config-form-group select,
.config-form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    transition: border-color 0.2s;
}

.config-form-group input:focus,
.config-form-group select:focus,
.config-form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.config-form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.config-form-group.small {
    flex: 0 0 120px;
}

.config-form-group.medium {
    flex: 0 0 200px;
}

.env-vars-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.env-var-item {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    align-items: center;
}

.env-var-item input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
}

.env-var-remove {
    color: #dc3545;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.env-var-remove:hover {
    background-color: #f8d7da;
}

.add-env-var {
    font-size: 12px;
    padding: 4px 8px;
}

.type-specific-config {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.args-section {
    margin-top: 10px;
}

.arg-item {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    align-items: center;
}

.arg-item input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
}

.arg-remove {
    color: #dc3545;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.arg-remove:hover {
    background-color: #f8d7da;
}

.add-arg {
    font-size: 12px;
    padding: 4px 8px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .mcp-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 120px);
    }
    
    .mcp-left-panel,
    .mcp-right-panel {
        min-width: auto;
        height: 400px;
    }
    
    .mcp-center-panel {
        width: 100%;
        flex-direction: row;
        height: auto;
        padding: 20px;
    }
    
    .control-section {
        flex: 1;
    }
    
    .control-section button {
        height: 40px;
    }
}

@media (max-width: 768px) {
    .mcp-container {
        padding: 10px;
        gap: 15px;
    }
    
    .panel-header {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .mcp-center-panel {
        flex-direction: column;
        gap: 15px;
    }
}

/* 按钮状态 */
.btn:focus {
    box-shadow: none;
}

.btn-outline-primary:hover {
    background-color: #007bff;
    border-color: #007bff;
}

.btn-outline-danger:hover {
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
}

.little-tips{
    background-color: #b61515;
    color: white;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    font-size: 12px;
}