/**
 * Jet Smart Filters - Checkbox Dropdown
 * Transforme les filtres checkboxes en dropdown avec liste de checkboxes
 */

/* Container principal */
.jsf-checkbox-dropdown-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 15px;
}

/* Bouton dropdown */
.jsf-checkbox-dropdown-button {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 10px 15px !important;
    background: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    color: #333 !important;
    transition: all 0.3s ease !important;
}

.jsf-checkbox-dropdown-button:hover {
    border-color: #0073aa !important;
    box-shadow: 0 0 0 1px rgba(0, 115, 170, 0.1) !important;
}

. jsf-checkbox-dropdown-button. active {
    border-color: #0073aa !important;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Texte du bouton */
.jsf-dropdown-button-text {
    flex: 1;
    text-align: left;
    color: #666;
}

. jsf-dropdown-button-text. has-selection {
    color: #333;
    font-weight: 500;
}

/* Icône du dropdown */
.jsf-dropdown-icon {
    margin-left: 10px;
    transition: transform 0.3s ease;
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #666;
}

.jsf-checkbox-dropdown-button. active .jsf-dropdown-icon {
    transform: rotate(180deg);
}

/* Panel dropdown */
.jsf-checkbox-dropdown-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #0073aa;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.jsf-checkbox-dropdown-panel.active {
    max-height: 400px;
    opacity: 1;
    overflow-y: auto;
}

/* Barre de recherche */
.jsf-dropdown-search {
    padding: 10px;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
}

.jsf-dropdown-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    outline: none;
}

.jsf-dropdown-search input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px rgba(0, 115, 170, 0.1);
}

/* Actions rapides */
.jsf-dropdown-actions {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
    display: flex;
    gap: 10px;
}

.jsf-dropdown-action-btn {
    padding: 4px 8px;
    font-size: 12px;
    color: #0073aa;
    background: transparent;
    border: 1px solid #0073aa;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.jsf-dropdown-action-btn:hover {
    background: #0073aa;
    color: #fff;
}

/* Liste des checkboxes */
.jsf-dropdown-checkboxes {
    padding: 5px 0;
    max-height: 300px;
    overflow-y: auto;
}

.jsf-dropdown-checkboxes .jet-checkboxes-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.jsf-dropdown-checkboxes . jet-checkboxes-list__item {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #f5f5f5;
}

.jsf-dropdown-checkboxes .jet-checkboxes-list__item:last-child {
    border-bottom: none;
}

.jsf-dropdown-checkboxes .jet-checkboxes-list__button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 15px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
    text-align: left;
}

.jsf-dropdown-checkboxes .jet-checkboxes-list__button:hover {
    background: #f5f5f5;
}

/* Checkbox personnalisé */
.jsf-dropdown-checkboxes .jet-checkboxes-list__decorator {
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 3px;
    margin-right: 10px;
    position: relative;
    transition: all 0.2s ease;
}

.jsf-dropdown-checkboxes .jet-checkboxes-list__button. checked . jet-checkboxes-list__decorator {
    background: #0073aa;
    border-color: #0073aa;
}

.jsf-dropdown-checkboxes .jet-checkboxes-list__button. checked . jet-checkboxes-list__decorator::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

/* Label */
.jsf-dropdown-checkboxes .jet-checkboxes-list__label {
    flex: 1;
    color: #333;
    font-size: 14px;
}

/* Count badge */
.jsf-dropdown-checkboxes .jet-checkboxes-list__count {
    background: #f0f0f0;
    color: #666;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    margin-left: 8px;
}

. jsf-dropdown-checkboxes .jet-checkboxes-list__button. checked .jet-checkboxes-list__count {
    background: #0073aa;
    color: #fff;
}

/* Message "Aucun résultat" */
.jsf-no-results {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* Scrollbar personnalisé */
.jsf-dropdown-checkboxes::-webkit-scrollbar {
    width: 8px;
}

.jsf-dropdown-checkboxes::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.jsf-dropdown-checkboxes::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.jsf-dropdown-checkboxes::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Badge de sélection sur le bouton */
.jsf-dropdown-selected-badge {
    background: #0073aa;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    margin-left: 8px;
    font-weight: 500;
}

/* Animation d'ouverture */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.jsf-checkbox-dropdown-panel.active {
    animation: slideDown 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .jsf-checkbox-dropdown-panel {
        position: fixed;
        top: auto ! important;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 12px 12px 0 0;
        max-height: 70vh ! important;
    }

    .jsf-checkbox-dropdown-panel.active {
        animation: slideUp 0.3s ease;
    }

    @keyframes slideUp {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Overlay pour mobile */
.jsf-dropdown-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.jsf-dropdown-overlay.active {
    display: block;
}