* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    line-height: 1.6;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 容器统一设置增强 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* 顶部导航栏 - 固定布局 */
.header-top {
    background: rgba(0, 0, 0, 0.1);
    color: rgba(255, 255, 255, 0.8);
    padding: 8px 0;
    font-size: 14px;
    width: 100%;
    position: relative;
}

.header-top .container {
    display: flex;
    justify-content: space-between; /* 关键：强制两端对齐 */
    align-items: center;
    width: 100%;
    min-width: 100%; /* 防止收缩 */
}

.header-top a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

.header-top a:hover {
    color: #3498db;
}

/* 主头部 - 增强布局稳定性 */
.main-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: orange;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    position: relative;
}

.main-header .container {
    display: flex;
    justify-content: space-between; /* 关键：强制两端对齐 */
    align-items: center;
    width: 100%;
    min-width: 100%;
    flex-wrap: nowrap; /* 防止换行 */
}

.main-header h1 {
    font-size: 2.2em;
    font-weight: 300;
    font-family: '黑体', sans-serif;
}

.main-header h1 i {
    margin-right: 12px;
    color: #3498db;
}

/* 导航菜单稳定性增强 */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
    margin: 0;
    padding: 0;
    white-space: nowrap; /* 防止导航文字换行 */
}

/* 管理员面板样式 */
.admin-dashboard {
    background-color: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.admin-dashboard h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 600;
}

.admin-dashboard p {
    color: #666;
    margin-bottom: 24px;
}

/* 统计卡片样式 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card i {
    font-size: 32px;
    margin-bottom: 12px;
}

.stat-card h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-card p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-size: 14px;
}

/* 标签页样式 */
.admin-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    color: #666;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #3498db;
}

.tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
    font-weight: 600;
}

/* 标签页内容样式 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tab-header h3 {
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
}

/* 按钮样式 */
.btn-primary {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background-color: #2980b9;
}

/* 搜索框样式 */
.search-box {
    display: flex;
    gap: 8px;
}

.search-box input {
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 250px;
}

.search-box button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-box button:hover {
    background-color: #2980b9;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
}

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.admin-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.admin-table tr:hover {
    background-color: #f8f9fa;
}

/* 系统信息样式 */
.system-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.info-section {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.info-section h4 {
    color: #2c3e50;
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 600;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.info-item {
    background-color: white;
    padding: 12px 16px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.info-item label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.info-item span {
    display: block;
    font-size: 16px;
    color: #2c3e50;
    font-weight: 500;
}

/* 活动日志样式 */
.activity-log {
    max-height: 300px;
    overflow-y: auto;
    background-color: white;
    border-radius: 4px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.activity-log .log-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    color: #666;
}

.activity-log .log-item:last-child {
    border-bottom: none;
}

.main-nav li {
    flex-shrink: 0; /* 防止导航项收缩 */
}

.main-nav a {
    color: orange;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.main-nav a:hover, .main-nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffd700;
}

/* 焦点图/横幅响应式修复 */
.hero-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 80px 0;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.banner-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

.banner-content h2 {
    font-size: 3em;
    margin-bottom: 20px;
    font-weight: 300;
}

.banner-content p {
    font-size: 1.2em;
    margin-bottom: 30px;
    opacity: 0.9;
}

/* 主体内容一致性修复 */
.main-content {
    flex: 1;
    background: white;
    padding: 60px 0;
    width: 100%;
}

.main-content .container {
    max-width: 60%;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header h2 {
    font-size: 2.5em;
    color: #2c3e50;
    margin-bottom: 10px;
}

.section-header h2 i {
    margin-right: 10px;
    color: #3498db;
}

.section-header p {
    color: #7f8c8d;
    font-size: 1.1em;
}

.view-all {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

/* 功能网格 */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 80px;
}

.feature-card {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #e9ecef;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    background: white;
}

.feature-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #3498db, #2c3e50);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.feature-icon i {
    font-size: 2em;
    color: white;
}

.feature-card h3 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: #2c3e50;
}

.feature-card p {
    color: #7f8c8d;
    margin-bottom: 20px;
}

.feature-link {
    color: #3498db;
    font-weight: 500;
}

/* 新闻部分 */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.news-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.news-date {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.news-card h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.news-card p {
    color: #7f8c8d;
    margin-bottom: 15px;
}

.news-card a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

/* 按钮样式 */
.btn-primary {
    background: #3498db;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

/* 页脚 */
.main-footer {
    background: #2c3e50;
    color: white;
    padding: 50px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    color: #3498db;
    margin-bottom: 20px;
    font-size: 1.2em;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

.footer-section a:hover {
    color: #3498db;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: #3498db;
    transform: translateY(-2px);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.footer-bottom a {
    color: rgba(255, 255, 255, 0.8);
}

/* 响应式设计优化 */
@media (max-width: 768px) {
    .header-top .container {
        flex-direction: row; /* 保持水平布局 */
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .main-header .container {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .main-nav ul {
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .banner-content h2 {
        font-size: 2em;
    }
}

/* 极端小屏幕适配 */
@media (max-width: 480px) {
    .header-top .container {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .main-nav ul {
        gap: 10px;
    }
    
    .main-nav a {
        padding: 6px 12px;
        font-size: 0.9em;
    }
}

/* 二维码 */
/* 模态框背景 */
.modal {
    display: none; /* 默认隐藏 */
    position: fixed;
    z-index: 1000; /* 置于顶层 */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* 黑色半透明背景 */
    animation: fadeIn 0.3s ease-out; /* 淡入动画 */
}

/* 模态框内容 */
.modal-content {
    background-color: #fefefe;
    margin: 10% auto; /* 居中 */
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px; /* 最大宽度 */
    text-align: center;
    position: relative;
    animation: slideIn 0.3s ease-out; /* 滑入动画 */
}

/* 关闭按钮 */
.close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
}

/* 淡入动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 滑入动画 */
@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 数据库测试区域样式 */
.db-test-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 0;
    margin: 40px 0;
}

.db-test-container {
    max-width: 800px;
    margin: 0 auto;
}

.db-test-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    color: #333;
}

.db-test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.db-test-header h3 {
    color: #4a5568;
    margin: 0;
}

.btn-test {
    background: linear-gradient(45deg, #48bb78, #38a169);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-test:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

.btn-test:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
}

.test-config, .test-results {
    margin-bottom: 25px;
}

.test-config h4, .test-results h4 {
    color: #2d3748;
    margin-bottom: 15px;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    background: #f7fafc;
    padding: 20px;
    border-radius: 10px;
}

.config-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.config-item:last-child {
    border-bottom: none;
}

.config-item label {
    font-weight: 600;
    color: #8a9ec0;
}

.config-item span {
    color: #71b4b6;
    font-family: 'Courier New', monospace;
}

.result-placeholder {
    background: #f7fafc;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    color: #718096;
    border: 2px dashed #cbd5e0;
}

.test-result {
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.test-result.success {
    background: #f0fff4;
    border: 2px solid #9ae6b4;
    color: #276749;
}

.test-result.error {
    background: #fff5f5;
    border: 2px solid #fc8181;
    color: #c53030;
}

.test-result.pending {
    background: #fffaf0;
    border: 2px solid #faf089;
    color: #d69e2e;
}

.test-details {
    background: #edf2f7;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.db-test-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.test-actions {
    display: flex;
    gap: 10px;
}

.btn-secondary {
    background: #e2e8f0;
    color: #7f98c1;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.last-test {
    color: #718096;
    font-size: 14px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
}

.close:hover {
    color: #ac9595;
}

.advanced-test-options {
    margin: 20px 0;
}

.test-option {
    margin: 15px 0;
}

.test-option label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.test-option input {
    margin-right: 10px;
}

/* 登录模态框样式 */
.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);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.4s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-modal {
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 25px;
    text-align: center;
}

.login-header h2 {
    margin: 0 0 10px 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.login-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
}

.login-body {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
    accent-color: #667eea;
}

.error-message {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 15px;
    padding: 10px;
    background-color: #ffebee;
    border-radius: 4px;
    display: none;
}

.login-footer {
    padding: 0 25px 25px;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 页面虚化遮罩样式 */
.page-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999;
    display: none;
}

/* 页面虚化效果 */
body.login-required {
    overflow: hidden;
}

body.login-required > :not(#loginModal):not(#pageOverlay) {
    filter: blur(5px) grayscale(30%);
    transition: filter 0.3s ease;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .login-header {
        padding: 25px 20px;
    }
    
    .login-header h2 {
        font-size: 1.5rem;
    }
    
    .login-body,
    .login-footer {
        padding: 20px;
    }
}

/* 数据库测试区域响应式设计 */
@media (max-width: 768px) {
    .db-test-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
    
    .db-test-footer {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .test-actions {
        justify-content: center;
    }
}