/* Page annonces v2 */

.page-annonces-v2 .annonces-type-tabs-wrap--v2 {
    margin: 0 0 14px;
}

.annonces-filters-sync-btn {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* —— Barre —— */
.annonces-toolbar-v2 {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.annonces-toolbar-v2-filters-btn {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 14px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.82rem;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition);
    overflow: visible;
}

.annonces-toolbar-v2-filters-btn:hover,
.annonces-toolbar-v2-filters-btn[aria-expanded="true"] {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--brand-soft);
}

.annonces-toolbar-v2-filters-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    overflow: visible;
}

.annonces-toolbar-v2-filters-icon-wrap i {
    font-size: 0.9rem;
    line-height: 1;
}

.annonces-filters-more-badge {
    position: absolute;
    top: -11px;
    right: -10px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    border: 2px solid var(--bg);
    box-sizing: border-box;
    pointer-events: none;
    z-index: 1;
}

.annonces-toolbar-v2-scroll {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.annonces-toolbar-v2-scroll::-webkit-scrollbar {
    display: none;
}

.annonces-toolbar-v2-chips {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 2px;
}

.page-annonces-v2 .annonces-toolbar-v2-chips .annonces-filter-btn {
    flex-shrink: 0;
}

/* —— Panneau —— */
.annonces-filters-panel {
    position: fixed;
    inset: 0;
    z-index: 10200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.annonces-filters-panel.is-open {
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
}

.annonces-filters-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 40, 0.45);
}

.annonces-filters-panel-sheet {
    position: relative;
    z-index: 1;
    width: min(100%, 480px);
    max-height: min(88dvh, 680px);
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(16, 24, 40, 0.12);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.annonces-filters-panel.is-open .annonces-filters-panel-sheet {
    transform: translateY(0);
}

.annonces-filters-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 10px;
    flex-shrink: 0;
}

.annonces-filters-panel-header h3 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
}

.annonces-filters-panel-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.annonces-filters-panel-close:hover {
    background: var(--surface-2, #f3f4f6);
    color: var(--text);
}

.annonces-filters-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 12px;
}

/* Accordéon */
.annonces-filters-accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.annonces-filters-accordion-item {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    overflow: hidden;
}

.annonces-filters-accordion-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border: none;
    background: transparent;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    color: var(--text);
}

.annonces-filters-accordion-title {
    font-size: 0.88rem;
    font-weight: 700;
    flex-shrink: 0;
}

.annonces-filters-accordion-meta {
    flex: 1;
    min-width: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.annonces-filters-accordion-chevron {
    flex-shrink: 0;
    font-size: 0.72rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.annonces-filters-accordion-item.is-open .annonces-filters-accordion-chevron {
    transform: rotate(180deg);
}

.annonces-filters-accordion-panel {
    padding: 0 14px 14px;
    border-top: 1px solid var(--border);
}

.annonces-filters-accordion-panel[hidden] {
    display: none;
}

/* Segment type */
.annonces-type-segment {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-top: 12px;
    border-radius: var(--r-pill);
    background: var(--surface-2, #f3f4f6);
}

.annonces-type-segment .annonces-type-tab {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding: 8px 4px;
    border: none;
    background: transparent;
    color: var(--text-soft);
    font-size: 0.76rem;
    font-weight: 700;
    box-shadow: none;
}

.annonces-type-segment .annonces-type-tab i,
.annonces-type-segment .annonces-type-tab__count {
    display: none;
}

.annonces-type-segment .annonces-type-tab.active {
    background: var(--surface);
    color: var(--brand);
    border-radius: var(--r-pill);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

/* Genres — matrice Je cherche / Qui cherche */
.annonces-gender-matrix {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 12px;
}

.annonces-gender-matrix-all {
    align-self: flex-start;
}

.annonces-gender-matrix-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.annonces-gender-matrix-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.annonces-gender-matrix-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.annonces-gender-sync-hidden {
    display: none !important;
}

/* Genres (legacy grid — unused in v2 panel) */
.annonces-filters-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
}

.annonces-filters-chip-grid .annonces-filter-btn {
    font-size: 0.78rem;
    padding: 6px 11px;
}

/* Inline distance / période */
.annonces-filters-inline-group + .annonces-filters-inline-group {
    margin-top: 14px;
}

.annonces-filters-inline-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.annonces-filters-inline-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.annonces-filters-inline-chip {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    background: var(--bg);
    color: var(--text-soft);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.annonces-filters-inline-chip:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.annonces-filters-inline-chip.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.annonces-filters-premium-lock {
    padding: 14px 0 4px;
    text-align: center;
}

.annonces-filters-premium-lock i {
    color: #d97706;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.annonces-filters-premium-lock p {
    margin: 0 0 12px;
    font-size: 0.82rem;
    color: var(--text-soft);
    line-height: 1.4;
}

.annonces-filters-premium-lock-btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--r-pill);
    background: var(--brand);
    color: #fff;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

/* Footer */
.annonces-filters-panel-footer {
    display: flex;
    gap: 10px;
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.annonces-filters-panel-reset {
    flex: 1;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--text-soft);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

.annonces-filters-panel-apply {
    flex: 1.4;
    height: 42px;
    border: none;
    border-radius: var(--r-pill);
    background: var(--brand);
    color: #fff;
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 380px) {
    .annonces-toolbar-v2-filters-label {
        display: none;
    }

    .annonces-toolbar-v2-filters-btn {
        width: 38px;
        padding: 0;
    }
}

@media (min-width: 768px) {
    .annonces-filters-panel {
        align-items: center;
        padding: 20px;
    }

    .annonces-filters-panel-sheet {
        border-radius: 16px;
    }
}

html[data-theme="dark"] .annonces-type-segment {
    background: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .annonces-filters-accordion-item {
    background: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .annonces-filters-more-badge {
    border-color: var(--surface);
}

/* —— Filtres tags —— */
.annonces-tag-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.annonces-tag-filters-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: 38px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
}

.annonces-tag-filters-search-input {
    flex: 1;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.88rem;
    outline: none;
    min-width: 0;
}

.annonces-tag-filters-hint {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.annonces-tag-filters-group-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.annonces-tag-filters-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.annonces-tag-filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.78rem;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.annonces-tag-filter-chip:hover {
    border-color: var(--accent);
}

.annonces-tag-filter-chip.active {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    color: var(--accent);
    font-weight: 600;
}

.annonces-tag-filter-chip[hidden] {
    display: none;
}

html[data-theme="dark"] .annonces-tag-filter-chip.active {
    background: rgba(245, 158, 11, 0.14);
}
