/**
 * MonPC - Filtres Techniques Dynamiques — v1.7
 */

/* ----------------------------------------
   Groupe de filtre
---------------------------------------- */
.monpc-filter-form .monpc-filter-group {
    margin-bottom: 10px;
    position: relative;
}

/* ----------------------------------------
   Bouton toggle du dropdown
---------------------------------------- */
.monpc-filter-form .monpc-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 12px;
    height: 38px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    text-align: left;
    transition: border-color 0.2s ease;
    gap: 6px;
}

.monpc-filter-form .monpc-dropdown-toggle:hover,
.monpc-filter-form .monpc-dropdown-toggle[aria-expanded="true"] {
    border-color: #111;
}

.monpc-filter-form .monpc-toggle-label {
    flex: 1;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Badge de comptage (nb de valeurs sélectionnées) */
.monpc-filter-form .monpc-toggle-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: #111;
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    flex-shrink: 0;
}

.monpc-filter-form .monpc-toggle-arrow {
    font-size: 11px;
    color: #999;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.monpc-filter-form .monpc-dropdown-toggle[aria-expanded="true"] .monpc-toggle-arrow {
    transform: rotate(180deg);
}

/* ----------------------------------------
   Liste déroulante avec checkboxes
---------------------------------------- */
.monpc-filter-form .monpc-dropdown-list {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.10);
    z-index: 999;
    max-height: 220px;
    overflow-y: auto;
    padding: 6px 0;
}

/* Scrollbar discrète */
.monpc-filter-form .monpc-dropdown-list::-webkit-scrollbar { width: 4px; }
.monpc-filter-form .monpc-dropdown-list::-webkit-scrollbar-track { background: #f5f5f5; }
.monpc-filter-form .monpc-dropdown-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* ----------------------------------------
   Ligne checkbox
---------------------------------------- */
.monpc-filter-form .monpc-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: background 0.15s ease;
    margin: 0;
}

.monpc-filter-form .monpc-checkbox-label:hover {
    background: #f5f5f5;
}

.monpc-filter-form .monpc-checkbox-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: #177058;
    cursor: pointer;
    margin: 0;
}

.monpc-filter-form .monpc-checkbox-label input[type="checkbox"]:checked + span {
    font-weight: bold;
    color: #111;
}

/* Message "aucune option" */
.monpc-filter-form .monpc-no-options {
    display: block;
    padding: 8px 12px;
    font-size: 12px;
    color: #999;
    font-style: italic;
}

/* ----------------------------------------
   Bouton Filtrer
---------------------------------------- */
.monpc-filter-form .monpc-filter-submit {
    width: 100%;
    background: #111;
    color: #fff;
    padding: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    margin-top: 10px;
    transition: background 0.2s ease;
}

.monpc-filter-form .monpc-filter-submit:hover {
    background: #333;
}

/* ----------------------------------------
   Lien Réinitialiser
---------------------------------------- */
.monpc-filter-form .monpc-filter-reset {
    display: block;
    margin-top: 12px;
    font-size: 12px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.monpc-filter-form .monpc-filter-reset[hidden] {
    display: none;
}

/* ----------------------------------------
   Overlay + spinner sur la grille produits
---------------------------------------- */
.monpc-products-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
}

.monpc-spinner-ring {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.12);
    border-top-color: #111;
    border-radius: 50%;
    animation: monpc-spin 0.7s linear infinite;
}

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

/* ----------------------------------------
   Admin — tableaux responsive (mobile)
   table-layout:auto et overflow-x sont injectés en style inline
   dans le PHP pour overrider la classe WP "fixed" sans !important.
   Ce bloc CSS gère uniquement le padding, la typo et les labels mobile.
---------------------------------------- */

/* Cellules : retour à la ligne normal */
.monpc-table-wrap table th,
.monpc-table-wrap table td {
    word-break: break-word;
    white-space: normal;
}

/* Première colonne : largeur min pour éviter l'écrasement */
.monpc-table-wrap table th:first-child,
.monpc-table-wrap table td:first-child {
    min-width: 140px;
}

@media screen and (max-width: 782px) {

    /* Scroll horizontal sur petits écrans (le tableau a un min-width) */
    .monpc-table-wrap {
        overflow-x: auto;
    }

    .monpc-table-wrap table {
        font-size: 12px;
    }

    .monpc-table-wrap table th,
    .monpc-table-wrap table td {
        padding: 6px 8px;
    }

    .monpc-table-wrap .monpc-col-avoirs {
        min-width: 70px;
        font-size: 12px;
    }
}

/* ----------------------------------------
   Widget — Filtre par Rôle (Groupes)
---------------------------------------- */
.monpc-wgf-role-filter-container {
    font-size: 13px;
}

.monpc-wgf-role-form {
    margin-top: 8px;
}

.monpc-wgf-filter-item {
    margin-top: 8px;
}

.monpc-wgf-filter-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: inherit;
    font-size: 13px;
    font-weight: normal;
    margin: 0;
}

.monpc-wgf-filter-item label:hover {
    color: #111;
}

.monpc-wgf-role-cb {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: #177058;
    cursor: pointer;
    margin: 0;
}

/* ----------------------------------------
   Widget — Filtre par prix (fourchette)
---------------------------------------- */
.monpc-filter-form .monpc-price-filter {
    margin: 14px 0 4px;
}

.monpc-filter-form .monpc-price-title {
    display: block;
    font-weight: bold;
    font-size: 13px;
    color: #333;
    margin-bottom: 14px;
}

/* Zone du slider (deux range superposés) */
.monpc-filter-form .monpc-price-slider {
    position: relative;
    height: 18px;
    margin: 0 8px 14px;
}

.monpc-filter-form .monpc-price-track,
.monpc-filter-form .monpc-price-fill {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 4px;
    border-radius: 2px;
}

.monpc-filter-form .monpc-price-track {
    left: 0;
    right: 0;
    background: #ddd;
}

.monpc-filter-form .monpc-price-fill {
    background: #177058;
    pointer-events: none;
}

/* Les deux inputs range, transparents et superposés */
.monpc-filter-form .monpc-price-range {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    width: 100%;
    height: 18px;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;   /* seul le thumb capte les events */
    z-index: 4;
}

/* Pistes natives invisibles */
.monpc-filter-form .monpc-price-range::-webkit-slider-runnable-track {
    background: transparent;
    height: 18px;
    border: none;
}
.monpc-filter-form .monpc-price-range::-moz-range-track {
    background: transparent;
    height: 18px;
    border: none;
}

/* Thumbs */
.monpc-filter-form .monpc-price-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #177058;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.monpc-filter-form .monpc-price-range::-moz-range-thumb {
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #177058;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* Champs numériques min / max */
.monpc-filter-form .monpc-price-fields {
    display: flex;
    align-items: center;
    gap: 8px;
}

.monpc-filter-form .monpc-price-field {
    display: inline-flex;
    align-items: center;
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    padding: 0 8px;
    height: 34px;
    transition: border-color 0.2s ease;
}

.monpc-filter-form .monpc-price-field:focus-within {
    border-color: #111;
}

.monpc-filter-form .monpc-price-input {
    width: 100%;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: #333;
    padding: 0;
    margin: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}

.monpc-filter-form .monpc-price-input::-webkit-outer-spin-button,
.monpc-filter-form .monpc-price-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.monpc-filter-form .monpc-price-unit {
    margin-left: 4px;
    font-size: 13px;
    color: #777;
    flex-shrink: 0;
}

.monpc-filter-form .monpc-price-sep {
    color: #999;
    flex-shrink: 0;
}


