/* ========================================
   Custom Filter - Main Styles
   ======================================== */

/* Reset */
.cf-filter-wrapper {
    width: min(100%, 1710px);
    margin: 0 auto;
}

.cf-filter-wrapper * {
    box-sizing: border-box;
}

.cf-archive-title {
    margin: 0 0 10px;
    color: #111;
    font-size: 30px;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: 0;
}

.cf-archive-description {
    max-width: 950px;
    position: relative;
}

.cf-archive-description p {
    margin: 0;
    color: rgba(0, 0, 0, 0.68);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
    position: relative;
    overflow: hidden;
    transition: max-height 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.cf-archive-description.has-more p {
    max-height: 4.8em;
}

.cf-archive-description.has-more:not(.is-expanded) p::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2.8em;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #fff 78%);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.35s ease;
}

.cf-archive-description.is-expanded p {
    max-height: 24em;
}

.cf-archive-description.is-expanded p::after {
    opacity: 0;
}

.cf-archive-more {
    margin-top: 10px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #111;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.cf-archive-more:hover {
    opacity: 0.7;
}

.cf-archive-description.is-expanded .cf-archive-more {
    transform: translateY(2px);
}

/* ---- TOP BAR ---- */
.cf-top-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 0 16px;
    flex-wrap: wrap;
    border-bottom: 1px solid #ececec;
}

.cf-top-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    flex: 1;
    min-width: 0;
    max-width: 1100px;
}

.cf-top-bar-right {
    flex-shrink: 0;
    margin-left: auto;
    position: relative;
}

/* Filter Button */
.cf-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid rgba(0, 0, 0, 0.28);
    background: #fff;
    color: #222;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.cf-filter-btn:hover {
    background: #fff;
    color: #111;
    border-color: rgba(0, 0, 0, 0.6);
}

.cf-filter-btn svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.cf-brand-toolbar {
    display: flex;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.cf-brand-toolbar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 56px;
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, #fff 82%);
    pointer-events: none;
    z-index: 2;
}

.cf-brand-swiper {
    overflow: hidden;
    flex: 1 1 0;
    min-width: 0;
    touch-action: pan-x;
    -ms-touch-action: pan-x;
}

.cf-brand-slide {
    width: auto !important;
    flex-shrink: 0;
}

.cf-brand-swiper .swiper-wrapper {
    align-items: center;
}

.cf-toolbar-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    background: #fff;
    color: rgba(0, 0, 0, 0.72);
    font-size: 15px;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
    font-family: inherit;
    flex-shrink: 0;
}

.cf-toolbar-brand:hover {
    border-color: rgba(0, 0, 0, 0.6);
    color: rgba(0, 0, 0, 1);
}

.cf-toolbar-brand.active {
    border: 2px solid rgba(0, 0, 0, 1);
    color: rgba(0, 0, 0, 1);
    font-weight: 400;
}

/* Active Chips */
.cf-active-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
    padding-top: 10px;
}

.cf-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 12px;
    border: 0;
    background: #f5f5f5;
    color: rgba(0, 0, 0, 0.78);
    font-size: 13px;
    cursor: default;
    white-space: nowrap;
    transition: background-color 0.2s ease;
    font-family: inherit;
}

.cf-chip:hover {
    background: #e6e6e6;
}

.cf-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    color: rgba(0, 0, 0, 0.45);
    font-size: 15px;
    line-height: 1;
    transition: color 0.2s;
}

.cf-chip-text {
    line-height: 1.2;
    font-size: 15px;
    font-weight: 400;
}

.cf-chip-remove:hover {
    color: #222;
}

/* Sort Dropdown */
.cf-sort-dropdown {
    position: relative;
}

.cf-sort-trigger {
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    background: #f5f3ef;
    color: rgba(0, 0, 0, 0.78);
    font-size: 15px;
    font-weight: 400;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    font-family: inherit;
}

.cf-sort-trigger-icon {
    transition: transform 0.18s ease;
}

.cf-sort-dropdown.is-open .cf-sort-trigger-icon {
    transform: rotate(180deg);
}

.cf-sort-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 190px;
    padding: 8px 0;
    border: 1px solid #dddddd;
    background: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
    display: none;
    z-index: 20;
}

.cf-sort-dropdown.is-open .cf-sort-menu {
    display: block;
}

.cf-sort-option {
    width: 100%;
    min-height: 48px;
    padding: 0 18px;
    border: 0;
    background: #fff;
    color: #111;
    font-size: 15px;
    font-weight: 400;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    cursor: pointer;
}

.cf-sort-option:hover {
    background: #fafafa;
}

.cf-sort-option-check {
    opacity: 0;
    font-size: 16px;
    line-height: 1;
}

.cf-sort-option.is-active .cf-sort-option-check {
    opacity: 1;
}

/* ---- OVERLAY ---- */
.cf-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cf-overlay.cf-active {
    opacity: 1;
    visibility: visible;
}

/* ---- SIDEBAR ---- */
.cf-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 395px;
    max-width: 90vw;
    height: 100%;
    background: #fff;
    z-index: 99999;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
}

.cf-sidebar.cf-active {
    transform: translateX(0);
}

/* Sidebar Header */
.cf-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 0;
    flex-shrink: 0;
}

.cf-sidebar-title {
    font-size: 20px;
    font-weight: 400;
    color: #222;
    margin: 0;
    letter-spacing: 0.3px;
}

.cf-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    color: #222;
    padding: 0;
    transition: opacity 0.2s;
}

.cf-sidebar-close:hover {
    opacity: 0.6;
}

/* Sidebar Body */
.cf-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0 0;
    -webkit-overflow-scrolling: touch;
}

.cf-sidebar-body::-webkit-scrollbar {
    width: 6px;
}

.cf-sidebar-body::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.cf-sidebar-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.cf-sidebar-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Sidebar Sections */
.cf-sidebar-section {
    border-bottom: 0;
}

.cf-sidebar-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.cf-sidebar-section-title {
    font-size: 14px;
    font-weight: 500;
    color: #222;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.cf-toggle-icon {
    transition: transform 0.25s ease;
    flex-shrink: 0;
    display: block;
    width: 14px;
    height: 14px;
    margin-left: auto;
    color: #222;
    opacity: 1;
}

.cf-toggle-icon polyline {
    stroke: currentColor;
}

.cf-sidebar-section-toggle.cf-open .cf-toggle-icon {
    transform: rotate(180deg);
}

/* Section Content */
.cf-sidebar-section-content {
    padding: 0 24px 8px;
    display: none;
}

.cf-sidebar-section-content.cf-section-open {
    display: block;
}

/* Checkbox */
.cf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.cf-checkbox-label:hover .cf-checkbox-text {
    color: #000;
}

.cf-filter-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cf-checkbox-custom {
    width: 19px;
    height: 19px;
    border: 1px solid #2d2d2d;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.cf-filter-checkbox:checked + .cf-checkbox-custom {
    background: #222;
    border-color: #222;
}

.cf-filter-checkbox:checked + .cf-checkbox-custom::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.cf-checkbox-text {
    font-size: 15px;
    font-weight: 400;
    color: #1f1f1f;
    transition: color 0.15s;
    line-height: 1.3;
}

.cf-checkbox-count {
    font-size: 12px;
    color: #999;
    margin-left: auto;
}

.cf-color-label {
    gap: 14px;
    padding: 11px 12px;
    border: 1px solid #a9a9a9;
    margin-bottom: 12px;
}

.cf-color-label:last-child {
    margin-bottom: 0;
}

.cf-color-swatch-wrap {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cf-color-swatch {
    width: 20px;
    height: 20px;
    display: block;
    border: 1px solid rgba(0, 0, 0, 0.14);
    background: #ddd;
}

.cf-color-label .cf-checkbox-text {
    font-size: 15px;
    font-weight: 400;
}

.cf-color-label .cf-filter-checkbox:checked ~ .cf-checkbox-text {
    font-weight: 600;
}

.cf-color-label:has(.cf-filter-checkbox:checked) {
    border-color: #111;
    box-shadow: inset 0 0 0 1px #111;
}

.cf-size-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding-top: 6px;
}

.cf-size-label {
    display: block;
    padding: 0;
}

.cf-size-box {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    border: 1px solid #8f8f8f;
    background: #fff;
    color: #111;
    font-size: 14px;
    line-height: 1;
    transition: all 0.15s ease;
}

.cf-size-label:hover .cf-size-box {
    border-color: #111;
}

.cf-size-label .cf-filter-checkbox:checked + .cf-size-box {
    border-color: #111;
    box-shadow: inset 0 0 0 1px #111;
}

/* Search Box (Brands) */
.cf-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0 10px;
    border: none;
    border-bottom: 1px solid #9f9f9f;
    margin: 8px 0 14px;
}

.cf-search-box svg {
    flex-shrink: 0;
}

.cf-search-input {
    border: none;
    outline: none;
    font-size: 15px;
    color: #333;
    width: 100%;
    font-family: inherit;
    background: transparent;
    padding: 0;
}

.cf-search-input::placeholder {
    color: #7d7d7d;
}

/* Scrollable List */
.cf-scrollable-list {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 6px;
}

.cf-scrollable-list::-webkit-scrollbar {
    width: 8px;
}

.cf-scrollable-list::-webkit-scrollbar-track {
    background: transparent;
}

.cf-scrollable-list::-webkit-scrollbar-thumb {
    background: #8e8e8e;
    border-radius: 8px;
}

.cf-letter-heading {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    padding: 10px 0 6px;
    border-bottom: 1px solid #eee;
    margin-bottom: 8px;
}

/* Sidebar Footer */
.cf-sidebar-footer {
    display: flex;
    justify-content: flex-end;
    padding: 18px 18px 16px;
    border-top: 0;
    flex-shrink: 0;
    background: #fff;
}

.cf-apply-filters {
    min-width: 188px;
    padding: 14px 18px;
    border: 1px solid #222;
    background: #222;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    text-align: center;
}

.cf-apply-filters:hover {
    background: #444;
}

/* ---- PRODUCTS CONTAINER ---- */
.cf-products-container {
    position: relative;
    min-height: 200px;
}

/* Loading */
.cf-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.cf-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #eee;
    border-top-color: #222;
    border-radius: 50%;
    animation: cf-spin 0.7s linear infinite;
}

@keyframes cf-spin {
    to { transform: rotate(360deg); }
}

/* Products Grid */
.cf-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 20px 0;
}

.cf-product-card {
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.cf-product-card:hover {
    transform: translateY(-2px);
}

.cf-product-image {
    position: relative;
    overflow: hidden;
    background: #f8f8f8;
    aspect-ratio: 3/4;
}

.cf-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.cf-product-card:hover .cf-product-image img {
    transform: scale(1.03);
}

.cf-product-info {
    padding: 12px 0;
}

.cf-product-title {
    font-size: 13px;
    font-weight: 400;
    margin: 0 0 6px;
    line-height: 1.4;
}

.cf-product-title a {
    color: #222;
    text-decoration: none;
}

.cf-product-title a:hover {
    text-decoration: underline;
}

.cf-product-price {
    font-size: 14px;
    font-weight: 600;
    color: #222;
}

.cf-product-price del {
    color: #999;
    font-weight: 400;
    margin-right: 6px;
}

.cf-product-price ins {
    text-decoration: none;
    color: #c0392b;
}

/* No Products */
.cf-no-products {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 15px;
}

/* Pagination */
.cf-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 30px 0 10px;
}

.cf-page-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.cf-page-btn:hover,
.cf-page-btn.cf-page-active {
    background: #222;
    color: #fff;
    border-color: #222;
}

.cf-filter-wrapper .cf-filter-btn,
.cf-filter-wrapper .cf-toolbar-brand,
.cf-filter-wrapper .cf-chip,
.cf-filter-wrapper .cf-sort-trigger,
.cf-filter-wrapper .cf-sort-menu,
.cf-filter-wrapper .cf-sort-option,
.cf-filter-wrapper .cf-color-label,
.cf-filter-wrapper .cf-size-box,
.cf-filter-wrapper .cf-page-btn,
.cf-filter-wrapper .cf-apply-filters {
    border-radius: 0;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
    .cf-products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .cf-archive-title {
        font-size: 24px;
    }

    .cf-top-bar-left {
        width: 100%;
    }

    .cf-brand-toolbar {
        flex: 1 1 100%;
        order: 3;
    }

    .cf-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .cf-top-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .cf-top-bar-right {
        width: 100%;
    }

    .cf-sort-select {
        width: 100%;
    }

    .cf-sidebar {
        width: 100% !important;
        max-width: 100vw;
    }
}

@media (max-width: 480px) {
    .cf-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .cf-product-title {
        font-size: 12px;
    }

    .cf-product-price {
        font-size: 13px;
    }
}

/* Fade in animation for products */
.cf-products-result {
    opacity: 1;
    transition: opacity 0.25s ease;
}

