/* =========================================================================
   PETITES ANNONCES — front public.
   Thème agrikole : racine 10px → TOUT en px (jamais rem). body_class non
   fiable → scope strict .apaba-annonces. Continuité visuelle avec les
   modules ressources-techniques / actualités (tokens --aa, cartes 16px,
   ombres vertes douces). Aucune lib tierce.
   ========================================================================= */

.apaba-annonces {
    --aa: #1A8781;
    --aa-dark: #12655f;
    --aa-soft: #eaf5f4;
    --aa-soft2: #f5faf9;
    --aa-ink: #1f3b34;
    --aa-body: #353b41;
    --aa-muted: #8a929a;
    --aa-line: #e8e6df;
    --aa-free: #2f8f3e;
    --aa-warn-bg: #fdf3e3;
    --aa-warn-bd: #e7c98a;
    --aa-err: #b3261e;

    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 16px 56px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--aa-body);
    font-size: 16px;
    line-height: 1.55;
}

.apaba-annonces *,
.apaba-annonces *::before,
.apaba-annonces *::after {
    box-sizing: border-box;
}

/* Bandeau-titre générique du thème masqué sur nos pages uniquement */
body:has(.apaba-annonces) #featured-title {
    display: none !important;
}

body:has(.apaba-annonces) #main-content {
    padding-top: 0;
}

.apaba-annonces .aa-an-h2 {
    font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
    font-size: 30px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--aa-ink);
    margin: 0 0 14px;
}

.apaba-annonces .aa-an-lead {
    font-size: 16px;
    color: var(--aa-body);
    margin: 0 0 22px;
}

/* ---- En-tête liste --------------------------------------------------- */
.apaba-annonces .aa-an-listhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 18px;
}

/* ---- Barre d'outils : recherche + dépôt + rubriques ------------------ */
.apaba-annonces .aa-an-toolbar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 26px;
}

/* Ligne 1 : recherche (gauche, courte) + bouton Déposer (droite) */
.apaba-annonces .aa-an-toolbar__top {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.apaba-annonces .aa-an-search {
    flex: 0 1 360px;
    max-width: 360px;
    min-width: 200px;
}

/* Le label lecteur-d'écran ne doit JAMAIS occuper de hauteur (sinon la
   croix, calée sur la boîte, tombe trop bas). Masquage scopé, indépendant
   du thème. La croix se cale sur .aa-an-search__box (= hauteur input). */
.apaba-annonces .aa-an-search label {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.apaba-annonces .aa-an-search__box {
    position: relative;
}

.apaba-annonces .aa-an-deposit {
    margin-left: auto;
}

.apaba-annonces .aa-an-search input {
    width: 100%;
    height: 46px;
    padding: 0 42px 0 16px;
    font-size: 15px;
    border: 1px solid var(--aa-line);
    border-radius: 10px;
    background: #fff;
    color: var(--aa-body);
}

/* Bouton X : visible seulement quand l'input a du contenu (attr [hidden]
   retiré par le JS). Cible tactile 28px, scopé. */
.apaba-annonces .aa-an-search__clear {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--aa-soft);
    color: var(--aa-dark);
    cursor: pointer;
}

.apaba-annonces .aa-an-search__clear[hidden] {
    display: none;
}

.apaba-annonces .aa-an-search__clear svg {
    width: 14px;
    height: 14px;
}

.apaba-annonces .aa-an-search__clear:hover {
    background: var(--aa);
    color: #fff;
}

.apaba-annonces .aa-an-search input:focus-visible,
.apaba-annonces .aa-an-form input:focus-visible,
.apaba-annonces .aa-an-form select:focus-visible,
.apaba-annonces .aa-an-form textarea:focus-visible {
    outline: 3px solid rgba(26, 135, 129, .35);
    outline-offset: 1px;
    border-color: var(--aa);
}

.apaba-annonces .aa-an-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.apaba-annonces .aa-an-fil {
    border: 1px solid var(--aa-line);
    background: #fff;
    color: var(--aa-body);
    font-size: 14px;
    font-weight: 600;
    padding: 9px 16px;
    min-height: 40px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.apaba-annonces .aa-an-fil:hover {
    border-color: var(--aa);
    color: var(--aa-dark);
}

.apaba-annonces .aa-an-fil.active {
    background: var(--aa);
    border-color: var(--aa);
    color: #fff;
}

/* ---- Grille de cartes ------------------------------------------------ */
/* Grille CSS = ordre chronologique PAR LIGNE (gauche→droite, placement
   auto row-major). align-items:start → pas d'étirement. La classe
   .is-masonry (ajoutée par le JS) active le tassage vertical : chaque
   carte = N lignes de 8px, la carte courte laisse remonter la suivante.
   Sans JS → grille classique propre (fallback gracieux). */
.apaba-annonces .aa-an-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    column-gap: 24px;
    row-gap: 24px;
    align-items: start;
}

.apaba-annonces .aa-an-grid.is-masonry {
    grid-auto-rows: 8px;
}

.apaba-annonces .aa-an-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--aa-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 6px 22px rgba(20, 40, 30, .06);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}

.apaba-annonces .aa-an-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(20, 40, 30, .12);
}

.apaba-annonces .aa-an-card.is-expired {
    opacity: .72;
}

.apaba-annonces .aa-an-card__thumb {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    background: var(--aa-soft);
}

.apaba-annonces .aa-an-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Pastille « Terminée » : inline (fonctionne avec OU sans photo, sur la
   carte comme sur le single). N'est plus posée en absolute sur l'image. */
.apaba-annonces .aa-an-tag-expired {
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--aa-muted);
    color: #fff;
}

.apaba-annonces .aa-an-card__body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Carte sans photo : pas de cadre/placeholder, un peu plus d'air en haut. */
.apaba-annonces .aa-an-card.has-no-photo .aa-an-card__body {
    padding-top: 16px;
}

.apaba-annonces .aa-an-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.apaba-annonces .aa-an-badge {
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--aa-soft);
    color: var(--aa-dark);
}

.apaba-annonces .aa-an-price {
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--aa);
    color: #fff;
}

.apaba-annonces .aa-an-price--gratuit {
    background: var(--aa-free);
}

.apaba-annonces .aa-an-price--debattre {
    background: #fff;
    color: var(--aa-body);
    border: 1px solid var(--aa-line);
}

.apaba-annonces .aa-an-card__title {
    font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
    font-size: 19px;
    line-height: 1.3;
    font-weight: 700;
    margin: 2px 0 0;
}

.apaba-annonces .aa-an-card__title a {
    color: var(--aa-dark);
    text-decoration: none;
}

.apaba-annonces .aa-an-card__title a::after {
    content: "";
    position: absolute;
    inset: 0;
}

.apaba-annonces .aa-an-card:hover .aa-an-card__title a {
    color: var(--aa);
}

.apaba-annonces .aa-an-card__excerpt {
    font-size: 14px;
    color: var(--aa-body);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.apaba-annonces .aa-an-card__meta {
    margin-top: 4px;
    padding-top: 6px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    color: var(--aa-muted);
}

.apaba-annonces .aa-an-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--aa-muted);
    font-size: 16px;
    padding: 48px 16px;
}

/* ---- Pagination ------------------------------------------------------ */
.apaba-annonces .aa-an-pagination {
    margin-top: 32px;
}

.apaba-annonces .aa-an-pagination ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.apaba-annonces .aa-an-pagination a,
.apaba-annonces .aa-an-pagination span {
    display: inline-block;
    min-width: 40px;
    padding: 9px 12px;
    text-align: center;
    border: 1px solid var(--aa-line);
    border-radius: 8px;
    text-decoration: none;
    color: var(--aa-body);
    font-size: 14px;
}

.apaba-annonces .aa-an-pagination .current {
    background: var(--aa);
    border-color: var(--aa);
    color: #fff;
}

/* ---- Boutons --------------------------------------------------------- */
.apaba-annonces .aa-an-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 11px 22px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: filter .15s, background .15s;
}

.apaba-annonces .aa-an-btn--primary {
    background: var(--aa);
    color: #fff;
}

.apaba-annonces .aa-an-btn--primary:hover {
    filter: brightness(.94);
}

.apaba-annonces .aa-an-btn--secondary {
    background: #fff;
    color: var(--aa-dark);
    border-color: var(--aa-line);
}

.apaba-annonces .aa-an-btn--secondary:hover {
    border-color: var(--aa);
}

.apaba-annonces .aa-an-btn--danger {
    background: #fff;
    color: var(--aa-err);
    border-color: #e7bdbb;
}

.apaba-annonces .aa-an-btn--danger:hover {
    background: #fdeceb;
}

.apaba-annonces .aa-an-btn--block {
    display: flex;
    width: 100%;
}

/* ---- Formulaire ------------------------------------------------------ */
.apaba-annonces .aa-an-formwrap {
    max-width: 720px;
    margin: 0 auto;
}

.apaba-annonces .aa-an-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Écran « recevoir / retrouver mon lien » : bloc étroit + centré
   (titre + bandeau + formulaire alignés à la même largeur). */
.apaba-annonces .aa-an-reqwrap {
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
}

.apaba-annonces .aa-an-reqwrap .aa-an-form {
    text-align: left;
}

.apaba-annonces .aa-an-reqform {
    max-width: 480px;
}

.apaba-annonces .aa-an-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.apaba-annonces .aa-an-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.apaba-annonces .aa-an-field__label {
    font-size: 14px;
    font-weight: 700;
    color: var(--aa-ink);
}

.apaba-annonces .aa-an-field__hint {
    font-size: 12px;
    color: var(--aa-muted);
    font-weight: 400;
}

.apaba-annonces .aa-an-form input[type="text"],
.apaba-annonces .aa-an-form input[type="email"],
.apaba-annonces .aa-an-form input[type="tel"],
.apaba-annonces .aa-an-form input[type="date"],
.apaba-annonces .aa-an-form input[type="search"],
.apaba-annonces .aa-an-form select,
.apaba-annonces .aa-an-form textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    color: var(--aa-body);
    background: #fff;
    border: 1px solid var(--aa-line);
    border-radius: 10px;
}

.apaba-annonces .aa-an-form input[readonly] {
    background: var(--aa-soft2);
    color: var(--aa-muted);
}

.apaba-annonces .aa-an-form textarea {
    resize: vertical;
    min-height: 140px;
}

/* Prix : tout sur UNE ligne — choix à gauche, montant (étroit) + €
   poussés à droite. Repli en colonne sur petit écran. */
.apaba-annonces .aa-an-price-fs {
    border: 1px solid var(--aa-line);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    /* la classe .aa-an-field force column → on remet explicitement row */
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
}

.apaba-annonces .aa-an-price-fs legend {
    padding: 0 6px;
}

.apaba-annonces .aa-an-price-types {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.apaba-annonces .aa-an-radio {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    cursor: pointer;
}

.apaba-annonces .aa-an-price-amount {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.apaba-annonces .aa-an-price-amount.is-hidden {
    display: none;
}

/* [type=text] pour battre la règle générique .aa-an-form input[type="text"]
   (sinon width:100%). Champ étroit, c'est un prix. */
.apaba-annonces .aa-an-price-amount input[type="text"] {
    width: 110px;
    text-align: right;
}

.apaba-annonces .aa-an-price-unit {
    font-size: 15px;
    font-weight: 700;
    color: var(--aa-ink);
}

/* Case à cocher « Contact par téléphone uniquement » */
.apaba-annonces .aa-an-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 14px;
    color: var(--aa-body);
    cursor: pointer;
}

.apaba-annonces .aa-an-required {
    border-color: var(--aa) !important;
}

/* Coordonnées révélées (anti-robots) */
.apaba-annonces .aa-an-reveal__out {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.apaba-annonces .aa-an-contact__line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--aa-dark);
    text-decoration: none;
    word-break: break-word;
}

.apaba-annonces .aa-an-contact__line:hover {
    text-decoration: underline;
}

.apaba-annonces .aa-an-contact__ic {
    font-size: 18px;
}

.apaba-annonces .aa-an-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.apaba-annonces .aa-an-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.apaba-annonces .aa-an-thumb {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    cursor: pointer;
}

.apaba-annonces .aa-an-thumb img {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--aa-line);
}

.apaba-annonces .aa-an-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---- Alertes / messages --------------------------------------------- */
.apaba-annonces .aa-an-msg,
.apaba-annonces .aa-an-alert {
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 15px;
}

.apaba-annonces .aa-an-msg.is-ok,
.apaba-annonces .aa-an-alert--ok {
    background: var(--aa-soft);
    color: var(--aa-dark);
}

.apaba-annonces .aa-an-msg.is-err,
.apaba-annonces .aa-an-alert--error {
    background: #fdeceb;
    color: var(--aa-err);
}

.apaba-annonces .aa-an-alert--info {
    background: var(--aa-soft2);
    color: var(--aa-body);
    border: 1px solid var(--aa-line);
}

.apaba-annonces .aa-an-alert--warn {
    background: var(--aa-warn-bg);
    border: 1px solid var(--aa-warn-bd);
    color: #7a5b1e;
    margin-bottom: 20px;
}

/* ---- Plateforme de gestion ------------------------------------------ */
.apaba-annonces .aa-an-manage-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.apaba-annonces .aa-an-mlist {
    list-style: none;
    margin: 18px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.apaba-annonces .aa-an-mitem {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--aa-line);
    border-radius: 12px;
    background: #fff;
    padding: 14px 16px;
}

.apaba-annonces .aa-an-mitem.is-expired {
    background: var(--aa-soft2);
}

.apaba-annonces .aa-an-mitem__main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.apaba-annonces .aa-an-mitem__status {
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    background: var(--aa);
    padding: 5px 10px;
    border-radius: 999px;
}

.apaba-annonces .aa-an-mitem.is-expired .aa-an-mitem__status {
    background: var(--aa-muted);
}

.apaba-annonces .aa-an-mitem__title {
    font-weight: 700;
    color: var(--aa-dark);
    text-decoration: none;
    font-size: 16px;
}

.apaba-annonces .aa-an-mitem__date {
    font-size: 13px;
    color: var(--aa-muted);
}

.apaba-annonces .aa-an-mitem__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.apaba-annonces .aa-an-mitem__actions .aa-an-btn {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 13px;
}

/* ---- Single ---------------------------------------------------------- */
.apaba-annonces .aa-an-single__head {
    margin: 8px 0 22px;
}

.apaba-annonces .aa-an-single__title {
    font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
    font-size: 32px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--aa-ink);
    margin: 12px 0 10px;
}

.apaba-annonces .aa-an-single__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
    color: var(--aa-muted);
}

.apaba-annonces .aa-an-single__grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
    align-items: start;
}

.apaba-annonces .aa-an-photo {
    display: block;
    border-radius: 12px;
    overflow: hidden;
}

.apaba-annonces .aa-an-photo img,
.apaba-annonces .aa-an-mainphoto {
    width: 100%;
    display: block;
    border-radius: 12px;
}

/* Photos placées sous le texte → séparation visuelle du texte. */
.apaba-annonces .aa-an-photos {
    margin-top: 28px;
}

.apaba-annonces .aa-an-photos .aa-an-thumbs {
    margin-top: 12px;
}

.apaba-annonces .aa-an-photos .aa-an-thumbs .aa-an-photo {
    width: 96px;
    height: 96px;
}

.apaba-annonces .aa-an-photos .aa-an-thumbs .aa-an-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.apaba-annonces .aa-an-single__desc {
    margin-top: 24px;
    font-size: 16px;
    line-height: 1.7;
    color: var(--aa-body);
}

.apaba-annonces .aa-an-contact,
.apaba-annonces .aa-an-owner {
    border: 1px solid var(--aa-line);
    border-radius: 14px;
    background: #fff;
    padding: 20px;
    box-shadow: 0 6px 22px rgba(20, 40, 30, .06);
}

.apaba-annonces .aa-an-owner {
    margin-top: 16px;
    box-shadow: none;
    background: var(--aa-soft2);
}

.apaba-annonces .aa-an-contact__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--aa-ink);
    margin: 0 0 12px;
}

.apaba-annonces .aa-an-contact__price {
    font-size: 22px;
    font-weight: 800;
    color: var(--aa-dark);
    margin: 0 0 8px;
}

.apaba-annonces .aa-an-contact__loc {
    margin: 0 0 14px;
    color: var(--aa-body);
}

.apaba-annonces .aa-an-contact__hint,
.apaba-annonces .aa-an-owner__hint {
    font-size: 13px;
    color: var(--aa-muted);
    margin: 0 0 12px;
}

.apaba-annonces .aa-an-backrow {
    margin: 0 0 12px;
    text-align: right;
}

.apaba-annonces .aa-an-link-back {
    color: var(--aa-dark);
    font-weight: 600;
    text-decoration: none;
}

/* ---- Lightbox -------------------------------------------------------- */
#apaba-lightbox.aa-an-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(15, 25, 22, .92);
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#apaba-lightbox.aa-an-lightbox img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 8px;
}

#apaba-lightbox.aa-an-lightbox button {
    position: absolute;
    top: 18px;
    right: 22px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

/* ---- Responsive ------------------------------------------------------ */
@media (max-width: 860px) {

    .apaba-annonces .aa-an-single__grid,
    .apaba-annonces .aa-an-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .apaba-annonces {
        padding: 18px 12px 42px;
    }

    .apaba-annonces .aa-an-h2 {
        font-size: 25px;
    }

    .apaba-annonces .aa-an-search {
        flex: 1 1 100%;
        max-width: none;
    }

    .apaba-annonces .aa-an-deposit {
        margin-left: 0;
        width: 100%;
    }
}
