/**
 * Taxonomy Filter Styles
 * Premium jewelry e-commerce design
 * 
 * @package IMTA Theme
 */

/* ========================================
   CSS Variables
======================================== */
:root {
    --imta-primary: #1a1a2e;
    --imta-secondary: #c9a227;
    --imta-gold: #d4af37;
    --imta-text: #333333;
    --imta-text-light: #666666;
    --imta-border: #e5e5e5;
    --imta-bg-light: #f8f8f8;
    --imta-white: #ffffff;
    --imta-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    --imta-transition: all 0.3s ease;
}

/* ========================================
   Main Layout
======================================== */
.imta-taxonomy-filter-page {
    background-color: var(--imta-white);
    padding: 20px 0 60px;
}

/* Ẩn title mặc định của WooCommerce (nằm ngoài container) */
.shop-page-title.category-page-title.page-title {
    display: none !important;
}

.imta-taxonomy-filter-page .container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* Breadcrumb */
.taxonomy-breadcrumb {
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--imta-text-light);
}

.taxonomy-breadcrumb a {
    color: var(--imta-text-light);
    text-decoration: none;
    transition: var(--imta-transition);
}

.taxonomy-breadcrumb a:hover {
    color: var(--imta-gold);
}

/* Header */
.taxonomy-header {
    margin-bottom: 30px;
    text-align: center;
}

.taxonomy-title {
    font-size: 32px;
    font-weight: 600;
    color: var(--imta-primary);
    margin: 0 0 10px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    text-transform: uppercase;
}

.taxonomy-title .title-line {
    flex: 0 0 80px;
    height: 2px;
    background: var(--imta-gold);
}

.taxonomy-description {
    color: var(--imta-text-light);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ========================================
   Gem Introduction Section (Gemstones)
======================================== */
.gem-intro-section {
    background: #f5f5f5;
    padding: 40px 20px;
    margin-bottom: 40px;
    text-align: center;
}

.gem-photo-wrapper {
    margin-bottom: 30px;
}

.gem-photo {
    max-width: 400px;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.gem-description-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

.gem-description {
    color: #555;
    font-size: 15px;
    line-height: 1.8;
    text-align: center;
    max-height: 150px;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.gem-description.expanded {
    max-height: 2000px;
}

.gem-description p {
    margin: 0 0 15px;
}

.show-more-btn {
    margin-top: 20px;
    padding: 10px 30px;
    background: transparent;
    border: 1px solid #333;
    color: #333;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.show-more-btn:hover {
    background: #333;
    color: #fff;
}

/* Content Wrapper - Flexbox Layout */
.taxonomy-content-wrapper {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}


/* ========================================
   Sidebar Filter
======================================== */
.taxonomy-sidebar {
    width: 350px;
    min-width: 350px;
    background: var(--imta-white);
    border: 1px solid var(--imta-border);
    border-radius: 8px;
    position: sticky;
    top: 120px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--imta-border);
    background: var(--imta-bg-light);
    border-radius: 8px 8px 0 0;
}

.filter-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--imta-primary);
    margin: 0;
}

.clear-all-filters {
    background: none;
    border: none;
    color: var(--imta-gold);
    font-size: 11px;
    cursor: pointer;
    transition: var(--imta-transition);
    text-decoration: underline;
    white-space: nowrap;
    flex-shrink: 0;
}

.clear-all-filters:hover {
    color: var(--imta-primary);
}

/* Filter Groups */
.filter-group {
    border-bottom: 1px solid var(--imta-border);
}

.filter-group:last-child {
    border-bottom: none;
}

.filter-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: var(--imta-transition);
}

.filter-group-header:hover {
    background: var(--imta-bg-light);
}

.filter-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--imta-primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.filter-group.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.filter-group-content {
    padding: 0 20px 15px;
}

.filter-group.collapsed .filter-group-content {
    display: none;
}

/* Filter Options List */
.filter-options-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.filter-option {
    margin-bottom: 10px;
}

.filter-option:last-child {
    margin-bottom: 0;
}

/* Custom Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--imta-text);
    transition: var(--imta-transition);
    font-weight: 500;
}

.checkbox-label:hover {
    color: var(--imta-gold);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 1px solid #8b8b8b;
    border-radius: 4px;
    position: relative;
    transition: var(--imta-transition);
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked+.checkbox-custom {
    background: var(--imta-gold);
    border-color: var(--imta-gold);
}

.checkbox-label input[type="checkbox"]:checked+.checkbox-custom::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.option-text {
    flex: 1;
}

.term-count {
    color: var(--imta-text-light);
    font-size: 12px;
}

/* Collection Tree */
.collection-tree .parent-term.has-children>.term-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.expand-btn {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.expand-btn[data-expanded="true"] {
    transform: rotate(90deg);
}

.children-terms {
    display: none;
    padding-left: 25px;
    margin-top: 10px;
}

.expand-btn[data-expanded="true"]+.checkbox-label+.children-terms,
.parent-term.expanded .children-terms {
    display: block;
}

/* Price Range Slider */
.price-range-slider {
    padding: 10px 0;
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.price-input-group {
    flex: 1;
    position: relative;
}

.price-input-group label {
    display: block;
    font-size: 11px;
    color: var(--imta-text-light);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.price-input-group input {
    width: 100%;
    padding: 8px 30px 8px 10px;
    border: 1px solid var(--imta-border);
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    transition: var(--imta-transition);
}

.price-input-group input:focus {
    border-color: var(--imta-gold);
}

.price-input-group .currency {
    position: absolute;
    right: 10px;
    bottom: 10px;
    color: var(--imta-text-light);
    font-size: 12px;
}

.price-separator {
    color: var(--imta-text-light);
    padding-top: 20px;
}

/* Range Slider */
.range-slider-container {
    padding: 0 5px;
}

.range-slider {
    position: relative;
    height: 30px;
}

.range-track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 4px;
    background: var(--imta-border);
    border-radius: 2px;
}

.range-selected {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 4px;
    background: var(--imta-gold);
    border-radius: 2px;
}

.range-input {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--imta-white);
    border: 2px solid var(--imta-gold);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: var(--imta-transition);
}

.range-input::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--imta-white);
    border: 2px solid var(--imta-gold);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Diamond-only filter groups */
.filter-group.diamond-only {
    background: linear-gradient(135deg, #fefefe 0%, #f5f5f5 100%);
}

.filter-group.diamond-only .filter-group-title::before {
    content: '💎 ';
}

/* ========================================
   Main Content Area
======================================== */
.taxonomy-main-content {
    flex: 1;
    min-width: 0;
}

/* Toolbar */
.taxonomy-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--imta-bg-light);
    border-radius: 8px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.toolbar-left .result-count {
    font-size: 14px;
    color: var(--imta-text-light);
}

.toolbar-left .result-count strong {
    color: var(--imta-primary);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: var(--imta-white);
    border-radius: 4px;
    border: 1px solid var(--imta-border);
}

.view-btn {
    padding: 4px 6px;
    background: transparent;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    color: var(--imta-text-light);
    transition: var(--imta-transition);
}

.view-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}

.view-btn:hover,
.view-btn.active {
    background: var(--imta-gold);
    color: var(--imta-white);
}

/* Sort Dropdown */
.sort-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-dropdown label {
    font-size: 14px;
    color: var(--imta-text-light);
    white-space: nowrap;
}

.sort-select {
    padding: 5px 35px 10px 15px;
    border: 1px solid var(--imta-border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--imta-text);
    background: var(--imta-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 12px center;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    min-width: 180px;
    margin-bottom: 0px;
}

.sort-select:focus {
    border-color: var(--imta-gold);
}

/* Products Wrapper */
.products-wrapper {
    position: relative;
    min-height: 400px;
}

/* Custom Products Grid - Override any WooCommerce/Flatsome defaults */
.products-grid .imta-products-list {
    display: grid !important;
    gap: 25px !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    list-style: none !important;
}

.products-grid.grid-5 .imta-products-list {
    grid-template-columns: repeat(5, 1fr) !important;
}

.products-grid.grid-4 .imta-products-list {
    grid-template-columns: repeat(4, 1fr) !important;
}

.products-grid.grid-3 .imta-products-list {
    grid-template-columns: repeat(3, 1fr) !important;
}

.products-grid.list .imta-products-list {
    grid-template-columns: 1fr !important;
}


/* Product items */
.products-grid .imta-products-list>li {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Product Cards - Override WooCommerce defaults */
.products-grid .product {
    background: var(--imta-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--imta-shadow);
    transition: var(--imta-transition);
    position: relative;
    padding-bottom: 0px;
}

.products-grid .product:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.products-grid .product .woocommerce-loop-product__link {
    display: block;
    text-decoration: none;
}

.products-grid .product .attachment-woocommerce_thumbnail {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
}

.products-grid .product .woocommerce-loop-product__title {
    font-size: 14px;
    font-weight: 500;
    color: var(--imta-text);
    margin: 15px 15px 8px;
    line-height: 1.4;
    text-align: center;
}

.products-grid .product .price {
    text-align: center;
    padding: 0 15px 15px;
    font-size: 15px;
    color: var(--imta-gold);
    font-weight: 600;
}

.products-grid .product .price del {
    color: var(--imta-text-light);
    font-size: 13px;
    font-weight: 400;
}

/* Wishlist Button */
.products-grid .product .yith-wcwl-add-to-wishlist {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}

.products-grid .product .yith-wcwl-add-to-wishlist a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: var(--imta-white);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: var(--imta-transition);
}

.products-grid .product .yith-wcwl-add-to-wishlist a:hover {
    background: var(--imta-gold);
    color: var(--imta-white);
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 45px;
    height: 45px;
    border: 3px solid var(--imta-border);
    border-top-color: var(--imta-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* No Products Found */
.no-products-found {
    text-align: center;
    padding: 60px 20px;
    color: #000;
}

/* Pagination */
.taxonomy-pagination {
    margin-top: 40px;
    display: flex;
    justify-content: center;
}

.taxonomy-pagination .page-numbers {
    list-style: none;
    display: flex;
    gap: 8px;
    padding: 0;
    margin: 0;
}

.taxonomy-pagination .page-numbers li {
    margin: 0;
}

.taxonomy-pagination .page-numbers a,
.taxonomy-pagination .page-numbers span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--imta-border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--imta-text);
    text-decoration: none;
    transition: var(--imta-transition);
}

.taxonomy-pagination .page-numbers a:hover,
.taxonomy-pagination .page-numbers span.current {
    background: var(--imta-gold);
    border-color: var(--imta-gold);
    color: var(--imta-white);
}

/* ========================================
   Mobile Filter
======================================== */
.mobile-filter-toggle {
    display: none;
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    padding: 14px 28px;
    background: var(--imta-primary);
    color: var(--imta-white);
    border: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    gap: 8px;
    align-items: center;
    transition: var(--imta-transition);
}

.mobile-filter-toggle:hover {
    background: var(--imta-gold);
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.mobile-overlay.active {
    display: block;
}

.filter-actions.mobile-only {
    display: none;
    padding: 20px;
    border-top: 1px solid var(--imta-border);
}

.apply-filter-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--imta-gold);
    color: var(--imta-white);
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--imta-transition);
}

.apply-filter-btn:hover {
    background: var(--imta-primary);
}

/* ========================================
   Responsive Design
======================================== */
@media (max-width: 1400px) {
    .products-grid.grid-5 .imta-products-list {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (max-width: 1200px) {

    .products-grid.grid-5 .imta-products-list,
    .products-grid.grid-4 .imta-products-list {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .taxonomy-sidebar {
        width: 260px;
        min-width: 260px;
    }
}

@media (max-width: 992px) {
    .taxonomy-content-wrapper {
        gap: 25px;
    }

    .products-grid.grid-5 .imta-products-list,
    .products-grid.grid-4 .imta-products-list,
    .products-grid.grid-3 .imta-products-list {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .taxonomy-sidebar {
        width: 240px;
        min-width: 240px;
    }
}

@media (max-width: 768px) {
    .taxonomy-content-wrapper {
        flex-direction: column;
    }

    .taxonomy-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 350px;
        height: 100vh;
        max-height: 100vh;
        z-index: 1000;
        border-radius: 0;
        transition: left 0.3s ease;
    }

    .taxonomy-sidebar.active {
        left: 0;
    }

    .mobile-filter-toggle {
        display: flex;
    }

    .filter-actions.mobile-only {
        display: block;
    }

    .taxonomy-main-content {
        width: 100%;
    }

    .taxonomy-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-right {
        justify-content: space-between;
    }

    .sort-select {
        min-width: 150px;
    }

    .taxonomy-title {
        font-size: 26px;
    }
}

@media (max-width: 576px) {

    .products-grid.grid-4,
    .products-grid.grid-3,
    .products-grid.grid-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .products-grid .product .woocommerce-loop-product__title {
        font-size: 13px;
        margin: 10px 10px 5px;
    }

    .products-grid .product .price {
        font-size: 14px;
        padding: 0 10px 12px;
    }

    .view-toggle {
        display: none;
    }

    .taxonomy-pagination .page-numbers a,
    .taxonomy-pagination .page-numbers span {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
}

/* ========================================
   Scrollbar Styling
======================================== */
.taxonomy-sidebar::-webkit-scrollbar,
.filter-group-content::-webkit-scrollbar {
    width: 5px;
}

.taxonomy-sidebar::-webkit-scrollbar-track,
.filter-group-content::-webkit-scrollbar-track {
    background: var(--imta-bg-light);
}

.taxonomy-sidebar::-webkit-scrollbar-thumb,
.filter-group-content::-webkit-scrollbar-thumb {
    background: var(--imta-border);
    border-radius: 3px;
}

.taxonomy-sidebar::-webkit-scrollbar-thumb:hover,
.filter-group-content::-webkit-scrollbar-thumb:hover {
    background: var(--imta-gold);
}