/**
 * XoXo Cards - Wishlist Modal CSS
 *
 * v7.0.12 [TACHE 163] : styles dedies de la nouvelle barre d'outils de la modal
 * d'ajout (recherche + tri + filtres + pagination) ainsi que la pagination.
 * Hosted dans un fichier separe pour eviter de polluer cards.css principal et
 * faciliter la maintenance/cache-busting independant.
 *
 * @package XoXo_Cards
 * @since 7.0.12
 */

/* ============================================================
   1. BARRE D'OUTILS (search + sort + filters toggle)
   ============================================================ */
.xoxo-wishlist-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 12px 0;
}
.xoxo-wishlist-search-wrap {
    flex: 1 1 220px;
    min-width: 200px;
    position: relative;
}
.xoxo-wishlist-search-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.xoxo-wishlist-search-input {
    width: 100%;
    height: 38px;
    padding: 0 36px 0 36px;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #111827;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.4;
    box-sizing: border-box;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
}
/* v7.0.13 [TACHE 164 POINT 1] : SocialV / themes BuddyPress reglent souvent
   un padding-left=12px sur tous les <input type="search"> via des regles
   plus specifiques. On force la specificite (parent .xoxo-wishlist-modal-content
   + classe input) ET on applique !important pour garantir que l'icone loupe
   absolue (left:12px, width:16px) ne se superpose plus au placeholder. */
.xoxo-wishlist-modal-content .xoxo-wishlist-search-input,
.xoxo-wishlist-toolbar .xoxo-wishlist-search-input,
input.xoxo-wishlist-search-input[type="search"] {
    padding-left: 38px !important;
    padding-right: 38px !important;
    text-indent: 0 !important;
}
.xoxo-wishlist-search-input:focus {
    outline: none;
    border-color: #FF00AA;
    box-shadow: 0 0 0 3px rgba(255, 0, 170, 0.12);
}
.xoxo-wishlist-search-input::placeholder {
    color: #9ca3af;
}
.xoxo-wishlist-search-clear {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
}
.xoxo-wishlist-search-clear:hover {
    background: rgba(255, 0, 170, 0.1);
    color: #FF00AA;
}

.xoxo-wishlist-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
/* ------------------------------------------------------------
   v7.1.0 [TACHE 165 DEFAUT 1] : DROPDOWN CUSTOM DE TRI
   ------------------------------------------------------------
   Le <select> natif "A → Z / Z → A / Récentes" etait limite par la
   contrainte navigateur "popup native = largeur du <select> ferme".
   Sous certains navigateurs (Firefox notamment) la liste deroulante
   ouverte etait trop etroite pour etre lisible. On remplace par un
   dropdown 100% custom (button + ul listbox) avec :
     - popup auto-width via `width: max-content`
     - ARIA complet (haspopup / expanded / listbox / option / selected)
     - clavier (Enter/Space/Up/Down/Home/End/Escape)
     - hover/focus/active visuels
     - portee a la modal d'ajout uniquement
   ------------------------------------------------------------ */
.xoxo-wishlist-sort-dropdown {
    position: relative;
    display: inline-block;
    /* Conteneur a largeur intrinseque : le button trigger fixe sa taille,
       la popup .xoxo-sort-menu pourra deborder a droite/gauche selon contenu. */
}
.xoxo-sort-trigger {
    /* Trigger : meme look-and-feel que l'ancien <select> (38px / radius 8px /
       chevron a droite) pour ne pas perturber l'utilisateur. */
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 110px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-family: inherit;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
    box-shadow: none;
    outline: none;
}
.xoxo-sort-trigger .xoxo-sort-label {
    flex: 1 1 auto;
    white-space: nowrap;
}
.xoxo-sort-trigger .xoxo-sort-chevron {
    flex: 0 0 auto;
    color: #6b7280;
    transition: transform 0.18s ease, color 0.18s ease;
}
.xoxo-sort-trigger:hover {
    border-color: #FF00AA;
    color: #FF00AA;
}
.xoxo-sort-trigger:hover .xoxo-sort-chevron {
    color: #FF00AA;
}
.xoxo-sort-trigger:focus-visible {
    border-color: #FF00AA;
    box-shadow: 0 0 0 3px rgba(255, 0, 170, 0.12);
}
.xoxo-sort-trigger[aria-expanded="true"] {
    border-color: #FF00AA;
    color: #FF00AA;
    box-shadow: 0 0 0 3px rgba(255, 0, 170, 0.12);
}
.xoxo-sort-trigger[aria-expanded="true"] .xoxo-sort-chevron {
    transform: rotate(180deg);
    color: #FF00AA;
}

.xoxo-sort-menu {
    /* Popup listbox : positionnement absolu sous le trigger.
       `width: max-content` = la popup s'adapte au contenu le plus long
       (option "Récentes" ici) sans etre limitee par la largeur du trigger.
       `min-width: 100%` pour ne jamais etre plus etroite que le trigger. */
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 50;
    margin: 0;
    padding: 4px;
    list-style: none;
    width: max-content;
    min-width: 100%;
    max-width: 240px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12), 0 2px 6px rgba(17, 24, 39, 0.06);
}
.xoxo-sort-menu[hidden] {
    display: none !important;
}
.xoxo-sort-option {
    display: flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: background-color 0.12s ease, color 0.12s ease;
    outline: none;
}
.xoxo-sort-option:hover,
.xoxo-sort-option:focus-visible {
    background: rgba(255, 0, 170, 0.08);
    color: #FF00AA;
}
.xoxo-sort-option[aria-selected="true"] {
    background: rgba(255, 0, 170, 0.12);
    color: #FF00AA;
    font-weight: 600;
}

/* ------------------------------------------------------------
   FIN DROPDOWN CUSTOM (v7.1.0)
   ------------------------------------------------------------ */

.xoxo-wishlist-filters-toggle {
    display: inline-flex;
    align-items: center;
    height: 38px;
    padding: 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
    position: relative;
    -webkit-appearance: none;
    appearance: none;
}
.xoxo-wishlist-filters-toggle:hover,
.xoxo-wishlist-filters-toggle[aria-expanded="true"] {
    border-color: #FF00AA;
    color: #FF00AA;
}
.xoxo-active-filters-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 9px;
    background: #FF00AA;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

/* ============================================================
   2. PANNEAU FILTRES AVANCES (collapsible)
   ============================================================ */
.xoxo-wishlist-filters-panel {
    margin: 0 0 14px 0;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
}
.xoxo-wishlist-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    align-items: end;
}
.xoxo-wishlist-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.xoxo-wishlist-filter-group label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.xoxo-wishlist-filter-select {
    width: 100%;
    height: 36px;
    padding: 0 28px 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E")
        no-repeat right 10px center;
    color: #374151;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
}
.xoxo-wishlist-filter-select:hover {
    border-color: #FF00AA;
}
.xoxo-wishlist-filter-select:focus {
    outline: none;
    border-color: #FF00AA;
    box-shadow: 0 0 0 3px rgba(255, 0, 170, 0.12);
}
.xoxo-wishlist-filter-actions {
    display: flex;
    align-items: end;
}
.xoxo-wishlist-filters-reset {
    /* v7.0.13 [TACHE 164 POINT 3] : centrage strict horizontal + vertical
       du texte. Auparavant, le bouton n'avait que line-height par defaut
       et le texte etait aligne en baseline du <button> -> visuellement
       decentré verticalement par rapport a la box 36px. Force flex centering. */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #6b7280;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
}
.xoxo-wishlist-filters-reset:hover {
    border-color: #FF00AA;
    color: #FF00AA;
}

/* ============================================================
   3. PAGINATION
   ============================================================ */
.xoxo-wishlist-pagination {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin: 14px 0 6px 0;
    padding: 4px 0;
    justify-content: center;
}
.xoxo-wishlist-pagination:empty {
    display: none;
}
.xoxo-wishlist-pagebtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
}
.xoxo-wishlist-pagebtn:hover:not([disabled]):not(.active) {
    border-color: #FF00AA;
    color: #FF00AA;
}
.xoxo-wishlist-pagebtn.active {
    background: #FF00AA;
    border-color: #FF00AA;
    color: #fff;
    cursor: default;
    box-shadow: 0 1px 4px rgba(255, 0, 170, 0.25);
}
.xoxo-wishlist-pagebtn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}
.xoxo-wishlist-pageellipsis {
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
    color: #9ca3af;
    font-size: 13px;
    user-select: none;
    -webkit-user-select: none;
}
.xoxo-wishlist-pageindicator {
    margin-left: 12px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* ============================================================
   4. RESPONSIVE - MOBILE (< 768px)
   ============================================================ */
@media (max-width: 767px) {
    .xoxo-wishlist-toolbar {
        gap: 8px;
    }
    .xoxo-wishlist-search-wrap {
        flex: 1 1 100%;
        min-width: 0;
    }
    .xoxo-wishlist-toolbar-controls {
        flex: 1 1 100%;
        justify-content: space-between;
    }
    .xoxo-wishlist-sort-dropdown {
        flex: 1 1 auto;
    }
    .xoxo-sort-trigger {
        width: 100%;
        min-width: 0;
    }
    .xoxo-wishlist-filters-grid {
        grid-template-columns: 1fr;
    }
    .xoxo-wishlist-pageindicator {
        flex: 1 1 100%;
        text-align: center;
        margin: 6px 0 0 0;
    }
    .xoxo-wishlist-pagebtn {
        min-width: 36px;
        height: 36px; /* Touch target Q3.D mobile */
    }
}

/* ============================================================
   5. FOOTER MODAL (compteur a gauche + bouton a droite)
   ============================================================ */

/* v7.0.13 [TACHE 164 POINT 4] : layout strict du footer modal d'ajout wishlist.
   Avant v7.0.13 : .xoxo-modal-footer global heritait d'un text-align ou d'un
   flex non-justify -> compteur et bouton n'etaient pas alignes correctement
   (cf capture utilisateur : compteur centre, bouton mal place). Apres v7.0.13 :
   flex justify-content space-between, compteur a gauche / bouton a droite, sur
   la meme ligne. Sur mobile (< 768px) : reflow en colonne avec bouton en
   PREMIER (au-dessus) et compteur en DESSOUS (decision utilisateur fallback
   pour petits ecrans).
   Specificite renforcee via .xoxo-wishlist-modal-content pour surclasser
   d'eventuelles regles theme (SocialV / BuddyPress). */
.xoxo-wishlist-modal-content .xoxo-modal-footer {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    text-align: initial;
}
.xoxo-wishlist-modal-content .xoxo-modal-footer #xoxo-selected-count {
    flex: 0 1 auto;
    font-size: 13px;
    color: #6b7280;
    text-align: left;
}
.xoxo-wishlist-modal-content .xoxo-modal-footer #xoxo-confirm-wishlist {
    flex: 0 0 auto;
    margin-left: auto;
}

/* Responsive mobile : reflow en colonne, bouton EN PREMIER (au-dessus) +
   compteur EN DESSOUS (decision utilisateur fallback Point 4). */
@media (max-width: 480px) {
    .xoxo-wishlist-modal-content .xoxo-modal-footer {
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
    }
    .xoxo-wishlist-modal-content .xoxo-modal-footer #xoxo-confirm-wishlist {
        order: 1;
        width: 100%;
        justify-content: center;
    }
    .xoxo-wishlist-modal-content .xoxo-modal-footer #xoxo-selected-count {
        order: 2;
        text-align: right;
        width: 100%;
    }
}

