:root {
    font-size: 62.5%; /* 1rem = 10px 方便换算 */
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 2rem;
    background-color: #fff;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    box-sizing: border-box;
}

.container {
    width: 100%;
    /* max-width: 120rem; */
    /* background-color: #fff; */
    padding-top: 4rem;
    border-radius: 0.8rem;
    /* box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.08); */
}

/* 筛选区（下拉菜单）样式 */
.filters-dropdowns {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 0.1rem solid #eee;
    justify-content: flex-start;
}
.filters-h5 {
    display: none;
    width: auto;
    position: fixed;
    top: 0;
    left: 0;right: 0;
    padding:2rem 1.2rem 0;
    background-color: #fff;
    z-index: 99;
}
.filter-postion{
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    gap: 1.2rem;
    padding-bottom:1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.filters-item{
    display: flex;
    color: #333;
    font-weight: 500;
    align-items: center;
    width: 120px;
    padding: 0.8rem 1.2rem;
    background-color: #f5f5f5;
    border-radius: 4px;
}
.filters-item .lable{
    font-size: 14px;
    margin-right: 6px;
    width: max-content;
}

.filters-h5::-webkit-scrollbar {
    display: none;
}

/* 移动端弹窗样式 */
.filter-modal {
    position: fixed;
    top: 6rem;
    left: 0;
    bottom: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.35);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 999;
    animation: fadeIn 0.18s ease;
    /* padding: max(1.2rem, env(safe-area-inset-top)) 1.2rem 1.2rem; */
    box-sizing: border-box;
}

.filter-modal.open {
    display: flex;
}

.filter-modal__sheet {
    width: 100%;
    max-width: 110rem;
    max-height: 70vh;
    background: #fff;
    border-radius:0 0 1.2rem 1.2rem;
    padding: 1.6rem 1.4rem 1.6rem;
    box-shadow: 0 1.2rem 2.4rem rgba(0, 0, 0, 0.14);
    animation: slideDown 0.2s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.filter-modal__title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #111;
    margin: 0;
}

.filter-modal__list {
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    /* border-top: 0.1rem solid #f1f1f1;
    border-bottom: 0.1rem solid #f1f1f1; */
}

.filter-modal__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 0.2rem;
    font-size: 1.5rem;
    color: #161616;
    cursor: pointer;
    transition: color 0.15s ease;
}
.filter-modal__item.active{
    color: #14A269;
    font-weight: 700;
}

.filter-modal__item:hover {
    color: #007bff;
}

.filter-modal__check {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    color: #fff;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.8rem;
}

@keyframes slideDown {
    from { transform: translateY(-12%); opacity: 0.75; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.filter-dropdown-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.filter-dropdown-group label {
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    font-size: 1.4rem;
}

.filter-dropdown {
    padding: 0.8rem 1.2rem;
    border: 0.1rem solid #ddd;
    border-radius: 0.5rem;
    background-color: #f7f7f7;
    font-size: 1.4rem;
    color: #555;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23555%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%00-13-5.4H18.4c-4.9%200-9.2%202-12.9%205.4A17.6%2017.6%200%200%000%2082.2c0%204.9%202%209.2%205.4%2012.9l128%20127.9c3.7%203.7%208%205.6%2012.9%205.6s9.2-1.8%2012.9-5.6L287%2095.1a17.6%2017.6%200%200%005.4-12.9c0-4.9-2-9.1-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    background-size: 1.2rem;
    padding-right: 3rem;
}

.filter-dropdown:hover {
    border-color: #007bff;
}

.filter-dropdown:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* 模板网格布局 */
.template-grid {
    /* display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.6rem;
    padding: 2rem 0 0; */
    display: block;
    column-count: 6;
    column-gap: 1.6rem;
    padding: 2rem 0 0;
}

/* 单个模板卡片样式 */
.template-card {
    background-color: #fff;
    border-radius: 0.8rem;
    overflow: hidden;
    box-shadow: 0 0.2rem 0.8rem rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    width: 100%;
    position: relative;
    break-inside: avoid;
    margin-bottom: 1.6rem;
}

.template-card:hover {
    transform: translateY(-0.5rem);
    box-shadow: 0 0.6rem 1.6rem rgba(0, 0, 0, 0.1);
}

.template-card.selected {
    border: 0.3rem solid #007bff;
    box-shadow: 0 0 0 0.3rem rgba(0, 123, 255, 0.3);
}

.template-card-image {
    width: 100%;
    height: 426px; /* 16:9比例 */
    object-fit: cover;
    border-bottom: 0.1rem solid #eee;
    background: #f7f7f7;
    border-radius: 8px;
    display: block;
}
.template-card-image.horizontal {
    height: 322px;
}

.template-card-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.template-card-title {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 0;
    color: #333;
}

.template-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.tag {
    background-color: #e9ecef;
    color: #495057;
    padding: 0.3rem 0.6rem;
    border-radius: .7rem;
    font-size: 1.2rem;
}

.tag.orientation-tag {
    margin-left: 4px;
    background-color: #2CC286;
    color: #fff;
}
.tag.horizontal {
    margin-left: 4px;
    background-color: #4771E5;
    color: #fff;
}

.selection-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: #007bff;
    color: white;
    border-radius: 50%;
    width: 2.4rem;
    height: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: bold;
    display: none;
}

.template-card.selected .selection-indicator {
    display: flex;
}

.submit-btn:hover {
    background-color: #218838;
}

/* 新增 active-filter 的样式：背景绿色、文字与图标变白，并适度提升对比与交互反馈 */


.filters-item.active-filter .lable {
    color: #14A269;
}

/* 若 filters-item 内有 svg 小箭头，需要也变色 */
.filters-item.active-filter svg path {
    fill: #14A269;
}

/* Hover 状态保持颜色但稍微加深 */
.filters-item.active-filter:hover {
    background-color: #0f8a53;
}

/* 响应式调整：移动端两列瀑布流风格 */
@media (max-width: 64rem) {
    .template-card-image{
        height: 296px; /* 16:9比例 */
    }
    .template-card-image.horizontal{
        height: 222px;
    }
    .filters-dropdowns {
        display: none;
    }
    /* .filters-h5 {
        display: flex;
    } */
    .filter-dropdown-group label {
        display: none;
    }
    .template-grid {
        display: block; /* 让 column-count 生效 */
        column-count: 2;
        column-gap: 1.2rem;
    }
    .template-card {
        margin-bottom: 1.2rem;
    }
    .container {
        padding-top: 5rem;
    }
    body {
        padding: 1.5rem;
    }
}

@media (max-width: 48rem) {
    .template-grid {
        column-count: 2;
        column-gap: 1rem;
    }
    .template-card {
        border-radius: 1rem;
    }
    .template-card-title {
        font-size: 1.4rem;
    }
    .container {
        padding-top: 5rem;
    }
    body {
        padding: 1.2rem;
    }
}