/* 商品列表頁-start */
.product-list-section {
    --product-list-fixed-top: 85px;
    --product-list-fixed-bar-height: 66px;
    padding: 40px 0 80px;
}

.fixed-filter-wrapper {
    position: fixed;
    height: 85px;
    top:0;
    left: 0;
    right: 0;
    z-index: 101;
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;

    .my-container {
        height: 100%;

        .fixed-filter-wrapper__inner {
            height: 100%;
        }
    }
}

.fixed-filter-wrapper.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

/* 固定篩選欄顯示時隱藏頂部導航 */
.main-header.is-hidden-by-filter {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-12px);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
}

.fixed-filter-wrapper__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: var(--product-list-fixed-bar-height);
    padding: 12px 0;
}

.product-list-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 0;
    align-items: start;
}

.product-list-toolbar {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.product-list-active-filters {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
}

.product-list-active-filters[hidden] {
    display: none !important;
}

.product-list-section.is-fixed-bar-visible .product-list-active-filters {
    display: none !important;
}

.product-list-active-filters__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    padding-bottom: 12px;
}

.product-list-active-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    padding: 0 10px 0 14px;
    border-radius: 999px;
    background: #18181809;
    color: var(--black-color);
    font-size: 14px;
    line-height: 1.2;
}

.product-list-active-filter__swatch {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--swatch-color, #cccccc);
    flex-shrink: 0;
}

.product-list-active-filter__label {
    white-space: nowrap;
}

.product-list-active-filter__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.product-list-active-filter__remove:hover {
    color: var(--black-color);
    background: rgba(0, 0, 0, 0.06);
}

.product-list-active-filters__clear {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.product-list-active-filters__clear:hover {
    color: var(--main-color);
}

.product-list-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: 4px;
    border-radius: 999px;
    background: var(--yellow-color);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.product-list-filter-badge[hidden] {
    display: none !important;
}

.product-list-sidebar {
    grid-column: 1;
    grid-row: 3;
    position: sticky;
    top: var(--product-list-fixed-top);
    align-self: start;
    min-width: 0;
    /* max-height: calc(100vh - var(--product-list-fixed-top)); */
    z-index: 2;
}

.product-list-section.is-fixed-bar-visible .product-list-sidebar {
    top: calc(var(--product-list-fixed-top) + var(--product-list-fixed-bar-height));
    /* max-height: calc(100vh - var(--product-list-fixed-top) - var(--product-list-fixed-bar-height)); */
}

.product-list-main {
    grid-column: 2;
    grid-row: 3;
    min-width: 0;
    padding-left: 40px;
}

.product-list-layout.is-filters-hidden {
    grid-template-columns: minmax(0, 1fr);
}

.product-list-layout.is-filters-hidden .product-list-sidebar {
    display: none;
}

.product-list-layout.is-filters-hidden .product-list-main {
    grid-column: 1 / -1;
}

.product-list-filter-show-btn,
.product-list-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 20px;
    border: none;
    border-radius: 999px;
    background: var(--main-color);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.product-list-filter-show-btn svg,
.product-list-filter-toggle svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    stroke-width: 1.5px;
}

.product-list-filter-show-btn:hover,
.product-list-filter-toggle:hover {
    background: var(--yellow-color);

    .product-list-filter-badge {
        background-color: #ffffff;
        color: var(--yellow-color);
    }
}

.product-list-filter-toggle {
    display: none;
}

/* 篩選側欄-start */
.product-list-filters {
    min-width: 0;
    width: 100%;
    overscroll-behavior: contain;
}

/* .product-list-section.is-fixed-bar-visible .product-list-filters {
    max-height: calc(100vh - 85px);
} */

.product-list-filters.is-hidden {
    display: none;
}

.product-list-filters__panel {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

.product-list-filters__head {
    display: none;
}

.product-list-filters__stock {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    padding-top: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid #eef2f7;
}

.product-list-filters__stock-label {
    font-size: 20px;
    font-weight: 500;
    color: var(--black-color);
}

.product-list-filter-backdrop {
    display: none;
}

.product-list-sort {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.product-list-section.is-fixed-bar-visible .product-list-layout > .product-list-toolbar {
    visibility: hidden;
    height: 0;
    margin: 0;
    overflow: hidden;
    pointer-events: none;
}

.filter-group {
    border-bottom: 1px solid #eef2f7;
    padding-bottom: 18px;
    margin-bottom: 18px;
}

.filter-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-group__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 20px;
    font-weight: 500;
    color: var(--black-color);
    text-align: left;
}

.filter-group__head svg {
    width: 14px;
    height: 14px;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.filter-group.is-collapsed .filter-group__head svg {
    transform: rotate(180deg);
}

.filter-group.is-collapsed .filter-group__body {
    display: none;
}

.filter-group__body {
    padding-top: 14px;
}

.filter-price-range {
    position: relative;
    height: 4px;
    margin: 16px 8px 20px;
    border-radius: 999px;
    background: #e5e7eb;
    touch-action: none;
}

.filter-price-range__track {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(to right,rgba(30, 140, 230, 0.6), rgba(30, 140, 230, 0.8), var(--main-color));
    pointer-events: none;
}

.filter-price-range__handle {
    position: absolute;
    top: 50%;
    left: 0;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--main-color);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    transform: translateX(-50%);
    cursor: grab;
    touch-action: none;
    user-select: none;
    z-index: 1;
}

.filter-price-range__handle--max {
    z-index: 2;
}

.filter-price-range.is-dragging .filter-price-range__handle {
    cursor: grabbing;
}

.filter-price-inputs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: center;
}

.filter-price-inputs__sep {
    font-size: 13px;
    color: #9ca3af;
}

.filter-price-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    min-height: 52px;
    border-radius: 52px;
    padding: 0 22px;
    border: none;
    background: #18181806;
}

.filter-price-field span {
    font-size: 16px;
    color: #9ca3af;
}

.filter-price-field input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--main-color);
    background: transparent;
    text-align: right;
}

.filter-color-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-color-item {
    position: relative;
    cursor: pointer;
}

.filter-color-item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.filter-color-item__swatch {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--swatch-color, #cccccc);
    border: 2px solid transparent;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.filter-color-item input:checked + .filter-color-item__swatch {
    border-color: var(--main-color);
    transform: scale(1.05);
}

.filter-check-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 16px;
    color: var(--black-color);
}

.filter-check-item input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--main-color);
    flex-shrink: 0;
}

.filter-radio-list {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 10px 12px;
}

.filter-radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    cursor: pointer;
    font-size: 16px;
    color: var(--black-color);
}

.filter-radio-item input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--main-color);
    flex-shrink: 0;
}

.filter-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.filter-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.filter-toggle__slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #e5e7eb;
    cursor: pointer;
    transition: background 0.25s ease;
}

.filter-toggle__slider::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s ease;
}

.filter-toggle input:checked + .filter-toggle__slider {
    background: linear-gradient(to right,rgba(30, 140, 230, 0.6) 10%, rgba(30, 140, 230, 0.9) 80%, var(--main-color));
}

.filter-toggle input:checked + .filter-toggle__slider::before {
    transform: translateX(20px);
}

/* 篩選側欄-end */

/* 商品列表主區-start */
.product-list-sort__label {
    font-size: 14px;
    color: var(--black-color);
    white-space: nowrap;
}

.product-list-sort__dropdown {
    position: relative;
    display: inline-block;
    min-width: 156px;
}

.product-list-sort__select--native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.product-list-sort__trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-width: 156px;
    height: 42px;
    padding: 0 16px 0 18px;
    border: 1px solid rgba(24, 24, 24, 0.12);
    border-radius: 999px;
    background: #ffffff;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;

    &:hover,
    .product-list-sort__dropdown.is-open & {
        color: var(--black-color);
        border-color: rgba(30, 140, 230, 0.35);
        box-shadow: 0 4px 14px rgba(30, 140, 230, 0.08);
    }
}

.product-list-sort__value {
    flex: 1;
    min-width: 0;
    text-align: left;
    white-space: nowrap;
}

.product-list-sort__chevron {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    color: rgba(24, 24, 24, 0.55);
    transition: transform 0.25s ease, color 0.2s ease;

    svg {
        width: 12px;
        height: 12px;
    }
}

.product-list-sort__dropdown.is-open .product-list-sort__chevron {
    transform: rotate(180deg);
    color: var(--main-color);
}

.product-list-sort__menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 30;
    margin: 0;
    padding: 6px;
    list-style: none;
    border: 1px solid rgba(24, 24, 24, 0.08);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 14px 36px rgba(24, 24, 24, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top center;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
    pointer-events: none;
}

.product-list-sort__dropdown.is-open .product-list-sort__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.product-list-sort__option {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--black-color);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;

    &:hover {
        background: rgba(30, 140, 230, 0.08);
        color: var(--main-color);
    }

    &.is-selected {
        background: linear-gradient(to right, var(--main-color), rgba(30, 140, 230, 0.6));
        color: #ffffff;
        position: relative;

        &::after {
            /* 指向左边的三角形 */
            content: "";
            position: absolute;
            right: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 0;
            height: 0;
            border-top: 24px solid transparent;
            border-bottom: 24px solid transparent;
            border-right: 36px solid rgba(255, 255, 255, 0.1);
        }
    }

    &.is-selected:hover {
        background: var(--main-color);
        color: #ffffff;
    }
}

/* 保留舊 class 兼容未增強前的 select */
.product-list-sort__select:not(.product-list-sort__select--native) {
    width: fit-content;
    height: 42px;
    padding: 0 36px 0 14px;
    border: 1px solid rgba(24, 24, 24, 0.12);
    border-radius: 999px;
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23181818' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center;
    font-size: 14px;
    color: #6b7280;
    outline: none;
    appearance: none;
    cursor: pointer;

    &:hover {
        color: var(--black-color);
        border-color: rgba(24, 24, 24, 0.4);
    }
}

.product-list-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px;

    .product-card {
        border: none;
        transition: opacity 0.25s ease, transform 0.25s ease;

        &.is-filter-hidden {
            display: none;
        }
    }
}

.product-list-main.is-category-filtering .product-list-grid .product-card:not(.is-filter-hidden) {
    animation: product-list-filter-in 0.35s ease;
}

@keyframes product-list-filter-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-height: 420px;
    padding: 64px 24px;
    text-align: center;

    &[hidden] {
        display: none !important;
    }
}

.product-list-empty__icon {
    width: 30%;
    height: 30%;
    margin-bottom: 28px;
    color: var(--black-color);

    img {
        display: block;
        width: 100%;
        height: 100%;
    }
}

.product-list-empty__title {
    margin: 0 0 12px;
    font-size: clamp(20px, 2.4vw, 32px);
    font-weight: 400;
    line-height: 1.35;
    color: var(--black-color);
}

.product-list-empty__hint {
    margin: 0 0 20px;
    font-size: 16px;
    line-height: 1.5;
    color: var(--black-color);
}

.product-list-empty__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 28px;
    border: none;
    border-radius: 999px;
    background: var(--yellow-color);
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;

    svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    &:hover {
        transform: translateY(-1px);
        box-shadow: 0 8px 20px rgba(30, 140, 230, 0.6);
    }

    &::before {
        background-color: var(--main-color);
    }

}

.product-list-pagination {
    display: flex;
    justify-content: center;
    margin-top: 48px;

    &[hidden] {
        display: none !important;
    }
}

/* 商品列表主區-end */
/* 商品列表頁-end */
