/* 全局 */
body {
    margin: 0;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #fafafa;
    color: #333;
}

a { text-decoration: none; color: inherit; }

/* 页面最大宽度居中（PC：1200 居中，移动：100% 宽度） */
.site-header,
.filters,
.section-title,
.movie-list,
.pagination,
.footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

/* ======================== 顶部 Header ======================== */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    background: white;
}

.site-header .logo {
    display: flex;
    align-items: center;
}
.site-header .logo .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff4c7b;
    margin-right: 10px;
}
.site-header h1 {
    font-size: 22px;
    margin: 0;
}

/* ------------------- 顶部菜单 ------------------ */
.nav a {
    margin-right: 20px;
    color: #666;
}
.nav a.active {
    color: #ff436c;
    font-weight: bold;
}

/* ------------------- 搜索框 ------------------ */
.search-box {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 30px;
    padding: 4px 10px 4px 18px;
    width: 260px;
}
.search-box input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 14px;
    background: none;
}
.search-box button {
    border: none;
    background: #ff4c7b;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ======================== 筛选栏 ======================== */
.filters {
    margin-top: 10px;
    padding: 15px 0;
}
.filter-group {
    margin-bottom: 8px;
}
.filter-title {
    font-weight: bold;
    margin-right: 10px;
}
.filter-btn {
    padding: 5px 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #ddd;
    margin-right: 6px;
    cursor: pointer;
    margin-bottom: 6px;
}
.filter-btn:hover {
    background: #ffedf3;
    border-color: #ff4c7b;
}

/* ======================== 最新更新标题 ======================== */
.section-title {
    margin: 20px auto 10px auto;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
}
.section-title i {
    color: #ff4c7b;
    margin-right: 6px;
}

/* ======================== 电影列表 ======================== */
.movie-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 22px;
    margin-top: 10px;
}

.movie-card {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    transition: transform .2s;
}
.movie-card:hover {
    transform: translateY(-4px);
}
.movie-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}
.movie-info {
    padding: 12px;
}
.movie-info h3 {
    margin: 0;
    font-size: 15px;
}
.movie-info .meta {
    margin-top: 4px;
    font-size: 13px;
    color: #999;
}

/* ======================== 分页 ======================== */
.pagination {
    display: flex;
    justify-content: center;
    margin: 25px auto;
    align-items: center;
}
.pagination button {
    border: 1px solid #ccc;
    background: white;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    margin: 0 8px;
}
.pagination span {
    font-size: 15px;
    color: #555;
}

/* ======================== footer ======================== */
.footer {
    text-align: center;
    padding: 20px 0 40px 0;
    color: #777;
    font-size: 13px;
}
.footer a {
    color: #4ca3ff;
}

/* ======================== 手机端自适应 ======================== */
@media (max-width: 768px) {
    /* 顶部整体内边距收紧 */
    .site-header,
    .filters,
    .section-title,
    .movie-list,
    .pagination,
    .footer {
        padding: 0 10px;
        width: 100%;
        max-width: 100%;
    }

    /* 头部上下堆叠显示 */
    .site-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* 导航换成单行靠左 */
    .nav {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 4px;
    }
    .nav a {
        margin-right: 0;
        font-size: 14px;
    }

    /* 搜索框占满整行 */
    .search-box {
        width: 100%;
    }

    /* 筛选按钮一行放不下可以自动换行 */
    .filters {
        padding-top: 10px;
    }
    .filter-group {
        font-size: 14px;
    }

    /* 电影列表：一行 2 个 */
    .movie-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }
    .movie-card img {
        height: 160px;
    }

    /* 分页按钮稍微缩小一点 */
    .pagination {
        margin-top: 18px;
    }
    .pagination button {
        padding: 5px 12px;
        font-size: 13px;
    }

    .footer {
        font-size: 12px;
        padding-bottom: 20px;
    }
}
/* ================== 分类按钮视觉增强 ================== */

/* 分类列表容器 */
.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: 90px; /* 默认折叠高度 */
    overflow: hidden;
    transition: max-height .3s ease;
}

/* 展开状态 */
.category-list.open {
    max-height: 500px;
}

/* 折叠切换按钮 */
.toggle-category {
    background: none;
    border: none;
    color: #ff4d6d;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
}

/* ---------------- 颜色主题 + 图标 ---------------- */

.filter-btn {
    border-width: 1px;
    padding: 6px 14px;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
}

/* 主类型颜色 */
.type-action { border-color:#ff3b30; color:#ff3b30; }
.type-love { border-color:#ff69b4; color:#ff69b4; }
.type-comedy { border-color:#ffcc00; color:#ffcc00; }
.type-drama { border-color:#7d5fff; color:#7d5fff; }
.type-scifi { border-color:#00c2ff; color:#00c2ff; }
.type-suspense { border-color:#4287f5; color:#4287f5; }
.type-thriller { border-color:#ff9500; color:#ff9500; }

/* 更多类型 */
.type-crime { border-color:#d63031; color:#d63031; }
.type-war { border-color:#6c5ce7; color:#6c5ce7; }
.type-adventure { border-color:#00b894; color:#00b894; }
.type-family { border-color:#fdcb6e; color:#fdcb6e; }
.type-fantasy { border-color:#a29bfe; color:#a29bfe; }
.type-disaster { border-color:#e17055; color:#e17055; }
.type-animation { border-color:#00cec9; color:#00cec9; }
.type-history { border-color:#b08457; color:#b08457; }
.type-wuxia { border-color:#0984e3; color:#0984e3; }
.type-horror { border-color:#2d3436; color:#2d3436; }
.type-doc { border-color:#16a085; color:#16a085; }
.type-ancient { border-color:#e67e22; color:#e67e22; }
.type-short { border-color:#8e44ad; color:#8e44ad; }

/* ========== 手机端分类修复（按钮不拉伸、横向滑动） ========== */
@media (max-width:768px) {

    /* 分类容器：横向滑动，不换行 */
    .category-list {
        display: flex;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        padding: 10px 0;
        max-height: none !important;
        gap: 10px;
    }

    /* 隐藏滚动条（仅移动端） */
    .category-list::-webkit-scrollbar {
        display: none;
    }

    /* 分类按钮：变成紧凑的小胶囊 */
    .filter-btn {
        flex: 0 0 auto !important;
        white-space: nowrap;
        padding: 6px 14px;
        border-radius: 20px;
        font-size: 15px;
        background: #fff;
        border-width: 2px !important;
    }

    /* 折叠按钮手机端隐藏 */
    .toggle-category {
        display: none !important;
    }

    /* 让更多分类部分也横向排布 */
    .category-more {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 10px;
    }
}
