/* 全局基础样式（保证所有内容居中+自适应） */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: "Microsoft Yahei", "PingFang SC", sans-serif;
    color: #333;
    line-height: 1.8;
    background-color: #f9f9f9;
}
/* 核心居中容器（电脑/手机都居中） */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* 导航栏样式（自适应） */
.nav {
    background-color: #2c3e50;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* 手机端自动换行 */
}
.nav .logo {
    color: #fff;
    font-size: 22px;
    font-weight: bold;
    text-decoration: none;
    margin-bottom: 10px; /* 手机端留间距 */
}
.nav-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap; /* 手机端导航自动换行 */
}
.nav-list li {
    margin: 0 10px; /* 手机端间距更小 */
}
.nav-list a {
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s;
}
.nav-list a:hover {
    color: #3498db;
}

/* 幻灯片样式（自适应） */
.slider {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}
.slider-wrapper {
    width: 100%;
    height: 400px; /* 电脑端高度 */
}
.slider-item {
    width: 100%;
    height: 100%;
    position: absolute;
    opacity: 0;
    transition: opacity 0.5s ease;
}
.slider-item.active {
    opacity: 1;
}
.slider-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 图片自适应，不拉伸 */
}
/* 幻灯片按钮 */
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 18px;
    cursor: pointer;
    z-index: 10;
}
.slider-btn.prev {
    left: 10px;
}
.slider-btn.next {
    right: 10px;
}

/* 主内容区样式 */
.main {
    padding: 30px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}
h1 {
    font-size: 32px;
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    text-align: center; /* 标题居中 */
}
h2 {
    font-size: 26px;
    color: #34495e;
    margin: 25px 0 15px;
    text-align: center; /* 副标题居中 */
}
p {
    font-size: 16px;
    margin-bottom: 15px;
    color: #555;
    text-align: center; /* 普通文字居中 */
}
.article-list {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.article-list ul {
    list-style: none;
    margin-left: 0;
    text-align: center; /* 文章列表居中 */
}
.article-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}

/* 底部样式 */
footer {
    margin-top: 50px;
    padding: 30px 0;
    background-color: #2c3e50;
    color: #fff;
    text-align: center;
}
footer p {
    margin-bottom: 0;
    color: #ecf0f1;
}

/* 后台登录样式 */
.login-container {
    width: 90%;
    max-width: 450px;
    margin: 80px auto;
    padding: 30px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}
.login-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}
.form-item {
    margin-bottom: 20px;
}
.form-item label {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
    color: #333;
}
.form-item input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}
button {
    width: 100%;
    padding: 12px;
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}
button:hover {
    background-color: #2980b9;
}
.error {
    color: #e74c3c;
    text-align: center;
    padding: 10px;
    background-color: #fef0f0;
    border-radius: 5px;
    margin-bottom: 20px;
}

/* 后台页面样式 */
.admin-container {
    width: 90%;
    max-width: 800px;
    margin: 50px auto;
    padding: 20px;
}
.admin-menu {
    margin: 20px 0;
    text-align: center;
}
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    margin-right: 10px;
}
.logout-btn {
    background: #dc3545;
}
.article-form {
    margin-top: 20px;
}

/* 手机端自适应（核心） */
@media (max-width: 768px) {
    /* 导航栏手机端垂直排列 */
    .nav .container {
        flex-direction: column;
        align-items: center;
    }
    .nav-list {
        margin-top: 10px;
        justify-content: center;
    }
    .nav-list li {
        margin: 5px 8px;
    }
    /* 幻灯片手机端高度变小 */
    .slider-wrapper {
        height: 200px;
    }
    /* 主内容区手机端padding变小 */
    .main {
        padding: 20px 10px;
    }
    h1 {
        font-size: 26px;
    }
    h2 {
        font-size: 22px;
    }
    /* 登录页手机端更紧凑 */
    .login-container {
        margin: 40px auto;
        padding: 20px;
    }
}