/* === /annonces list page === */

/* Reset common.css "section p, div { padding-left: 1em }" on layout containers only */
.annonces-layout, .annonces-sidebar, .ann-side-block, .ann-side-reset,
.annonces-center, .annonces-content, .annonces-list,
.annonces-grid, .annonces-mapside, .annonces-search,
.annonces-map, .annonces-map-mini, .annonces-map-mobile-leaflet,
.annonces-filters, .annonces-pagination,
.annonce-titre, .annonce-infos, .annonce-img-wrap,
.annonce-noimag, .annonce-card p,
.annonces-org-active, .annonces-org-wrap,
.annonces-org-suggestions { padding-left: 0; }
#annonces-leaflet div { padding-left: 0; }

#assoce.annonces-page {
    max-width: 100%;
    margin: 0;
    padding: 1rem 2rem 0;
}

.annonces-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--ex-stone-500);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.annonces-breadcrumb a {
    color: var(--ex-link);
    text-decoration: none;
}
.annonces-breadcrumb a:hover {
    color: var(--ex-link-hover);
    text-decoration: underline;
}
.annonces-breadcrumb .sep {
    color: var(--ex-stone-300);
    font-size: 0.7em;
}
.annonces-breadcrumb span:last-child {
    color: var(--ex-stone-700);
    font-weight: 500;
}

.annonces-page > h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 .75rem;
    color: var(--ex-stone-900, #1c1917);
}

/* --- Layout principal --- */
.annonces-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

/* === Sidebar gauche === */
.annonces-sidebar {
    flex: 0 0 400px;
    position: sticky;
    top: 1rem;
}
.ann-side-block {
    background: #fff;
    border: 1px solid var(--ex-stone-200, #e7e5e4);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    margin-bottom: .6rem;
}
.ann-side-block h3 {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--ex-stone-400, #a8a29e);
    margin: 0 0 .5rem;
}
.ann-side-block select {
    width: 100%;
    padding: .4rem .5rem;
    border: 1px solid var(--ex-stone-300, #d6d3d1);
    border-radius: 6px;
    font-size: .8rem;
    font-family: var(--ex-font, system-ui, sans-serif);
    color: var(--ex-stone-700, #44403c);
    background: #fff;
    cursor: pointer;
}

/* --- Carte SVG departements --- */
.annonces-map {
    margin-top: .4rem;
    user-select: none;
}
.annonces-map svg {
    width: 100%;
    height: auto;
    display: block;
}
.annonces-map svg path {
    fill: var(--ex-stone-200, #e7e5e4);
    stroke: #fff;
    stroke-width: 1px;
    transition: fill .12s;
}
.annonces-map svg path:not(.disabled) {
    fill: var(--ex-stone-900, #1c1917);
    cursor: pointer;
}
.annonces-map svg path:not(.disabled):hover {
    fill: var(--ex-green-400, #ffbb09);
}
.annonces-map svg path.active {
    fill: var(--ex-green-500, #f59e0b);
}
.annonces-map svg path.active:hover {
    fill: var(--ex-green-400, #ffbb09);
}
.annonces-map svg path.disabled {
    fill: var(--ex-stone-200, #e7e5e4);
    cursor: default;
}

/* --- Organisation filter --- */
.annonces-org-active {
    display: flex;
    align-items: center;
}
.annonces-org-tag {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .55rem;
    border-radius: 6px;
    font-size: .78rem;
    font-weight: 500;
    color: var(--ex-stone-800, #292524);
    background: var(--ex-stone-100, #f5f5f4);
    border: 1px solid var(--ex-stone-200, #e7e5e4);
}
.annonces-org-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    font-size: .85rem;
    line-height: 1;
    color: var(--ex-stone-500, #78716c);
    text-decoration: none;
    transition: all .12s;
}
.annonces-org-remove:hover {
    background: var(--ex-stone-300, #d6d3d1);
    color: var(--ex-stone-800, #292524);
}
.annonces-org-wrap {
    position: relative;
}
.annonces-org-wrap input {
    width: 100%;
    box-sizing: border-box;
    padding: .38rem .55rem;
    border: 1px solid var(--ex-stone-300, #d6d3d1);
    border-radius: 6px;
    font-size: .8rem;
    font-family: var(--ex-font, system-ui, sans-serif);
    color: var(--ex-stone-800, #292524);
    background: #fff;
}
.annonces-org-wrap input::placeholder {
    color: var(--ex-stone-400, #a8a29e);
}
.annonces-org-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    background: #fff;
    border: 1px solid var(--ex-stone-200, #e7e5e4);
    border-radius: 6px;
    margin-top: 2px;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    max-height: 200px;
    overflow-y: auto;
}
.annonces-org-suggestions:empty {
    display: none;
}
.annonces-org-suggestion {
    padding: .4rem .6rem;
    font-size: .78rem;
    color: var(--ex-stone-700, #44403c);
    cursor: pointer;
    transition: background .1s;
}
.annonces-org-suggestion:hover {
    background: var(--ex-green-50, #fffbeb);
    color: var(--ex-green-900, #78350f);
}

/* --- Categories (tags type) --- */
.annonces-filters {
    display: flex;
    gap: .3rem;
    flex-wrap: wrap;
}
.annonces-filters a {
    display: inline-block;
    padding: .28rem .6rem;
    border-radius: 16px;
    font-size: .75rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--ex-stone-200, #e7e5e4);
    color: var(--ex-stone-600, #57534e);
    background: #fff;
    transition: all .15s;
}
.annonces-filters a:hover {
    border-color: var(--ex-green-300, #fcd34d);
    color: var(--ex-green-800, #92400e);
    background: var(--ex-green-50, #fffbeb);
}
.annonces-filters a.active {
    border-color: var(--ex-green-600, #d97706);
    color: #fff;
    background: var(--ex-green-600, #d97706);
}
.annonces-filters a.dimmed {
    opacity: 0.35;
    pointer-events: auto;
}

/* --- Reset filters --- */
.ann-side-reset {
    text-align: center;
}
.annonces-reset {
    display: block;
    padding: .4rem .6rem;
    border-radius: 6px;
    font-size: .78rem;
    font-weight: 500;
    color: var(--ex-stone-600, #57534e);
    text-decoration: none;
    border: 1px solid var(--ex-stone-300, #d6d3d1);
    transition: all .12s;
}
.annonces-reset:hover {
    color: var(--ex-stone-800, #292524);
    border-color: var(--ex-stone-400, #a8a29e);
    background: var(--ex-stone-50, #fafaf9);
}

/* --- CTA sidebar --- */
.ann-side-cta p {
    font-size: .76rem;
    line-height: 1.5;
    color: var(--ex-stone-500, #78716c);
    margin: 0 0 .5rem;
}
.annonces-cta {
    display: block;
    text-align: center;
    padding: .5rem .6rem;
    border-radius: 8px;
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
    background: var(--ex-green-400, #ffbb09);
    color: #1c1917;
    transition: background .15s;
}
.annonces-cta:hover {
    background: var(--ex-accent, #ff9100);
}

/* === Zone centrale === */
.annonces-center {
    flex: 1 1 0;
    min-width: 0;
}

/* --- Contenu --- */
.annonces-content {
}

/* --- Liste annonces --- */
.annonces-list {
    flex: 1 1 0;
    min-width: 320px;
}

/* --- Barre de recherche --- */
.annonces-search {
    margin-bottom: .75rem;
}
.annonces-search input {
    width: 100%;
    box-sizing: border-box;
    padding: .5rem .75rem;
    border: 1px solid var(--ex-stone-300, #d6d3d1);
    border-radius: 8px;
    font-size: .85rem;
    font-family: var(--ex-font, system-ui, sans-serif);
    color: var(--ex-stone-800, #292524);
}
.annonces-search input::placeholder {
    color: var(--ex-stone-400, #a8a29e);
}
.annonces-filter-count {
    display: block;
    font-size: .72rem;
    color: var(--ex-stone-500, #78716c);
    margin-top: .25rem;
    padding-left: .2rem;
}

.annonces-empty {
    color: var(--ex-stone-500, #78716c);
    font-size: .9rem;
}

/* --- Liste annonces --- */
.annonces-grid {
    display: flex;
    flex-direction: column;
    gap: .7rem;
}

/* --- Card annonce --- */
.annonce-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-height: 80px;
    border: 1px solid var(--ex-stone-200, #e7e5e4);
    border-radius: 10px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.annonce-card:hover {
    border-color: var(--ex-stone-300, #d6d3d1);
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.annonce-card.annonce-highlight {
    border-color: var(--ex-green-400, #ffbb09);
    box-shadow: 0 0 0 2px var(--ex-green-400, #ffbb09), 0 4px 16px rgba(0,0,0,.08);
    transition: border-color .15s, box-shadow .15s;
}

/* --- Image + tag overlay --- */
.annonce-img-wrap {
    position: relative;
    width: 160px;
    min-width: 160px;
    flex-shrink: 0;
    overflow: hidden;
}
.annonce-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.annonce-img-wrap .annonce-type {
    position: absolute;
    top: .4rem;
    left: .4rem;
}

/* --- Placeholder sans image --- */
.annonce-noimag {
    width: 160px;
    box-sizing: border-box;
    flex-shrink: 0;
    background: var(--ex-stone-100, #f5f5f4);
    position: relative;
    display: flex;
    align-items: flex-start;
    padding: .5rem .6rem;
}

/* --- Type badge --- */
.annonce-type {
    display: inline-block;
    padding: .12rem .45rem;
    border-radius: 4px;
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    backdrop-filter: blur(4px);
}
.annonce-card--Evenement .annonce-type { background: rgba(254,243,199,.9); color: #92400e; }
.annonce-card--Brocante  .annonce-type { background: rgba(254,226,226,.9); color: #991b1b; }
.annonce-card--Appel     .annonce-type { background: rgba(219,234,254,.9); color: #1e40af; }
.annonce-card--Relais    .annonce-type { background: rgba(245,245,244,.9); color: var(--ex-stone-600, #57534e); }

/* --- Titre --- */
.annonce-titre {
    padding: .7rem 1rem;
    display: flex;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
}
.annonce-card h2 {
    margin: 0;
    font-size: .88rem;
    font-weight: 700;
    color: var(--ex-stone-900, #1c1917);
    line-height: 1.3;
}

/* --- Infos (date, lieu, orga) --- */
.annonce-infos {
    flex: 0 0 220px;
    padding: .7rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .2rem;
    border-left: 1px solid var(--ex-stone-100, #f5f5f4);
}

.annonce-ico {
    width: .75rem;
    height: .75rem;
    flex-shrink: 0;
    color: var(--ex-stone-400, #a8a29e);
    vertical-align: -2px;
    margin-right: .3rem;
}

.annonce-dates {
    margin: 0;
    font-size: .73rem;
    color: var(--ex-stone-600, #57534e);
    display: flex;
    align-items: center;
}

.annonce-ville {
    margin: 0;
    font-size: .73rem;
    color: var(--ex-stone-500, #78716c);
    display: flex;
    align-items: center;
}

.annonce-orga {
    margin: 0;
    font-size: .73rem;
    color: var(--ex-stone-500, #78716c);
    display: flex;
    align-items: center;
}

/* --- Ordre : Image > Infos > Titre --- */
.annonce-img-wrap,
.annonce-noimag  { order: 1; }
.annonce-infos   { order: 2; border-left: none; border-right: 1px solid var(--ex-stone-100, #f5f5f4); }
.annonce-titre   { order: 3; padding-left: 1.2rem; }

/* --- Pin focus --- */
#annonces-leaflet .leaflet-marker-icon {
    transition: transform .25s ease, filter .25s ease, opacity .15s;
    transform-origin: bottom center;
}
.pin-focus {
    transform: scale(1.3);
    filter: drop-shadow(0 2px 8px rgba(255,187,9,.6));
}

/* --- Carte Leaflet --- */
.annonces-mapside {
    margin-bottom: .6rem;
    position: relative;
}
.annonces-anim-toggle {
    position: absolute;
    bottom: .5rem;
    left: .5rem;
    z-index: 1000;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--ex-stone-300, #d6d3d1);
    background: var(--ex-surface, #fff);
    color: var(--ex-green-600, #d97706);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: .7;
    transition: opacity .15s, background .15s;
}
.annonces-anim-toggle:hover {
    opacity: 1;
}
.annonces-anim-toggle.paused {
    color: var(--ex-stone-400, #a8a29e);
    opacity: 1;
}
#annonces-leaflet {
    width: 100%;
    height: 330px;
    border-radius: 10px;
    border: 1px solid var(--ex-stone-200, #e7e5e4);
}

/* --- Geo row (select + mini carte) --- */
.annonces-geo-row {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.annonces-geo-row select {
    flex: 1 1 0;
    min-width: 0;
}

/* --- Leaflet mobile + mini carte --- */
.annonces-map-mobile-leaflet {
    display: none;
}
.annonces-map-mini {
    display: none;
}
.annonces-map-mini svg {
    width: 100%;
    height: auto;
    display: block;
}
.annonces-map-mini svg path {
    fill: var(--ex-stone-200, #e7e5e4);
    stroke: #fff;
    stroke-width: 1px;
    transition: fill .12s;
}
.annonces-map-mini svg path:not(.disabled) {
    fill: var(--ex-stone-900, #1c1917);
    cursor: pointer;
}
.annonces-map-mini svg path:not(.disabled):hover {
    fill: var(--ex-green-400, #ffbb09);
}
.annonces-map-mini svg path.active {
    fill: var(--ex-green-500, #f59e0b);
}

/* --- CTA mobile (en bas de page) --- */
.annonces-cta-mobile {
    display: none;
    text-align: center;
    padding: 1.5rem 1rem;
}
.annonces-cta-mobile p {
    font-size: .8rem;
    line-height: 1.5;
    color: var(--ex-stone-500, #78716c);
    margin: 0 0 .6rem;
}
.annonces-cta-mobile .annonces-cta {
    display: inline-block;
    padding: .6rem 1.5rem;
}

/* --- Pagination --- */
.annonces-pagination {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
    padding-bottom: 2rem;
}
.annonces-pagination a {
    padding: .4rem .8rem;
    border: 1px solid var(--ex-stone-300, #d6d3d1);
    border-radius: 6px;
    font-size: .85rem;
    text-decoration: none;
    color: var(--ex-stone-700, #44403c);
}
.annonces-pagination a:hover {
    border-color: var(--ex-green-400, #ffbb09);
    background: var(--ex-green-50, #fffbeb);
}

/* --- Responsive --- */

/* Cards compactes : thumb gauche, titre centre, infos dessous (jusqu'a 1600px) */
@media (max-width: 1600px) {
    .annonce-card {
        flex-wrap: wrap;
    }
    .annonce-img-wrap,
    .annonce-noimag {
        width: 80px;
        min-width: 80px;
        height: 70px;
        flex: 0 0 80px;
        order: 1 !important;
        border-bottom-right-radius: 8px;
    }
    .annonce-titre {
        flex: 1 1 0;
        min-width: 0;
        order: 2 !important;
        padding: .5rem .7rem;
        justify-content: center;
        text-align: center;
    }
    .annonce-infos {
        flex: 1 1 100%;
        order: 3 !important;
        border-left: none;
        border-right: none;
        border-top: none;
        background: var(--ex-stone-50, #fafaf9);
        flex-direction: row;
        flex-wrap: wrap;
        gap: .15rem .6rem;
        padding: .4rem .7rem;
        justify-content: center;
    }
}

/* 1601+ : 3 colonnes, Leaflet sort de la sidebar vers la droite */
@media (min-width: 1601px) {
    .annonces-layout {
        display: grid;
        grid-template-columns: 400px 1fr 38%;
        grid-template-rows: repeat(6, auto);
        gap: .6rem 1.5rem;
        align-items: start;
    }
    .annonces-sidebar {
        display: contents;
    }
    .ann-side-block {
        grid-column: 1;
        margin-bottom: 0;
    }
    .annonces-mapside {
        grid-column: 3;
        grid-row: 1 / -1;
        position: sticky;
        top: 1rem;
        margin-bottom: 0;
    }
    #annonces-leaflet {
        height: calc(100vh - 250px);
        min-height: 400px;
    }
    .annonces-center {
        grid-column: 2;
        grid-row: 1 / -1;
        min-width: 0;
    }
}

/* Colonne unique : sidebar empilee (jusqu'a 960px) */
@media (max-width: 960px) {
    #assoce.annonces-page {
        padding: .75rem .75rem 0;
    }
    .annonces-page > h1 {
        font-size: 1.2rem;
    }
    .annonces-layout {
        flex-direction: column;
        gap: .75rem;
    }
    .annonces-sidebar {
        flex: none;
        position: static;
        display: flex;
        flex-wrap: wrap;
        gap: .5rem;
    }
    .annonces-sidebar > .ann-side-block {
        flex: 1 1 100%;
        margin-bottom: 0;
    }
    .annonces-sidebar > .ann-side-block:has(.annonces-org-wrap),
    .annonces-sidebar > .ann-side-block:has(.annonces-org-active),
    .annonces-sidebar > .ann-side-reset {
        flex: 1 1 40%;
    }
    .annonces-map {
        max-width: 280px;
        margin: .5rem auto 0;
    }
    .annonces-page.has-geo .annonces-map {
        display: none;
    }
    .annonces-page.has-geo .annonces-map.show-svg {
        display: block;
    }
    .annonces-page.has-geo .annonces-map-mobile-leaflet {
        display: block;
        height: 250px;
        border-radius: 8px;
        border: 1px solid var(--ex-stone-200, #e7e5e4);
        margin-top: .5rem;
    }
    .annonces-page.has-geo .annonces-map-mobile-leaflet.hide-leaflet {
        display: none;
    }
    .annonces-page.has-geo .annonces-map-mini {
        display: block;
        width: 55px;
        flex-shrink: 0;
        cursor: pointer;
        opacity: .65;
        transition: opacity .15s;
    }
    .annonces-page.has-geo .annonces-map-mini:hover {
        opacity: 1;
    }
    .ann-side-cta {
        display: none;
    }
    .annonces-cta-mobile {
        display: block;
    }
    .annonces-center {
        width: 100%;
    }
    .annonces-mapside {
        display: none;
    }
    .annonces-list {
        min-width: 0;
        width: 100%;
    }
    .annonces-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Dark mode --- */
@media (prefers-color-scheme: dark) {
    .ann-side-block {
        background: var(--ex-stone-50);
        border-color: var(--ex-stone-200);
    }
    .ann-side-block select {
        background: var(--ex-stone-50);
        color: var(--ex-stone-700);
        border-color: var(--ex-stone-300);
    }
    .annonces-filters a {
        background: var(--ex-stone-50);
        border-color: var(--ex-stone-200);
        color: var(--ex-stone-600);
    }
    .annonces-filters a.active {
        background: var(--ex-green-600);
        border-color: var(--ex-green-600);
        color: #fff;
    }
    .annonces-cta {
        background: var(--ex-green-400);
        color: #1c1917;
    }
    .annonce-card {
        background: var(--ex-stone-50);
        border-color: var(--ex-stone-200);
    }
    .annonce-card:hover {
        border-color: var(--ex-stone-300);
    }
    .annonce-noimag {
        background: var(--ex-stone-100);
    }
    .annonce-infos {
        border-color: var(--ex-stone-200);
    }
    .annonces-search input {
        background: var(--ex-stone-50);
        color: var(--ex-stone-800);
        border-color: var(--ex-stone-300);
    }
    .annonces-pagination a {
        background: var(--ex-stone-50);
        color: var(--ex-stone-700);
        border-color: var(--ex-stone-300);
    }
    #annonces-leaflet {
        border-color: var(--ex-stone-200);
    }
    .annonces-map svg path {
        stroke: var(--ex-stone-50);
    }
}
