/**
 * 系统设置页面优化样式
 * 包含：设置布局、表单样式、用户管理、日志显示、响应式布局
 */

/* ===========================
   设置布局
   =========================== */
.settings-layout {
    display: flex;
    gap: 20px;
    min-height: calc(100vh - 200px);
}

/* 设置导航 */
.settings-nav {
    width: 240px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.settings-nav .nav-pills {
    gap: 5px;
}

.settings-nav .nav-link {
    color: #6c757d;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.settings-nav .nav-link:hover {
    background: #f8f9fa;
    color: #32325d;
}

.settings-nav .nav-link.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.settings-nav .nav-link i {
    font-size: 18px;
}

/* 设置内容 */
.settings-content {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.settings-section h4 {
    color: #32325d;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    font-size: 20px;
    font-weight: 600;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.section-header h4 {
    margin: 0;
    border: none;
    padding: 0;
}

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

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

.form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-control.is-invalid {
    border-color: #f56565;
}

.invalid-feedback {
    display: none;
    color: #f56565;
    font-size: 12px;
    margin-top: 5px;
}

.form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

.form-check {
    margin-bottom: 15px;
}

.form-check-input {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    font-size: 14px;
    color: #32325d;
}

/* 设置操作按钮 */
.settings-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
}

.settings-actions .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ===========================
   用户管理表格
   =========================== */
.table {
    margin-top: 20px;
}

.table thead th {
    background: #f8f9fa;
    border: none;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody td {
    padding: 15px 12px;
    vertical-align: middle;
    border-color: #f0f0f0;
    font-size: 14px;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* ===========================
   日志样式
   =========================== */
.log-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.log-list {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
}

.log-entry {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid;
    background: #f8f9fa;
}

.log-entry.log-info {
    border-left-color: #4299e1;
}

.log-entry.log-warning {
    border-left-color: #ed8936;
}

.log-entry.log-error {
    border-left-color: #f56565;
}

.log-entry.log-success {
    border-left-color: #48bb78;
}

.log-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.log-level {
    flex-shrink: 0;
}

.log-time {
    color: #6c757d;
    font-size: 13px;
}

.log-user {
    margin-left: auto;
    color: #667eea;
    font-weight: 500;
    font-size: 13px;
}

.log-message {
    color: #32325d;
    font-size: 14px;
    line-height: 1.5;
}

.log-details {
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #6c757d;
    white-space: pre-wrap;
}

.empty-logs {
    padding: 60px 20px;
    text-align: center;
    color: #adb5bd;
    font-size: 14px;
}

/* ===========================
   备份恢复样式
   =========================== */
.backup-list {
    display: grid;
    gap: 15px;
}

.backup-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.backup-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.backup-info {
    flex: 1;
}

.backup-name {
    font-weight: 600;
    color: #32325d;
    margin-bottom: 5px;
}

.backup-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: #6c757d;
}

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

/* ===========================
   安全设置样式
   =========================== */
.security-group {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.security-group h5 {
    font-size: 16px;
    font-weight: 600;
    color: #32325d;
    margin-bottom: 15px;
}

.ip-list {
    margin-top: 10px;
}

.ip-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    margin-bottom: 8px;
}

.ip-item button {
    padding: 4px 8px;
    font-size: 12px;
}

/* ===========================
   进度条和状态指示
   =========================== */
.progress-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 1000;
    text-align: center;
}

.progress-indicator .spinner-border {
    width: 50px;
    height: 50px;
    margin-bottom: 15px;
}

.progress-indicator p {
    margin: 0;
    color: #32325d;
    font-weight: 500;
}

/* 保存状态指示器 */
.save-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    animation: slideInUp 0.3s ease;
}

.save-indicator.saving {
    background: #667eea;
    color: white;
}

.save-indicator.saved {
    background: #48bb78;
    color: white;
}

.save-indicator.error {
    background: #f56565;
    color: white;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===========================
   模态框样式
   =========================== */
.user-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.user-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
}

.user-modal-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.user-modal-header h5 {
    margin: 0;
    color: #32325d;
    font-size: 20px;
}

.user-modal-footer {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===========================
   Toast 通知样式
   =========================== */
.toast-container {
    z-index: 3000;
}

.toast {
    min-width: 300px;
}

/* ===========================
   响应式布局
   =========================== */
@media (max-width: 1200px) {
    .settings-layout {
        flex-direction: column;
    }
    
    .settings-nav {
        width: 100%;
        position: static;
    }
    
    .settings-nav .nav-pills {
        flex-direction: row;
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .settings-nav .nav-link {
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    .settings-content {
        padding: 20px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .section-header button {
        width: 100%;
    }
    
    .settings-actions {
        flex-direction: column;
    }
    
    .settings-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .backup-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .backup-actions {
        width: 100%;
    }
    
    .backup-actions button {
        flex: 1;
    }
    
    .log-header {
        flex-wrap: wrap;
    }
    
    .log-user {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .settings-nav .nav-pills {
        flex-direction: column;
    }
    
    .table-responsive {
        font-size: 12px;
    }
    
    .table thead {
        display: none;
    }
    
    .table tbody td {
        display: block;
        padding: 8px;
        text-align: right;
    }
    
    .table tbody td:before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: #6c757d;
    }
    
    .user-modal-content {
        width: 95%;
        padding: 20px;
    }
}