/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background-color: #f5f5f5;
    overflow: hidden;
    color: #333;
    line-height: 1.6;
}

/* 布局容器 */
.container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* 左侧侧边栏 */
.sidebar {
    width: 280px;
    background-color: #2c3e50;
    color: white;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar h1 {
    font-size: 22px;
    margin-bottom: 20px;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #ecf0f1;
}

/* 用户列表 */
.user-list {
    flex: 1;
    overflow-y: auto;
}

.user-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.user-item.active {
    background-color: #3498db;
    transform: translateX(5px);
}

.user-item .user-id {
    font-weight: bold;
    color: #ecf0f1;
}

.user-item .status {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: bold;
}

.status-running {
    background-color: #2ecc71;
    color: white;
}

.status-stopped {
    background-color: #e74c3c;
    color: white;
}

/* 右侧内容区域 */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background-color: #f5f5f5;
}

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

.content-header h2 {
    font-size: 24px;
    color: #2c3e50;
    font-weight: 600;
}

/* 无用户选择提示 */
#no-user-selected {
    display: block;
    text-align: center;
    padding: 100px 50px;
    color: #777;
}

#no-user-selected p {
    font-size: 18px;
    margin-bottom: 20px;
}

/* 新增用户表单 */
#add-user-form {
    display: none;
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

#add-user-form h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 20px;
}

#add-user-form .user-config {
    margin-bottom: 20px;
}

#add-user-form .form-actions {
    margin-top: 20px;
    text-align: right;
}

/* 配置项 */
.user-config {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.config-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #555;
    word-break: break-all;
}

.config-label {
    display: inline-block;
    min-width: 110px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.config-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.config-input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.25);
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-start {
    background-color: #3498db;
    color: white;
}

.btn-start:hover:not(:disabled) {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn-stop {
    background-color: #e74c3c;
    color: white;
}

.btn-stop:hover:not(:disabled) {
    background-color: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn-save {
    background-color: #27ae60;
    color: white;
}

.btn-save:hover {
    background-color: #229954;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.sidebar .btn-save {
    width: 100%;
    padding: 10px;
    font-size: 15px;
}

.btn-delete {
    background-color: #dc3545;
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-delete:hover {
    background-color: #c82333;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    padding: 8px 16px;
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn-add {
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 10px;
}

.btn-add:hover {
    background-color: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 用户详情 */
#current-user-details {
    margin-bottom: 30px;
}

.user-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    padding: 0;
    overflow: hidden;
}

.user-section {
    padding: 20px;
    margin: 0;
    border-bottom: 1px solid #eee;
}

.user-section:last-child {
    border-bottom: none;
}

/* 用户头部 */
.user-section-1 {
    background-color: #f8f9fa;
    border-left: 4px solid #3498db;
}

.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.user-id {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
}

.user-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 连接配置 */
.user-section-2 {
    background-color: #fff9f2;
    border-left: 4px solid #e67e22;
}

/* 工具列表 */
.user-section-3 {
    background-color: #f2fff5;
    border-left: 4px solid #2ecc71;
}

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

.tools-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #2c3e50;
}

.tool-item {
    background-color: #ffffff;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.tool-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #dee2e6;
}

.tool-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tool-name-display {
    font-weight: 600;
    color: #2c3e50;
}

.tool-form-group {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.tool-form-label {
    display: inline-block;
    width: 90px;
    font-weight: 600;
    color: #495057;
    margin-top: 6px;
    white-space: nowrap;
}

.tool-form-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tool-form-input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.25);
}

/* 日志容器 */
.logs-container {
    margin-top: 20px;
    background-color: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: #333;
    border: 1px solid #eee;
}

.log-line {
    margin-bottom: 4px;
    line-height: 1.5;
}

/* 工具空状态 */
.tool-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-style: italic;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px dashed #dee2e6;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-size: 14px;
}

/* 输入模式弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: modalFadeIn 0.3s ease;
}

.modal-content {
    background-color: #ffffff;
    margin: 4% auto;
    padding: 0;
    border: none;
    width: 90%;
    max-width: 680px;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: modalSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-60px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 18px 24px;
    background-color: #3498db;
    color: white;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 18px 24px;
    background-color: #f8f9fa;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 变量列表样式 */
.schema-variables {
    margin-bottom: 24px;
}

.schema-variable-item {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 16px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.schema-variable-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.schema-variable-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.schema-variable-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 16px;
    margin: 0;
}

.btn-delete-variable {
    background-color: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-delete-variable:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.schema-variable-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.schema-form-group {
    margin-bottom: 0;
}

.schema-form-group.full-width {
    grid-column: 1 / -1;
}

.schema-form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}

.schema-form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background-color: #ffffff;
    color: #1e293b;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.schema-form-input:hover {
    border-color: #94a3b8;
}

.schema-form-input:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background-color: #ffffff;
}

.schema-form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background-color: #ffffff;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 36px;
}

.schema-form-select:hover {
    border-color: #94a3b8;
}

.schema-form-select:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* 范围输入框组 */
.range-inputs {
    display: flex;
    gap: 15px;
    align-items: center;
    width: 100%;
}

.range-inputs .schema-form-input {
    flex: 1;
    min-width: 0;
}

.range-separator {
    font-weight: bold;
    color: #64748b;
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 300px;
    }
    
    .content {
        padding: 20px;
    }
    
    .user-config {
        grid-template-columns: 1fr;
    }
    
    .user-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .user-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .btn {
        flex: 1;
        min-width: 80px;
        text-align: center;
    }
    
    .schema-variable-form {
        grid-template-columns: 1fr;
    }
    
    .range-inputs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .range-separator {
        text-align: center;
        margin: 10px 0;
        padding: 5px;
        background-color: #f1f5f9;
        border-radius: 4px;
    }
    
    /* 模态框响应式优化 */
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-footer {
        padding: 16px;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    /* 变量项响应式优化 */
    .schema-variable-item {
        padding: 16px;
    }
    
    /* 按钮响应式优化 */
    .btn-delete-variable {
        width: 100%;
        justify-content: center;
    }
    
    /* 输入框响应式优化 */
    .schema-form-input,
    .schema-form-select {
        font-size: 15px;
        padding: 12px;
    }
}
