/* =========================================================
   05-SIDEBAR.CSS
   SIDEBAR, WIDGET VÀ BỘ LỌC SẢN PHẨM
   Không khai báo font-family tại file này.
   Font-size sử dụng biến từ 01-typography.css.
   ========================================================= */

/* =========================================================
   1. BIẾN DÙNG RIÊNG CHO SIDEBAR
   ========================================================= */

:root {
    --sidebar-wine: var(--srnk-color-primary, #7b1128);
    --sidebar-wine-dark: var(--srnk-color-primary-dark, #570b1c);
    --sidebar-gold: var(--srnk-color-secondary, #c9a34e);
    --sidebar-text: var(--text, #333);
    --sidebar-muted: #777;
    --sidebar-border: var(--border, #eadfe1);
    --sidebar-soft: #faf7f7;
    --sidebar-line: #f1e9eb;
}

/* =========================================================
   2. KHUNG SIDEBAR VÀ WIDGET
   ========================================================= */

.shop-sidebar {
    padding-right: 15px;
    color: var(--sidebar-text);
    font-size: var(--srnk-fs-13px, 13px);
}

:is(.shop-sidebar, #shop-sidebar, .widget-area) .widget,
.widget_product_categories,
.widget_price_filter {
    position: relative;
    margin: 0 0 16px !important;
    padding: 16px !important;
    background: #fff;
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(76, 15, 31, 0.06);
}

:is(.shop-sidebar, #shop-sidebar, .widget-area) .widget::before,
.widget_product_categories::before,
.widget_price_filter::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 16px;
    width: 42px;
    height: 3px;
    background: linear-gradient(
        90deg,
        var(--sidebar-wine),
        var(--sidebar-gold)
    );
    border-radius: 0 0 3px 3px;
}

/* =========================================================
   3. TIÊU ĐỀ WIDGET VÀ TIÊU ĐỀ BỘ LỌC
   ========================================================= */

:is(.shop-sidebar, #shop-sidebar, .widget-area)
:is(.widget-title, .widgettitle) {
    display: block;
    margin: 0 0 14px !important;
    padding: 0 0 10px !important;
    color: var(--sidebar-wine) !important;
    font-size: var(--srnk-fs-14px, 14px) !important;
    font-weight: 700 !important;
    line-height: 1.35;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--sidebar-border);
}

:is(.shop-sidebar, #shop-sidebar, .widget-area)
:is(.wpc-filter-header, .wpc-filter-title),
.fe-filter-title,
.filter-title {
    margin: 0 !important;
    padding: 12px 24px 12px 0 !important;
    color: var(--sidebar-wine-dark) !important;
    font-size: var(--srnk-fs-13px, 13px) !important;
    font-weight: 700 !important;
    line-height: 1.35;
    letter-spacing: 0.25px;
    text-transform: uppercase;
}

/* Giữ mũi tên mặc định của Filter Everything rõ hơn */
:is(.shop-sidebar, #shop-sidebar, .widget-area)
:is(.wpc-filter-header, .wpc-filter-title)
button {
    color: var(--sidebar-wine) !important;
}

/* Bỏ divider mặc định trùng lặp */
:is(.shop-sidebar, #shop-sidebar, .widget-area) .is-divider,
.shop-sidebar .widget-title + .divider,
.shop-sidebar .widget-title + .is-divider,
.fe-filter-title::after,
.fe-widget-title::after,
.filter-title::after,
.widget-title::after {
    display: none !important;
    content: none !important;
}

/* =========================================================
   4. BỘ LỌC FILTER EVERYTHING
   ========================================================= */

.shop-sidebar .wpc-filter {
    margin: 0;
    padding: 14px 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--sidebar-border);
    box-shadow: none;
}

.shop-sidebar .wpc-filter:last-child {
    border-bottom: 0;
}

:is(.shop-sidebar, #shop-sidebar, .widget-area) .wpc-filter-content {
    width: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-wine) #f0e7e9;
}

:is(.shop-sidebar, #shop-sidebar, .widget-area)
.wpc-filter-content::-webkit-scrollbar {
    width: 5px;
}

:is(.shop-sidebar, #shop-sidebar, .widget-area)
.wpc-filter-content::-webkit-scrollbar-track {
    background: #f0e7e9;
    border-radius: 10px;
}

:is(.shop-sidebar, #shop-sidebar, .widget-area)
.wpc-filter-content::-webkit-scrollbar-thumb {
    background: var(--sidebar-wine);
    border-radius: 10px;
}

/* =========================================================
   5. DANH SÁCH DANH MỤC VÀ THUỘC TÍNH
   ========================================================= */

:is(.shop-sidebar, #shop-sidebar, .widget-area) ul {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

:is(.shop-sidebar, #shop-sidebar, .widget-area)
.wpc-filters-ul-list {
    margin: 0 !important;
    padding: 0 !important;
}

:is(.shop-sidebar, #shop-sidebar, .widget-area)
.wpc-filters-ul-list > li {
    display: flex !important;
    align-items: center !important;
    min-height: 36px !important;
    margin: 0 !important;
    padding: 0 2px !important;
    background: transparent !important;
    border-bottom: 1px solid #eee4e6 !important;
    transition:
        color 0.2s ease,
        background-color 0.2s ease;
}

:is(.shop-sidebar, #shop-sidebar, .widget-area)
.wpc-filters-ul-list > li:last-child {
    border-bottom: 0 !important;
}

:is(.shop-sidebar, #shop-sidebar, .widget-area)
.wpc-filters-ul-list > li:hover {
    background: rgba(123, 17, 40, 0.05) !important;
}

:is(.shop-sidebar, #shop-sidebar, .widget-area)
.wpc-filters-ul-list label {
    display: flex !important;
    align-items: center !important;
    flex: 1;
    min-width: 0;
    min-height: 36px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #555 !important;
    font-size: var(--srnk-fs-14px, 14px) !important;
    font-weight: 400 !important;
    line-height: 1.35 !important;
    cursor: pointer;
}

:is(.shop-sidebar, #shop-sidebar, .widget-area)
.wpc-filters-ul-list > li:hover label,
.wpc-term-item.wpc-term-selected label,
.wpc-term-item input[type="checkbox"]:checked + label {
    color: var(--sidebar-wine) !important;
}

.wpc-term-item.wpc-term-selected label,
.wpc-term-item input[type="checkbox"]:checked + label {
    font-weight: 600 !important;
}

/* Danh mục WooCommerce */
.product-categories li,
.widget_product_categories li {
    margin: 0 !important;
    padding: 0 !important;
    border-bottom: 1px solid var(--sidebar-line);
}

.product-categories li:last-child,
.widget_product_categories li:last-child {
    border-bottom: 0;
}

.product-categories li > a,
.widget_product_categories li > a {
    display: block;
    padding: 9px 8px !important;
    color: #4a4a4a !important;
    font-size: var(--srnk-fs-14px, 14px);
    font-weight: 500;
    line-height: 1.4;
    border-radius: 4px;
    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        padding-left 0.2s ease;
}

.product-categories li > a:hover,
.widget_product_categories li > a:hover {
    color: var(--sidebar-wine) !important;
    padding-left: 13px !important;
    background: rgba(123, 17, 40, 0.055);
}

.product-categories
:is(.current-cat, .current-cat-parent) > a,
.widget_product_categories
:is(.current-cat, .current-cat-parent) > a {
    color: var(--sidebar-wine) !important;
    font-weight: 700 !important;
}

.product-categories .children,
.widget_product_categories .children {
    margin: 0 0 6px 10px !important;
    padding-left: 8px !important;
    border-left: 2px solid rgba(201, 163, 78, 0.55);
}

/* =========================================================
   6. CHECKBOX
   ========================================================= */

:is(.shop-sidebar, #shop-sidebar, .widget-area)
input[type="checkbox"],
.wpc-filters-widget-main-wrapper input[type="checkbox"] {
    flex: 0 0 15px;
    width: 15px !important;
    height: 15px !important;
    margin: 0 9px 0 0 !important;
    accent-color: var(--sidebar-wine) !important;
    cursor: pointer;
}

/* =========================================================
   7. Ô TÌM KIẾM TRONG BỘ LỌC
   ========================================================= */

:is(.shop-sidebar, #shop-sidebar, .widget-area)
:is(input[type="search"], .wpc-search-field),
.fe-search input,
.filter-search input {
    width: 100% !important;
    height: 38px !important;
    margin: 8px 0 10px !important;
    padding: 0 12px !important;
    color: var(--sidebar-text) !important;
    font-size: var(--srnk-fs-13px, 13px);
    background: #fff !important;
    border: 1px solid #d8c8cd !important;
    border-radius: 5px !important;
    box-shadow: none !important;
    outline: none !important;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

:is(.shop-sidebar, #shop-sidebar, .widget-area)
:is(input[type="search"], .wpc-search-field):focus {
    border-color: var(--sidebar-wine) !important;
    box-shadow: 0 0 0 3px rgba(123, 17, 40, 0.08) !important;
}

/* =========================================================
   8. LOGO THƯƠNG HIỆU
   ========================================================= */

:is(.shop-sidebar, #shop-sidebar, .widget-area)
.wpc-term-image-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 48px;
    width: 48px;
    height: 30px;
    margin-right: 8px;
    background: #fff;
    border: 1px solid #eee5e8;
    border-radius: 4px;
}

:is(.shop-sidebar, #shop-sidebar, .widget-area)
.wpc-term-image-wrapper img {
    display: block;
    max-width: 40px !important;
    max-height: 24px !important;
    object-fit: contain;
}

/* =========================================================
   9. LỌC THEO GIÁ
   ========================================================= */

.widget_price_filter .price_slider_wrapper {
    padding-top: 8px;
}

.widget_price_filter .price_slider,
.price_slider_wrapper .price_slider,
.woocommerce .widget_price_filter .ui-slider {
    display: block !important;
    position: relative !important;
    height: 5px !important;
    margin: 14px 8px 20px !important;
    background: #eadfe1 !important;
    border-radius: 999px !important;
}

.widget_price_filter .ui-slider-range,
.price_slider_wrapper .ui-slider-range,
.woocommerce .widget_price_filter .ui-slider .ui-slider-range {
    display: block !important;
    height: 100% !important;
    background: var(--sidebar-wine) !important;
    border-radius: 999px !important;
}

.widget_price_filter .ui-slider-handle,
.price_slider_wrapper .ui-slider-handle,
.woocommerce .widget_price_filter .ui-slider .ui-slider-handle {
    display: block !important;
    position: absolute !important;
    top: 50% !important;
    width: 16px !important;
    height: 16px !important;
    margin-top: -8px !important;
    margin-left: -8px !important;
    background: var(--sidebar-gold) !important;
    border: 2px solid #fff !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
    cursor: ew-resize !important;
    z-index: 3 !important;
}

.widget_price_filter .ui-slider-handle:hover,
.widget_price_filter .ui-slider-handle:focus,
.price_slider_wrapper .ui-slider-handle:hover,
.price_slider_wrapper .ui-slider-handle:focus {
    background: var(--sidebar-wine) !important;
    outline: none !important;
}

.widget_price_filter .price_slider_amount,
.price_slider_wrapper .price_slider_amount,
.woocommerce .widget_price_filter .price_slider_amount {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
}

.widget_price_filter .price_slider_amount .button,
.price_slider_wrapper .price_slider_amount .button,
.woocommerce .widget_price_filter .price_slider_amount button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 58px;
    height: 36px;
    margin: 0 !important;
    padding: 0 14px !important;
    color: #fff !important;
    font-size: var(--srnk-fs-12px, 12px) !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    text-transform: uppercase;
    background: var(--sidebar-wine) !important;
    border: 1px solid var(--sidebar-wine) !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.widget_price_filter .price_slider_amount .button:hover,
.price_slider_wrapper .price_slider_amount .button:hover,
.woocommerce .widget_price_filter .price_slider_amount button:hover {
    background: var(--sidebar-wine-dark) !important;
    border-color: var(--sidebar-wine-dark) !important;
    transform: translateY(-1px);
}

.widget_price_filter .price_label,
.price_slider_wrapper .price_label,
.woocommerce .widget_price_filter .price_label {
    float: none !important;
    flex: 1 1 auto;
    width: auto !important;
    margin: 0 !important;
    color: #555 !important;
    font-size: var(--srnk-fs-13px, 13px) !important;
    font-weight: 500;
    line-height: 1.4;
    text-align: right !important;
}

.widget_price_filter .price_label :is(.from, .to),
.price_slider_wrapper .price_label :is(.from, .to) {
    color: var(--sidebar-wine) !important;
    font-weight: 700 !important;
}

/* =========================================================
   10. NÚT RESET, XEM THÊM VÀ LINK QUẢN TRỊ
   ========================================================= */

.wpc-filters-reset-button,
.fe-reset-button,
.reset-filters {
    width: 100%;
    margin-top: 14px;
    padding: 9px 12px;
    color: var(--sidebar-wine) !important;
    font-size: var(--srnk-fs-11px, 11px);
    font-weight: 600;
    text-transform: uppercase;
    background: #fff;
    border: 1px solid var(--sidebar-wine) !important;
    border-radius: 4px;
}

.wpc-filters-reset-button:hover,
.fe-reset-button:hover,
.reset-filters:hover {
    color: #fff !important;
    background: var(--sidebar-wine) !important;
}

/* Ẩn Xem thêm / Thu gọn */
.wpc-see-more-control,
.wpc-show-more-control,
.wpc-see-more,
.wpc-show-more,
.wpc-filter-show-more,
.wpc-filter-show-less,
.wpc-toggle-more,
.wpc-toggle-less {
    display: none !important;
}

/* Ẩn Edit Filter Set */
a[href*="filter-set"],
a[href*="edit-filter"],
.wpc-edit-filter-set,
.wpc-edit-filter {
    display: none !important;
}

/* =========================================================
   11. SỐ LƯỢNG SẢN PHẨM TÌM THẤY
   ========================================================= */

.wpc-found-posts,
.wpc-posts-found,
.wpc-filter-found-posts {
    display: block;
    margin: 4px 0 12px !important;
    padding: 9px 12px !important;
    color: #555 !important;
    font-size: var(--srnk-fs-13px, 13px) !important;
    font-weight: 500 !important;
    line-height: 1.4;
    background: var(--sidebar-soft) !important;
    border-left: 3px solid var(--sidebar-wine);
    border-radius: 3px;
}

/* =========================================================
   12. MOBILE
   ========================================================= */

@media screen and (max-width: 849px) {
    .shop-sidebar {
        padding-right: 0;
    }

    :is(.shop-sidebar, #shop-sidebar, .widget-area) .widget,
    .widget_product_categories,
    .widget_price_filter {
        padding: 14px !important;
        border-radius: 6px;
    }

    :is(.shop-sidebar, #shop-sidebar, .widget-area)
    :is(.widget-title, .widgettitle) {
        font-size: var(--srnk-fs-13px, 13px) !important;
    }

    :is(.shop-sidebar, #shop-sidebar, .widget-area)
    .wpc-filters-ul-list > li,
    :is(.shop-sidebar, #shop-sidebar, .widget-area)
    .wpc-filters-ul-list label {
        min-height: 40px !important;
    }
}
