/* common.css 核心样式 + 01专属样式（全量对齐） */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition-base: all 0.3s; /* 统一过渡动画 */
}

* {
    margin: 0;
    padding: 0;
    //box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 头部样式 */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: white;
}

.logo i {
    color: var(--secondary-color);
}

nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: var(--border-radius);
    transition: background-color 0.3s;
}

nav a:hover, nav a.active {
    background-color: var(--secondary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.user-info span {
    font-weight: 500;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-base);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-danger {
    background-color: var(--accent-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #219653;
}

/* 下拉菜单样式 */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: white;
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.dropdown-content a {
    color: var(--primary-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: background-color 0.3s;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* 主要内容区样式 */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 140px);
}

.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #eee;
}

.page-header h2 {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 卡片样式 */
.card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.card-header h3 {
    color: var(--primary-color);
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

table th {
    background-color: #f8f9fa;
    color: var(--primary-color);
    font-weight: 600;
}

table tr:hover {
    background-color: #f9f9f9;
}

/* 徽章样式 */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-success {
    background-color: #d5f4e6;
    color: var(--success-color);
}

.badge-warning {
    background-color: #fef5e7;
    color: var(--warning-color);
}

.badge-danger {
    background-color: #fdeaea;
    color: var(--accent-color);
}

.badge-info {
    background-color: #e3f2fd;
    color: var(--secondary-color);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    border-color: var(--secondary-color);
    outline: none;
}

.form-row {
    display: flex;
    gap: 20px;
}

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

/* 统计卡片 */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.blue {
    background-color: var(--secondary-color);
}

.stat-icon.green {
    background-color: var(--success-color);
}

.stat-icon.orange {
    background-color: var(--warning-color);
}

.stat-icon.red {
    background-color: var(--accent-color);
}

.stat-info h3 {
    font-size: 1.8rem;
    margin-bottom: 0.2rem;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 6px 10px;
    border-radius: var(--border-radius); /* 对齐核心样式的圆角 */
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition-base); /* 统一过渡动画 */
}

.action-btn.edit {
    background-color: #e3f2fd;
    color: var(--secondary-color);
}

.action-btn.edit:hover { /* 补充hover效果，对齐核心按钮逻辑 */
    background-color: #d1e7fd;
}

.action-btn.delete {
    background-color: #ffebee;
    color: var(--accent-color);
}

.action-btn.delete:hover { /* 补充hover效果，对齐核心按钮逻辑 */
    background-color: #ffdede;
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    color: white;
    font-weight: 500;
    z-index: 1000;
    box-shadow: var(--box-shadow);
    opacity: 0;
    transform: translateX(20px); /* 修正过渡初始值，让动画更自然 */
    transition: var(--transition-base);
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.success {
    background-color: var(--success-color);
}

.notification.error {
    background-color: var(--accent-color);
}

.notification.info {
    background-color: var(--secondary-color);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;    
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    margin: 15% auto;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: var(--box-shadow); /* 补充阴影，对齐核心样式 */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    color: var(--primary-color);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s; /* 补充过渡效果 */
}

.close-modal:hover { /* 补充hover效果 */
    color: var(--primary-color);
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s; /* 补充过渡效果 */
}

.close-btn:hover {
    color: var(--primary-color); /* 对齐主色，替代纯黑 */
}

/* 修复表单样式冲突（统一优先级） */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--primary-color);
}

.form-group input {
    width: 100%;
    padding: 10px 15px; /* 对齐form-control的padding */
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: var(--border-radius); /* 统一圆角 */
    font-size: 1rem; /* 统一字体大小 */
    transition: border-color 0.3s; /* 补充过渡效果 */
}

.form-group input:focus { /* 补充focus效果，对齐form-control */
    border-color: var(--secondary-color);
    outline: none;
}

/* 搜索和过滤 */
.search-filter {
    display: flex;
    gap: 15px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    table {
        display: block;
        overflow-x: auto;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .user-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .dropdown-content {
        position: static;
    }

    /* SPA/备份相关响应式提前对齐 */
    .backup-controls {
        flex-direction: column;
        align-items: stretch; /* 替代flex-start，更适配移动端 */
        gap: 1rem;
    }
    
    .file-input-wrapper {
        width: 100%;
    }
}

/* -------------------------- 01专属样式（全量对齐核心体系） -------------------------- */
/* SPA 特定样式 - 对齐核心动画/交互逻辑 */
.view {
    display: none;
    animation: fadeIn 0.3s ease-in-out; /* 与核心过渡时长一致 */
}

.view.active {
    display: block;
}

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

/* 文件上传按钮样式 - 复用核心变量，补充交互 */
.file-input-wrapper {
    position: relative;
    display: inline-block;
    overflow: hidden;
    border-radius: var(--border-radius); /* 统一圆角 */
    box-shadow: var(--box-shadow); /* 补充阴影，对齐卡片/按钮样式 */
    transition: var(--transition-base);
}

.file-input-wrapper:hover {
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15); /* hover阴影强化，对齐核心按钮逻辑 */
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* 备份路径显示 - 对齐表单/卡片样式 */
.backup-path {
    background: #f8f9fa; /* 对齐表格header背景 */
    border: 1px solid #ddd; /* 对齐表单边框 */
    border-radius: var(--border-radius); /* 统一圆角 */
    padding: 10px 15px; /* 对齐form-control padding */
    margin: 1.5rem 0; /* 对齐核心间距（1.5rem） */
    font-family: 'Consolas', monospace;
    font-size: 1rem; /* 统一字体大小 */
    word-break: break-all;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05); /* 补充内阴影，增强质感 */
}

/* 加载动画 - 复用主题色，优化尺寸比例 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f8f9fa; /* 对齐表格header背景 */
    border-top: 3px solid var(--secondary-color); /* 复用主题色 */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle; /* 对齐行内元素 */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 数据库状态指示器 - 对齐徽章/主题色体系 */
.db-status {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    transition: var(--transition-base); /* 补充过渡 */
}

.db-status.connected {
    background-color: var(--success-color); /* 复用成功色，替代硬编码 */
    box-shadow: 0 0 10px var(--success-color);
}

.db-status.disconnected {
    background-color: var(--accent-color); /* 复用强调色，替代硬编码 */
    box-shadow: 0 0 10px var(--accent-color);
}

/* 备份表格样式 - 对齐核心表格样式，补充响应式 */
#backup-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem; /* 对齐核心表格margin */
}

#backup-table th,
#backup-table td {
    padding: 12px 15px; /* 对齐核心表格padding */
    text-align: left;
    border-bottom: 1px solid #eee; /* 对齐核心表格边框 */
}

#backup-table th {
    background-color: #f8f9fa; /* 对齐核心表格header背景 */
    color: var(--primary-color); /* 复用主色 */
    font-weight: 600;
}

#backup-table tr:hover {
    background-color: #f9f9f9; /* 对齐核心表格hover背景 */
}

#backup-table th:first-child,
#backup-table td:first-child {
    width: 180px;
}

#backup-table th:nth-child(2),
#backup-table td:nth-child(2) {
    width: 200px;
}

/* 992px 响应式调整 - 对齐768px响应式写法，复用变量 */
@media (max-width: 992px) {
    .backup-controls {
        display: flex; /* 显式声明flex，增强兼容性 */
        flex-direction: column;
        align-items: stretch; /* 替代flex-start，适配移动端 */
        gap: 1rem; /* 统一间距单位 */
    }
    
    .backup-controls .btn {
        width: 100%;
        margin-bottom: 0; /* 用gap替代margin，更规范 */
        padding: 10px 16px; /* 微调padding，提升移动端点击体验 */
    }
    
    .file-input-wrapper {
        width: 100%;
        border-radius: var(--border-radius); /* 确保圆角统一 */
    }

    /* 备份表格响应式补充 */
    #backup-table {
        display: block;
        overflow-x: auto;
    }
    
    #backup-table th:first-child,
    #backup-table td:first-child {
        min-width: 150px; /* 移动端最小宽度，保证内容不挤压 */
        width: auto;
    }
    
    #backup-table th:nth-child(2),
    #backup-table td:nth-child(2) {
        min-width: 180px;
        width: auto;
    }
}