/* 设置页面样式 */
.settings-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px); /* 占满除了顶部导航之外的所有高度 */
    overflow: hidden;
    padding: 20px;
    background-color: #f8f9fa;
}

/* Alert样式 */
.alert {
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.alert i {
    font-size: 16px;
    flex-shrink: 0;
}

.settings-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 15px;
    flex-shrink: 0; /* 防止标题被压缩 */
}

.settings-header h2 {
    margin: 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

/* 设置标签页 */
.settings-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0; /* 防止标签页被压缩 */
}

.settings-tab {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6c757d;
    font-weight: 500;
}

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

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

.settings-tab i {
    font-size: 16px;
}

/* 设置内容 */
.settings-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

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

.settings-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.settings-section h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.section-header h3 {
    margin: 0;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.form-check-input {
    margin: 0;
}

.form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

/* 按钮样式优化 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0,123,255,0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,123,255,0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #495057;
    border: 2px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(73,80,87,0.1);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #343a40;
    border-color: #adb5bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(73,80,87,0.15);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(220,53,69,0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #a02622 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220,53,69,0.4);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn:active {
    transform: translateY(0px);
    transition: transform 0.1s;
}

/* 模型过滤器 */
.model-filters {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    flex-shrink: 0; /* 防止过滤器被压缩 */
}

.filter-group {
    flex: 1;
}

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

/* 模型列表 */
.model-list {
    flex: 1; /* 占据剩余空间 */
    overflow-y: auto; /* 允许滚动 */
    margin-bottom: 20px;
    padding-right: 5px; /* 为滚动条留出空间 */
}

/* 自定义滚动条样式 */
.model-list::-webkit-scrollbar {
    width: 6px;
}

.model-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.model-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.model-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.model-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

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

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

.model-info h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.model-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.model-tag {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.model-tag.category {
    background-color: #e3f2fd;
    color: #1976d2;
}

.model-tag.type {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.model-tag.enabled {
    background-color: #e8f5e8;
    color: #2e7d32;
}

.model-tag.disabled {
    background-color: #ffebee;
    color: #c62828;
}

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

.model-details {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.model-details p {
    margin: 0 0 5px 0;
}

/* 分页样式 */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    flex-shrink: 0; /* 防止分页被压缩 */
}

.pagination {
    display: flex;
    gap: 5px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination .page-item {
    display: block;
}

.pagination .page-link {
    padding: 8px 12px;
    border: 1px solid #ddd;
    color: #007bff;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.pagination .page-item.active .page-link {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-dialog {
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background-color: #f8f9fa;
    color: #333;
    transform: scale(1.1);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

/* 模态框内表单行布局 */
.modal-body .row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.modal-body .col-md-6 {
    flex: 1;
    padding: 0;
}

/* 表单组样式优化 */
.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.modal-body .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: #fff;
    height: 44px; /* 确保高度为44px */
    box-sizing: border-box;
}

.modal-body .form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.modal-body .form-control:invalid {
    border-color: #dc3545;
}

/* 模态框内checkbox字段布局修复 */
.modal-body .form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 10px 16px;
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.modal-body .form-check:hover {
    background-color: #e9ecef;
    border-color: #007bff;
}

.modal-body .form-check-input {
    margin: 0;
    transform: scale(1.3);
    cursor: pointer;
    accent-color: #007bff;
}

.modal-body .form-check-label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
    user-select: none;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    background: #f8f9fa;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .settings-container {
        padding: 15px;
        height: calc(100vh - 60px); /* 保持高度约束 */
    }
    
    .model-filters {
        flex-direction: column;
        gap: 15px;
    }
    
    .model-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .model-actions {
        align-self: flex-start;
    }
    
    .modal-dialog {
        width: 95%;
        max-height: 90vh; /* 移动端增加高度 */
        margin: 0;
    }
    
    .modal-body .row {
        flex-direction: column; /* 移动端垂直排列 */
        gap: 0;
    }
    
    .modal-body .col-md-6 {
        width: 100%;
        margin-bottom: 15px;
    }
    
    /* 移动端优化模型列表 */
    .model-item {
        padding: 15px;
    }
    
    .model-meta {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .model-tag {
        font-size: 11px;
        padding: 3px 6px;
    }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 15px;
}

.empty-state h4 {
    margin: 0 0 10px 0;
    color: #333;
}

.empty-state p {
    margin: 0;
    color: #666;
}

/* 确保设置容器正确显示 */
#settings-container {
    display: none; /* 默认隐藏 */
}

#settings-container.active {
    display: flex !important; /* 激活时显示为flex */
}

/* 自定义滚动条样式 - 应用到模态框 */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 表单提示文本样式 */
.form-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
    line-height: 1.4;
    display: block;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

/* 验证状态样式优化 - 不要一开始就显示红色 */
.modal-body .form-control {
    border-color: #e9ecef !important; /* 默认边框颜色 */
}

.modal-body .form-control:focus {
    border-color: #007bff !important; /* 聚焦时蓝色边框 */
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

/* 最强力的select元素样式覆盖 */
.modal-body select.form-control,
.modal-body select.form-control:invalid,
.modal-body select.form-control:valid,
.modal-body select.form-control:required,
.modal-body select.form-control:invalid:required,
.modal-body select.form-control:valid:required,
.modal-body select[required].form-control,
.modal-body select[required].form-control:invalid,
.modal-body select[required].form-control:valid {
    border-color: #e9ecef !important;
    background-color: #fff !important;
    color: #495057 !important;
}

.modal-body select.form-control:focus,
.modal-body select.form-control:focus:invalid,
.modal-body select.form-control:focus:valid,
.modal-body select.form-control:focus:required,
.modal-body select[required].form-control:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1) !important;
    background-color: #fff !important;
    color: #495057 !important;
}

/* 确保select元素的说明文字永远不会变红 */
.modal-body select.form-control + .form-text,
.modal-body select.form-control:invalid + .form-text,
.modal-body select.form-control:valid + .form-text,
.modal-body select.form-control:required + .form-text,
.modal-body select[required].form-control + .form-text {
    color: #6c757d !important;
    font-weight: normal !important;
}

/* 强制覆盖所有可能的红色样式 */
.modal-body .form-control:invalid,
.modal-body .form-control[required]:invalid {
    border-color: #e9ecef !important;
    background-color: #fff !important;
}

.modal-body .form-control:invalid + .form-text,
.modal-body .form-control[required]:invalid + .form-text {
    color: #6c757d !important;
    font-weight: normal !important;
}

/* 模型状态字段容器特殊样式 */
.modal-body .form-group:has(.form-check) {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.modal-body .form-group:has(.form-check) .form-label {
    margin-bottom: 8px;
    align-self: flex-start;
}

/* 兼容性支持 - 如果浏览器不支持:has() */
.modal-body .form-group .form-label + .form-check {
    margin-top: 8px;
}

/* 确保checkbox字段与其他输入字段高度一致 */
.modal-body .form-check {
    min-height: 48px; /* 与form-control的高度保持一致 */
}

/* 专门针对checkbox组的样式优化 - 改为开关样式 */
.modal-body .checkbox-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    margin-bottom: 20px;
    align-items: flex-start; /* 左对齐 */
}

.modal-body .checkbox-group .form-label {
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

/* Toggle开关样式 */
.modal-body .toggle-switch {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 16px; /* 只保留左右padding，去掉上下padding */
    background-color: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    height: 44px; /* 与输入框高度保持一致 */
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
}

/* 隐藏原生checkbox */
.modal-body .toggle-input {
    display: none;
}

/* Toggle标签样式 */
.modal-body .toggle-label {
    position: relative;
    width: 50px;
    height: 24px;
    background-color: #ccc;
    border-radius: 24px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
}

/* Toggle滑块样式 */
.modal-body .toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 选中状态样式 */
.modal-body .toggle-input:checked + .toggle-label {
    background-color: #007bff;
}

.modal-body .toggle-input:checked + .toggle-label .toggle-slider {
    transform: translateX(26px);
}

/* 表单提示文本样式 */
.modal-body .checkbox-group .form-text {
    margin-top: 6px;
    font-size: 12px;
    color: #6c757d !important;
    line-height: 1.4;
    font-style: italic;
    display: block;
    text-align: left;
    margin-left: 0;
    margin-right: 0;
    font-weight: normal !important;
}

/* 统一所有表单提示文本的样式 */
.modal-body .form-text {
    margin-top: 6px;
    font-size: 12px;
    color: #6c757d !important;
    line-height: 1.4;
    font-style: italic;
    display: block;
    text-align: left;
    margin-left: 0;
    margin-right: 0;
    font-weight: normal !important;
}

/* 调整toggle-switch的布局，确保与输入框对齐 */
.modal-body .toggle-switch {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 16px; /* 只保留左右padding，去掉上下padding */
    background-color: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    height: 44px; /* 与输入框高度保持一致 */
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
} 