/* ================================= 全局样式重置（置顶，优先级最高） ================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 容器样式 */
.container {
    width: 80%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ================================= 前台布局样式 ================================= */
/* 前台头部 */
.front-header {
    background-color: #fff;
    border-bottom: 1px solid #eee;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.front-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.front-header .logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
    text-decoration: none;
}

.front-nav a {
    color: #666;
    text-decoration: none;
    margin-left: 30px;
    font-size: 1rem;
    transition: color 0.3s;
}

.front-nav a:hover, .front-nav a.active {
    color: #333;
    font-weight: bold;
    border-bottom: 2px solid #007bff;
}

/* 前台底部 */
.front-footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 30px 0;
    margin-top: 50px;
}

/* 前台首页样式 */
.front-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 30px;
    margin-top: 30px;
    text-align: center;
}

.front-content h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.2rem;
}

.front-content .image-box {
    margin: 30px 0;
}

.front-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.front-content .text-content {
    font-size: 1.1rem;
    color: #666;
    line-height: 1.8;
    margin-top: 20px;
}

/* 前台图文列表样式 */
.content-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.content-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s;
}

.content-card:hover {
    transform: translateY(-5px);
}

.content-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.content-card .card-body {
    padding: 20px;
}

.content-card h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: #333;
}

.content-card .card-text {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.content-card .card-time {
    font-size: 0.9rem;
    color: #999;
}

/* 分类标题 */
.category-title {
    font-size: 2rem;
    color: #333;
    margin: 20px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* 详情页样式 */
.content-detail {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.detail-title {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 15px;
}
.detail-meta {
    color: #999;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}
.detail-image {
    text-align: center;
    margin: 20px 0;
}
.detail-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    transition: transform 0.3s ease;
}
.detail-image img:hover {
    transform: scale(1.02);
}
.detail-content {
    line-height: 1.8;
    font-size: 1.1rem;
    color: #444;
    margin: 20px 0;
}
.detail-content p {
    margin-bottom: 1.5rem;
}
.detail-content ul, .detail-content ol {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
}


/* 核心修复：前台详情页返回按钮（居中+样式优化） */
.back-btn {
    display: inline-block; /* 保持行内块，适配text-align:center */
    padding: 10px 24px; /* 优化内边距，按钮更饱满 */
    background-color: #007bff;
    color: #fff;
    text-decoration: none;
    border-radius: 6px; /* 更大圆角，更美观 */
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease; /* 过渡动画更丝滑 */
    border: none;
    cursor: pointer;
}
.back-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px); /* 轻微上浮，提升交互感 */
    box-shadow: 0 3px 8px rgba(0, 123, 255, 0.3); /* 增加阴影 */
}

/* 空数据提示 */
.empty-tip {
    text-align: center;
    padding: 50px;
    background: #fff;
    border-radius: 8px;
    margin: 30px 0;
    color: #666;
    font-size: 1.2rem;
}

/* ================================= 后台布局样式 ================================= */
/* 后台整体布局 */
.admin-body {
    display: flex;
    min-height: 100vh;
}

/* 后台侧边栏 */
.admin-sidebar {
    width: 220px;
    background-color: #2d3748;
    color: #fff;
    padding: 20px 0;
    flex-shrink: 0;
}

.admin-sidebar .logo {
    display: block;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 0 20px 20px;
    border-bottom: 1px solid #4a5568;
    margin-bottom: 20px;
    color: #fff;
    text-decoration: none;
}

.admin-menu {
    list-style: none;
}

.admin-menu li {
    margin-bottom: 5px;
}

.admin-menu a {
    display: block;
    padding: 12px 20px;
    color: #e2e8f0;
    text-decoration: none;
    transition: background-color 0.3s;
}

.admin-menu a:hover, .admin-menu a.active {
    background-color: #4a5568;
    color: #fff;
}

/* 后台主内容区 */
.admin-main {
    flex: 1;
    padding: 20px;
    background-color: #f8f9fa;
}

/* 后台顶部工具栏（头像+用户名+退出） */
.admin-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 10px 0 20px;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 20px;
}

.admin-user-info {
    display: flex;
    align-items: center;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.username {
    font-weight: bold;
    color: #333;
}

.logout-btn {
    margin-left: 20px;
    padding: 6px 12px;
    background-color: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background-color: #c82333;
}

/* 后台页面容器 */
.admin-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 25px;
    min-height: calc(100vh - 180px);
}

/* 后台图文列表样式 */
.admin-content-list {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    margin-top: 20px;
    margin: 0;
}

.search-bar, .filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.search-bar input, .filter-form .form-control {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.search-bar button, .filter-form button {
    padding: 10px 20px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-bar button:hover, .filter-form button:hover {
    background-color: #555;
}

/* 后台表格样式（统一整合） */
.table, .data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.table th, .table td, .data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
.table th, .data-table th {
    background: #f8f9fa;
    font-weight: bold;
    color: #333;
}
.table img, .data-table .thumbnail {
    width: 80px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}
.data-table .thumbnail {
    width: 50px;
    height: 50px;
}

/* ================================= 核心修复：后台按钮样式（统一+尺寸一致） ================================= */
/* 通用按钮基类 */
.btn {
    display: inline-block;
    padding: 8px 16px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    text-align: center;
}
.btn:hover {
    background-color: #0056b3;
}

/* 按钮尺寸变体 */
.btn-sm {
    padding: 6px 12px; /* 统一小按钮内边距 */
    font-size: 12px;
    min-width: 60px; /* 固定最小宽度，确保编辑/删除按钮等宽 */
}

/* 按钮类型变体 */
.btn-default {
    background: #6c757d;
}
.btn-default:hover {
    background: #5a6268;
}

.btn-add {
    display: inline-block;
    margin-bottom: 20px;
    padding: 10px 20px;
    background-color: #28a745;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
}
.btn-add:hover {
    background-color: #218838;
}

/* 编辑/删除按钮（核心修复：统一尺寸+间距） */
.btn-edit {
    background: #28a745;
    margin-right: 5px; /* 与删除按钮的间距 */
    min-width: 60px; /* 固定宽度，解决宽窄不一问题 */
}
.btn-edit:hover {
    background: #218838;
}

.btn-delete {
    background: #dc3545;
    min-width: 60px; /* 与编辑按钮同宽 */
}
.btn-delete:hover {
    background: #c82333;
}

/* 按钮组布局（适配统一尺寸） */
.btn-group {
    display: flex;
    gap: 5px; /* 替换margin，统一间距 */
    align-items: center;
    justify-content: flex-start;
}

/* 内联表单适配 */
.inline-form {
    display: inline-block;
}

/* ================================= 表单样式（登录/注册/后台修改） ================================= */
.form-container, .auth-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 30px;
    margin: 50px auto;
    width: 500px;
    max-width: 90%;
}

.form-horizontal {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.form-container h2, .auth-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.form-control, .form-group input, .form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
.form-group input, .form-group textarea {
    padding: 12px;
    font-size: 1rem;
}
.form-group textarea {
    height: 150px;
    resize: vertical;
}

.form-actions {
    margin-top: 20px;
}

/* 登录/注册页面（独立页面，无头部） */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f8f9fa;
}

/* ========== 新增：登录按钮居中样式 ========== */
.auth-container form {
    text-align: center; /* 让表单内的行内/行内块元素居中 */
}
.auth-container .btn {
    width: 100%; /* 按钮宽度铺满表单（可选，更美观） */
    padding: 12px 0; /* 优化按钮内边距，更饱满 */
    font-size: 1rem; /* 放大字体 */
    margin-top: 10px; /* 与密码框拉开间距 */
}
.auth-container form p {
    margin-top: 15px !important; /* 调整返回首页链接的间距 */
}

/* ================================= 分页样式 ================================= */
.pagination {
    display: flex;
    justify-content: center;
    margin: 40px 0;
    list-style: none;
}
.admin-pagination {
    margin-top: 30px;
}

.pagination li {
    margin: 0 5px;
}

.pagination a {
    display: inline-block;
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.3s, border-color 0.3s;
}

.pagination a:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

.pagination .active a {
    background-color: #333;
    color: #fff;
    border-color: #333;
}

.pagination .disabled a {
    color: #999;
    cursor: not-allowed;
    background-color: #f9f9f9;
    border-color: #ddd;
}

/* ================================= 轮播图样式 ================================= */
/* 搜索框容器（居中+轮播图上方） */
.search-container {
    max-width: 600px;
    margin: 20px auto; /* 上下间距20px，左右自动居中 */
    position: relative;
    z-index: 10; /* 确保搜索框在轮播图上方 */
}

/* 轮播图容器 */
.carousel {
    width: 100%;
    height: 400px; /* 轮播图高度（可根据需求调整） */
    overflow: hidden;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 20px 0;
}

/* 轮播图列表 */
.carousel-slides {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease; /* 切换动画（0.5秒平滑过渡） */
}

/* 单张轮播图 */
.carousel-slide {
    min-width: 100%;
    height: 100%;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 保持图片比例，填充整个容器（不会变形） */
}

/* 轮播图指示器（底部小圆点） */
.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 5;
}

.carousel-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.5); /* 未激活状态：半透明白色 */
    cursor: pointer;
    transition: background-color 0.3s;
}

.carousel-indicator.active {
    background-color: #fff; /* 激活状态：纯白色 */
    width: 30px;
    border-radius: 6px; /* 激活时变成长椭圆，更醒目 */
}

/* 轮播图左右切换按钮 */
.carousel-prev, .carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-color: rgba(0,0,0,0.3);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background-color 0.3s;
}

.carousel-prev:hover, .carousel-next:hover {
    background-color: rgba(0,0,0,0.5); /* hover时加深背景色 */
}

.carousel-prev {
    left: 20px;
}

.carousel-next {
    right: 20px;
}

/* 响应式调整（手机端） */
@media (max-width: 768px) {
    .carousel {
        height: 250px; /* 手机端缩小轮播图高度 */
    }
    .search-container {
        width: 90%; /* 手机端搜索框占满屏幕宽度的90% */
    }
}

/* ================================= 提示信息样式 ================================= */
.flash-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    text-align: center;
}

.success {
    background-color: #d4edda;
    color: #155724;
}

.danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* ================================= 后台仪表盘样式 ================================= */
.dashboard {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 30px;
    margin-top: 30px;
}

.dashboard h2 {
    margin-bottom: 30px;
    color: #333;
}

.current-preview {
    margin: 20px 0;
    padding: 20px;
    border: 1px dashed #ddd;
    border-radius: 4px;
}

.current-preview h3 {
    margin-bottom: 15px;
    color: #555;
}

.current-preview img {
    max-width: 300px;
    height: auto;
    border-radius: 4px;
}
/* 轮播图强制修复样式（优先级最高） */
.carousel {
    width: 100% !important;
    height: 400px !important;
    overflow: hidden !important;
    position: relative !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    margin: 20px 0 !important;
}

.carousel-slides {
    display: flex !important;
    height: 100% !important;
    transition: transform 0.5s ease !important;
    width: auto !important; /* 取消固定宽度，由子元素撑开 */
}

.carousel-slide {
    min-width: 100% !important;
    height: 100% !important;
    flex-shrink: 0 !important; /* 禁止压缩 */
}

.carousel-slide img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* 指示器强制样式 */
.carousel-indicators {
    position: absolute !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    gap: 10px !important;
    z-index: 999 !important;
}

.carousel-indicator {
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    background-color: rgba(255,255,255,0.5) !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.carousel-indicator.active {
    background-color: #fff !important;
    width: 30px !important;
    border-radius: 6px !important;
}

/* 切换按钮强制样式 */
.carousel-prev, .carousel-next {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 40px !important;
    height: 40px !important;
    background-color: rgba(0,0,0,0.3) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 50% !important;
    font-size: 18px !important;
    cursor: pointer !important;
    z-index: 999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.carousel-prev {
    left: 20px !important;
}

.carousel-next {
    right: 20px !important;
}

.carousel-prev:hover, .carousel-next:hover {
    background-color: rgba(0,0,0,0.5) !important;
}

