/* =============================================
   Product Filter Page
   Uses variables from variables.css
   Font: Segoe UI (consistent với dự án)
   ============================================= */

.pf-page {
    background-color: var(--color-bg2);
    padding: 28px 0 64px;
    min-height: 70vh;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.pf-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---- Breadcrumb ---- */
.pf-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-body);
    color: var(--color-subtext);
    margin-bottom: 18px;
}

.pf-breadcrumb a {
    color: var(--color-subtext);
    text-decoration: none;
    transition: color .2s;
}

.pf-breadcrumb a:hover { color: var(--color-main); }

.pf-breadcrumb .sep { font-size: 12px; }

.pf-breadcrumb .current {
    color: var(--color-text);
    font-weight: 500;
}

/* ---- Page heading ---- */
.pf-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #ffe0b2;
}

.pf-heading h1 {
    font-size: var(--font-small);
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: .6px;
    position: relative;
    padding-left: 14px;
}

.pf-heading h1::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--color-main);
    border-radius: 2px;
}

.pf-count {
    font-size: var(--font-body);
    color: var(--color-subtext);
    font-weight: 400;
}

/* ---- Main layout ---- */
.pf-layout {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr); 
    gap: 20px;
    align-items: start;
}

/* =============================================
   SIDEBAR
   ============================================= */
.pf-sidebar {
    background: var(--color-bg);
    border-radius: 12px;
    border: 1px solid #ffe0b2;
    overflow: hidden;
    position: sticky;
    top: 90px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.pf-sidebar-title {
    background: var(--color-main);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 11px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pf-sidebar-title svg { opacity: .9; }

/* Filter block */
.pf-filter-block {
    border-bottom: 1px solid #f5f5f5;
}

.pf-filter-block:last-child { border-bottom: none; }

.pf-filter-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
}

.pf-filter-toggle h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
    letter-spacing: .2px;
}

.pf-chevron {
    font-size: 10px;
    color: var(--color-subtext);
    transition: transform .25s;
    line-height: 1;
}

.pf-filter-toggle.is-open .pf-chevron { transform: rotate(180deg); }

.pf-filter-body {
    padding: 0 16px 14px;
}

.pf-filter-body.is-hidden { display: none; }

/* Category list */
.pf-cat-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pf-cat-list > li > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    font-size: 13px;
    color: var(--color-text);
    text-decoration: none;
    border-radius: 7px;
    transition: background .18s, color .18s;
}

.pf-cat-list > li > a:hover {
    background: #fff5e6;
    color: var(--color-main);
}

.pf-cat-list > li > a.is-active {
    background: #fff5e6;
    color: var(--color-main);
    font-weight: 600;
}

.pf-cat-list .pf-arrow {
    font-size: 16px;
    color: var(--color-subtext);
}

/* Subcategory */
.pf-cat-sub-list {
    list-style: none;
    margin: 2px 0 4px 10px;
    padding: 0;
    border-left: 2px solid #ffe0b2;
}

.pf-cat-sub-list li a {
    display: block;
    padding: 5px 8px 5px 10px;
    font-size: 12px;
    color: #666;
    text-decoration: none;
    border-radius: 5px;
    transition: background .15s, color .15s;
}

.pf-cat-sub-list li a:hover { color: var(--color-main); background: #fff5e6; }
.pf-cat-sub-list li a.is-active { color: var(--color-main); font-weight: 600; }

/* Checkbox list (brand & attrs) */
.pf-check-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.pf-check-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    line-height: 1.4;
}

.pf-check-list input[type="checkbox"] {
    accent-color: var(--color-main);
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    cursor: pointer;
}

.pf-brand-count {
    margin-left: auto;
    font-size: 11px;
    color: var(--color-subtext);
    background: var(--color-bg2);
    border-radius: 10px;
    padding: 1px 7px;
    flex-shrink: 0;
}

/* Show more */
.pf-show-more {
    margin-top: 10px;
    font-size: 12px;
    color: var(--color-main);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-weight: 500;
}

.pf-show-more:hover { text-decoration: underline; }

/* Price range */
.pf-price-inputs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.pf-price-inputs input {
    width: 50%;
    border: 1px solid #e0e0e0;
    border-radius: 7px;
    padding: 7px 8px;
    font-size: 12px;
    color: var(--color-text);
    text-align: center;
    outline: none;
    font-family: inherit;
    background: var(--color-bg2);
}

.pf-price-inputs input:focus { border-color: var(--color-main); background: #fff; }

/* Dual range slider */
.pf-range-wrap {
    position: relative;
    height: 22px;
    margin-bottom: 14px;
}

.pf-range-wrap input[type="range"] {
    position: absolute;
    width: 100%;
    height: 4px;
    background: transparent;
    pointer-events: none;
    appearance: none;
    -webkit-appearance: none;
    top: 50%;
    transform: translateY(-50%);
}

.pf-range-wrap input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: var(--color-main);
    cursor: pointer;
    pointer-events: all;
    border: 2px solid #fff;
    box-shadow: 0 1px 5px rgba(0,0,0,.2);
}

.pf-range-track {
    position: absolute;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
}

.pf-range-fill {
    position: absolute;
    height: 4px;
    background: var(--color-main);
    border-radius: 2px;
    top: 50%;
    transform: translateY(-50%);
}

.pf-apply-btn {
    width: 100%;
    padding: 9px;
    background: var(--color-main);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: .3px;
    transition: background .2s, transform .15s;
}

.pf-apply-btn:hover { background: #e68900; transform: translateY(-1px); }

.pf-reset-btn {
    width: 100%;
    padding: 8px;
    background: transparent;
    color: var(--color-subtext);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    margin-top: 7px;
    font-family: inherit;
    transition: all .2s;
}

.pf-reset-btn:hover { border-color: var(--color-main); color: var(--color-main); }

/* Mobile filter toggle */
.pf-mobile-filter-toggle {
    display: none;
    width: 100%;
    padding: 10px 16px;
    background: var(--color-main);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

/* =============================================
   CONTENT AREA
   ============================================= */

/* Sort bar */
.pf-sort-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    background: var(--color-bg);
    border-radius: 10px;
    padding: 10px 14px;
    border: 1px solid #f0f0f0;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    flex-wrap: wrap;
}

.pf-sort-label {
    font-size: 13px;
    color: var(--color-subtext);
    white-space: nowrap;
    margin-right: 2px;
}

.pf-sort-btn {
    padding: 5px 13px;
    border-radius: 20px;
    border: 1px solid #e8e8e8;
    background: transparent;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    transition: all .18s;
    font-family: inherit;
    white-space: nowrap;
    line-height: 1.5;
}

.pf-sort-btn:hover { border-color: var(--color-main); color: var(--color-main); }

.pf-sort-btn.is-active {
    background: var(--color-main);
    border-color: var(--color-main);
    color: #fff;
    font-weight: 600;
}

.pf-view-toggle {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.pf-view-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e8e8e8;
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
    color: var(--color-subtext);
    transition: all .18s;
}

.pf-view-btn.is-active,
.pf-view-btn:hover {
    background: var(--color-main);
    border-color: var(--color-main);
    color: #fff;
}

/* Active filter chips */
.pf-active-filters {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    align-items: center;
}

.pf-filters-label {
    font-size: 12px;
    color: var(--color-subtext);
}

.pf-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: #fff5e6;
    border: 1px solid #ffd8a8;
    border-radius: 20px;
    font-size: 12px;
    color: #b36200;
    cursor: pointer;
    transition: all .15s;
    font-weight: 500;
}

.pf-chip:hover { background: #ffe0b2; border-color: var(--color-main); }

.pf-chip-close {
    font-size: 14px;
    line-height: 1;
    opacity: .7;
}

/* ---- Product Grid ---- */
.pf-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

/* ---- Product Card ---- */
.pf-card {
    background: var(--color-bg);
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .3s, transform .25s, border-color .3s;
    position: relative;
}

.pf-card:hover {
    box-shadow: 0 8px 28px rgba(0,0,0,.10);
    transform: translateY(-3px);
    border-color: transparent;
}

/* Badge */
.pf-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.pf-card-badge.new { background: #2e7d32; color: #fff; }
.pf-card-badge.sale { background: #c62828; color: #fff; }

/* Image */
.pf-card-img {
    position: relative;
    aspect-ratio: 1/1;
    overflow: hidden;
    background: var(--color-bg2);
}

.pf-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
    transition: transform .5s ease;
}

.pf-card:hover .pf-card-img img { transform: scale(1.07); }

.pf-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.38);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s;
}

.pf-card:hover .pf-card-overlay { opacity: 1; }

.pf-card-overlay a {
    background: var(--color-main);
    color: #fff;
    padding: 9px 20px;
    text-decoration: none;
    font-weight: 700;
    font-size: 12px;
    border-radius: 5px;
    transform: translateY(8px);
    transition: transform .25s;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.pf-card:hover .pf-card-overlay a { transform: translateY(0); }

/* Card body */
.pf-card-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 4px;
}

.pf-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pf-card-brand {
    font-size: 11px;
    color: var(--color-main);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.pf-card-sku {
    font-size: 10px;
    color: var(--color-subtext);
    background: var(--color-bg2);
    padding: 1px 6px;
    border-radius: 4px;
}

.pf-card-name {
    font-size: 13px;
    color: var(--color-text);
    font-weight: 500;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 38px;
    text-decoration: none;
    margin-top: 2px;
}

.pf-card-name:hover { color: var(--color-main); }

.pf-card-footer {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid #f5f5f5;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
}

.pf-card-price-wrap { display: flex; flex-direction: column; }

.pf-card-price-old {
    font-size: 11px;
    color: var(--color-subtext);
    text-decoration: line-through;
    display: block;
    line-height: 1.3;
}

.pf-card-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-main);
    line-height: 1.2;
}

.pf-card-contact {
    font-size: 11px;
    color: var(--color-subtext);
    font-style: italic;
}

.pf-action-block {
    padding: 10px
}

/* List view */
.pf-grid.list-view { grid-template-columns: 1fr; }

.pf-grid.list-view .pf-card {
    flex-direction: row;
    border-radius: 10px;
}

.pf-grid.list-view .pf-card-img {
    width: 160px;
    flex-shrink: 0;
    aspect-ratio: auto;
}

.pf-grid.list-view .pf-card-body {
    justify-content: center;
    padding: 16px;
}

.pf-grid.list-view .pf-card-name {
    height: auto;
    -webkit-line-clamp: 3;
}

/* Empty state */
.pf-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--color-subtext);
}

.pf-empty svg { margin-bottom: 12px; opacity: .4; }

.pf-empty p { font-size: var(--font-small); margin: 0 0 16px; }

.pf-empty a {
    display: inline-block;
    padding: 9px 22px;
    background: var(--color-main);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

/* ---- Pagination ---- */
.pf-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 32px;
}

.pf-page-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: var(--color-bg);
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    transition: all .18s;
    text-decoration: none;
    font-family: inherit;
}

.pf-page-btn:hover { border-color: var(--color-main); color: var(--color-main); }

.pf-page-btn.is-active {
    background: var(--color-main);
    border-color: var(--color-main);
    color: #fff;
    font-weight: 700;
}

.pf-page-btn:disabled,
.pf-page-btn.disabled { opacity: .4; cursor: default; pointer-events: none; }

#product-content{
    scroll-margin-top: 200px;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1100px) {
    .pf-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
    .pf-layout { 
        grid-template-columns: minmax(0, 1fr); 
    }
    .pf-sidebar { 
        position: static; 
        /* Ẩn viền và bóng của khung ngoài khi ở chế độ mobile */
        border: none; 
        background: transparent; 
        box-shadow: none; 
    }
    .pf-mobile-filter-toggle { 
        display: flex; 
    }
    .pf-sidebar-inner { 
        display: none; 
        /* Thiết lập lại khung nền và viền cho phần nội dung khi được mở ra */
        background: var(--color-bg);
        border: 1px solid #ffe0b2;
        border-radius: 12px;
        margin-top: 10px;
        padding: 10px 0;
    }
    .pf-sidebar-inner.is-open { 
        display: block; 
    }
    .pf-sidebar-title {
        display: none;
    }
}

@media (max-width: 640px) {
    .pf-grid { grid-template-columns: repeat(2, 1fr); }
    .pf-sort-label { display: none; }
}

@media (max-width: 380px) {
    .pf-grid { grid-template-columns: 1fr; }
}
