/* ==========================================
   XZIT — Filter Mobile Bottom Sheet
   css/filter-mobile.css
========================================== */

/* ── Bouton sticky "Filters" sur mobile ── */
.xz-filter-fab {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;

    align-items: center;
    gap: 8px;
    padding: 13px 28px;
    border-radius: 100px;
    border: none;
    background: #051036;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(5,16,54,0.35);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.xz-filter-fab:hover { transform: translateX(-50%) scale(1.04); }
.xz-filter-fab:active { transform: translateX(-50%) scale(0.97); }

.xz-filter-fab svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Badge compteur de filtres actifs */
#xzFilterBadge {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 100px;
    background: #CA0B09;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

/* ── Overlay sombre ── */
.xz-filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5,16,54,0.6);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.25s;
}

.xz-filter-overlay.is-open {
    display: block;
    opacity: 1;
}

/* ── Bottom Sheet ── */
.xz-filter-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: #fff;
    border-radius: 20px 20px 0 0;
    /* Hauteur explicite — obligatoire pour que le scroll fonctionne sur Android */
    height: 88vh;
    height: 88dvh;
    /* overflow:hidden pour le border-radius — le scroll est sur __body */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
}

.xz-filter-sheet.is-open {
    transform: translateY(0);
}

/* Handle drag */
.xz-filter-sheet__handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: #d1d5db;
    margin: 12px auto 0;
    flex-shrink: 0;
}

/* Header du sheet */
.xz-filter-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 12px;
    border-bottom: 1px solid #f0f2f5;
    flex-shrink: 0;
}

.xz-filter-sheet__title {
    font-size: 17px;
    font-weight: 700;
    color: #051036;
}

.xz-filter-sheet__close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #051036;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Corps scrollable */
.xz-filter-sheet__body {
    overflow-y: scroll; /* scroll au lieu de auto — force le scroll sur Android */
    overflow-x: hidden;
    flex: 1;
    min-height: 0; /* critique pour flex + overflow */
    padding: 0 20px 20px;
    -webkit-overflow-scrolling: touch; /* iOS momentum */
    overscroll-behavior-y: contain;
    /* Touch events explicites pour Android */
    touch-action: pan-y;
}

/* Sections dans le sheet */
.xz-filter-sheet__section {
    padding: 18px 0;
    border-bottom: 1px solid #f0f2f5;
}

.xz-filter-sheet__section:last-child {
    border-bottom: none;
}

.xz-filter-sheet__section-title {
    font-size: 15px;
    font-weight: 700;
    color: #051036;
    margin-bottom: 14px;
}

/* Checkboxes dans le sheet — style clair */
.xz-filter-sheet .form-checkbox {
    display: flex;
    align-items: center;
}

.xz-filter-sheet .form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    accent-color: #3554D1;
    flex-shrink: 0;
}

.xz-filter-sheet__checkbox-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.xz-filter-sheet__checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #051036;
    cursor: pointer;
}

.xz-filter-sheet__checkbox-count {
    font-size: 13px;
    color: #9ca3af;
}

/* Footer avec boutons Apply + Clear */
.xz-filter-sheet__footer {
    display: flex;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #f0f2f5;
    /* flex-shrink:0 + background pour que le footer reste visible et ne scroll pas */
    flex-shrink: 0;
    background: #fff;
    /* Safe area iOS (notch/home indicator) */
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

.xz-filter-sheet__apply {
    flex: 1;
    padding: 14px;
    border-radius: 10px;
    border: none;
    background: #051036;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.xz-filter-sheet__apply:hover { opacity: 0.88; }

.xz-filter-sheet__clear {
    padding: 14px 20px;
    border-radius: 10px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    color: #051036;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s;
}

.xz-filter-sheet__clear:hover { border-color: #9ca3af; }

/* ── Responsive — afficher le FAB seulement sur mobile ── */
@media (max-width: 1023px) {
    .xz-filter-fab {
        display: inline-flex;
    }

    /* Espace en bas pour ne pas cacher le dernier item */
    #activitiesGrid,
    #cityItemsGrid {
        padding-bottom: 90px;
    }
}

@media (min-width: 1024px) {
    .xz-filter-overlay,
    .xz-filter-sheet {
        display: none !important;
    }
}

/* ── Sort list dans la sidebar desktop ── */
.sidebar-sort-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-sort-list .xzit-sort-option {
    display: block;
    width: 100%;
    padding: 9px 12px;
    text-align: left;
    background: none;
    border: 1.5px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    color: #051036;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
    margin-bottom: 4px;
}

.sidebar-sort-list .xzit-sort-option:hover {
    background: rgba(53,84,209,0.05);
}

.sidebar-sort-list .xzit-sort-option.is-active {
    color: #3554d1;
    font-weight: 600;
    background: rgba(53,84,209,0.07);
    border-color: rgba(53,84,209,0.2);
}

/* ── Sort list dans le bottom sheet mobile ── */
.sheet-sort-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sheet-sort-list .xzit-sort-option {
    display: block;
    width: 100%;
    padding: 12px 14px;
    text-align: left;
    background: none;
    border: 1.5px solid transparent;
    border-radius: 10px;
    font-size: 15px;
    color: #051036;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
    margin-bottom: 4px;
}

.sheet-sort-list .xzit-sort-option:hover {
    background: rgba(53,84,209,0.05);
}

.sheet-sort-list .xzit-sort-option.is-active {
    color: #3554d1;
    font-weight: 600;
    background: rgba(53,84,209,0.07);
    border-color: rgba(53,84,209,0.2);
}

/* ── Checkbox rows dans le sheet mobile ── */
.xz-sheet-cb-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}

.xz-sheet-cb-row:last-of-type {
    border-bottom: none;
}

.xz-sheet-cb-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
    font-size: 14px;
    color: #051036;
    line-height: 1.3;
}

.xz-sheet-cb-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    accent-color: #3554D1;
    flex-shrink: 0;
}

.xz-sheet-cb-text {
    flex: 1;
}

.xz-sheet-cb-count {
    font-size: 13px;
    color: #9ca3af;
    margin-left: 8px;
    flex-shrink: 0;
}

/* Bouton View More / Less dans le sheet */
.xz-sheet-view-more {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 0 4px;
    background: none;
    border: none;
    border-top: 1px solid #f0f2f5;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #3554D1;
    cursor: pointer;
    font-family: inherit;
}

.xz-sheet-view-more:hover {
    opacity: 0.8;
}