/* WooCommerce Taxonomy Filter Widget Styles */

.wc-tax-filter {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Header */
.wc-tax-filter__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.wc-tax-filter__header-title {
    font-size: 20px;
    line-height: 1.25;
    color: #3B3B33;
    font-weight: 500;
    margin: 0;
}

.wc-tax-filter__reset {
    color: #4D98E1;
    font-size: 14px;
    line-height: 1.78;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.wc-tax-filter__reset:hover {
    opacity: 0.8;
}

/* Form */
.wc-tax-filter__form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Filter Group */
.wc-tax-filter__group {
    background-color: #F8FAFC;
    border-radius: 16px;
    padding: 32px;
    border: none !important;
    outline: none !important;
}

.wc-tax-filter__group-toggle {
    width: 100% !important;
    min-width: 100%;
    display: flex !important;
    flex-direction: row;
    align-items: center !important;
    justify-content: space-between;
    gap: 12px;
    position: relative;
    background: none;
    border: none !important;
    outline: none !important;
    cursor: pointer;
    padding: 0 34px 0 0;
    margin: 0;
    color: currentColor;
    text-align: left;
    box-shadow: none !important;
    min-height: 24px;
}

.wc-tax-filter__group-toggle:hover,
.wc-tax-filter__group-toggle:focus,
.wc-tax-filter__group-toggle:active {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
    background: none !important;
}

.wc-tax-filter__group-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex: 1 1 0;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.wc-tax-filter__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    flex-grow: 0;
}

.wc-tax-filter__group-title {
    font-size: 16px;
    line-height: 1.25;
    font-weight: 500;
    color: #3B3B33;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wc-tax-filter__chevron {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
    position: absolute;
    right: 0;
    top: 50%;
    margin-left: 0;
    transform: translateY(-50%);
    pointer-events: none;
}

.wc-tax-filter__group.is-expanded .wc-tax-filter__chevron {
    transform: translateY(-50%) rotate(180deg);
}

/* Group Content */
.wc-tax-filter__group-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease, visibility 0s linear 0.4s;
}

.wc-tax-filter__group-content.is-expanded {
    max-height: 3000px;
    opacity: 1;
    visibility: visible;
    padding-top: 20px;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease, visibility 0s linear 0s;
}

.wc-tax-filter__items {
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;
}

.wc-tax-filter__items::-webkit-scrollbar {
    width: 6px;
}

.wc-tax-filter__items::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.wc-tax-filter__items::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.wc-tax-filter__items::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Filter Item */
.wc-tax-filter__item {
    display: flex !important;
    align-items: center;
    gap: 10px;
    color: #3B3B33;
    font-size: 16px;
    line-height: 1.25;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 1;
    visibility: visible;
    max-height: 100px;
    overflow: hidden;
}

.wc-tax-filter__item:last-child:not(.wc-tax-filter__item--hidden) {
    margin-bottom: 0;
}

.wc-tax-filter__item:hover {
    opacity: 0.8;
}

.wc-tax-filter__item--hidden {
    max-height: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    pointer-events: none !important;
}

.wc-tax-filter__item.show-all .wc-tax-filter__item--hidden {
    display: flex;
}

/* Checkbox */
.wc-tax-filter__checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #D1D5DB;
    border-radius: 4px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
}

.wc-tax-filter__checkbox:hover {
    border-color: #4D98E1;
}

.wc-tax-filter__checkbox:checked {
    background-color: #4D98E1;
    border-color: #4D98E1;
}

.wc-tax-filter__checkbox:checked::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    top: 2px;
    left: 5px;
}

/* Label */
.wc-tax-filter__label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
}

.wc-tax-filter__count {
    color: #6B7280;
    margin-left: 5px;
}

/* Show More Button */
.wc-tax-filter__show-more {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    padding: 12px;
    margin-top: 20px;
    border-radius: 12px;
    background-color: rgba(77, 152, 225, 0.1);
    color: #4D98E1;
    font-weight: 500;
    font-size: 15px;
    line-height: 1.47;
    border: none !important;
    outline: none !important;
    cursor: pointer;
    transition: background-color 0.2s ease;
    box-shadow: none !important;
    text-align: center;
}

.wc-tax-filter__show-more:hover {
    background-color: rgba(77, 152, 225, 0.15);
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.wc-tax-filter__show-more:focus,
.wc-tax-filter__show-more:active {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.wc-tax-filter__show-less-text {
    display: none;
}

.wc-tax-filter__show-more.is-expanded .wc-tax-filter__show-more-text {
    display: none;
}

.wc-tax-filter__show-more.is-expanded .wc-tax-filter__show-less-text {
    display: inline;
}

/* Submit Button (hidden by default, form auto-submits) */
.wc-tax-filter__submit {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px 32px;
    background-color: #4D98E1;
    color: white;
    border: none !important;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 24px;
    outline: none !important;
    box-shadow: none !important;
}

.wc-tax-filter__submit:hover,
.wc-tax-filter__submit:focus,
.wc-tax-filter__submit:active {
    background-color: #3d7ec4;
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

/* Bouton sticky - reste dans la colonne du widget */
.wc-tax-filter__submit--sticky {
    position: sticky;
    bottom: 0;
    width: 100% !important;
    max-width: 100% !important;
    margin: 24px 0 0 0;
    border-radius: 8px;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

/* Conteneur pour gérer l'espace sticky */
.wc-tax-filter {
    position: relative;
}

/* Sur mobile, ajuster pour les barres de navigation */
@media (max-width: 768px) {
    .wc-tax-filter__submit--sticky {
        padding: 18px 24px;
        font-size: 16px;
    }
}

/* ========================================
   Widget: Compteur de produits
   ======================================== */

.wc-filter-count {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.wc-filter-count__icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-filter-count__number {
    font-weight: 600;
}

.wc-filter-count__text {
    font-weight: 400;
}

/* ========================================
   Widget: Filtres actifs
   ======================================== */

.wc-active-filters {
    margin: 20px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.wc-active-filters__title {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 600;
}

.wc-active-filters__items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.wc-active-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
}

.wc-active-filter__label {
    display: flex;
    align-items: center;
    gap: 4px;
}

.wc-active-filter__remove {
    display: flex;
    align-items: center;
    color: #999;
    transition: color 0.2s;
    text-decoration: none;
}

.wc-active-filter__remove:hover {
    color: #e74c3c;
}

.wc-active-filters__clear {
    display: inline-block;
    color: #4D98E1;
    font-size: 14px;
    text-decoration: underline;
    margin-top: 10px;
}

.wc-active-filters__clear:hover {
    color: #3d7ec4;
}

/* Responsive */
@media (max-width: 1024px) {
    .wc-tax-filter__group {
        padding: 24px;
    }

    .wc-tax-filter__header-title {
        font-size: 18px;
    }

    .wc-tax-filter__group-title {
        font-size: 15px;
    }

    .wc-tax-filter__item {
        font-size: 15px;
    }
}

@media (max-width: 768px) {
    .wc-tax-filter__group {
        padding: 20px;
    }

    .wc-tax-filter__items {
        max-height: 300px;
    }
}

/* Animation for smooth transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wc-tax-filter__item {
    animation: fadeIn 0.2s ease;
}
