/* AV HelloAsso — front. Couleurs et arrondis injectés via --avha-* (réglages). */

.avha-grid,
.avha-modal,
.avha-actions {
    --avha-border: rgba(0, 0, 0, .08);
    --avha-muted: rgba(0, 0, 0, .6);
    --avha-surface: #fff;
}

/* ── Grille ─────────────────────────────────────────────────────────────── */

.avha-grid {
    display: grid;
    grid-template-columns: repeat(var(--avha-cols, 3), minmax(0, 1fr));
    gap: 24px;
    margin: 1.5em 0;
}
.avha-grid--single { grid-template-columns: minmax(0, 420px); }

@media (max-width: 960px) { .avha-grid { grid-template-columns: repeat(min(var(--avha-cols, 3), 2), minmax(0, 1fr)); } }
@media (max-width: 600px) { .avha-grid, .avha-grid--single { grid-template-columns: minmax(0, 1fr); } }

/* ── Carte ──────────────────────────────────────────────────────────────── */

.avha-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--avha-surface);
    border: 1px solid var(--avha-border);
    border-radius: var(--avha-radius, 12px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
    transition: transform .2s ease, box-shadow .2s ease;
}
.avha-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .05), 0 14px 32px rgba(0, 0, 0, .1);
}

.avha-card__media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: color-mix(in srgb, var(--avha-primary, #4c40cf) 12%, #fff);
}
.avha-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avha-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--avha-primary, #4c40cf);
    background: rgba(255, 255, 255, .92);
    border-radius: 999px;
    backdrop-filter: blur(4px);
}

.avha-card__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    padding: 18px 20px 20px;
}
.avha-card__title {
    margin: 0;
    font-size: 1.15em;
    line-height: 1.3;
}
.avha-card__meta {
    margin: 0;
    font-size: .9em;
    font-weight: 600;
    color: var(--avha-primary, #4c40cf);
}
.avha-card__excerpt {
    margin: 0;
    font-size: .92em;
    line-height: 1.5;
    color: var(--avha-muted);
}
.avha-card__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding-top: 12px;
}
.avha-card__price { font-weight: 700; }

/* ── Alignement du bouton (avha-align-*) ────────────────────────────────── */

.avha-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 1em 0; }

.avha-align-left   { justify-content: flex-start; }
.avha-align-center { justify-content: center; }
.avha-align-right  { justify-content: flex-end; }
.avha-align-full .avha-btn { flex: 1 1 100%; }

/* Carte : le prix reste à gauche, le bouton suit l'alignement. */
.avha-card__footer.avha-align-right .avha-btn  { margin-left: auto; }
.avha-card__footer.avha-align-center           { flex-direction: column; }

/* ── Bouton ─────────────────────────────────────────────────────────────── */

.avha-btn,
.avha-btn:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--avha-btn-pad, .7em 1.4em);
    font-size: var(--avha-btn-fs, 1em);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: var(--avha-btn-ls, normal);
    text-transform: var(--avha-btn-tt, none);
    text-decoration: none;
    text-align: center;
    color: var(--avha-btn-color, #fff);
    background: var(--avha-btn-bg, #4c40cf);
    border: 2px solid var(--avha-btn-border, #4c40cf);
    border-radius: var(--avha-btn-radius, 9px);
    box-shadow: var(--avha-btn-shadow, none);
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, filter .15s ease, transform .15s ease, box-shadow .15s ease;
}
.avha-btn:hover,
.avha-btn:focus-visible {
    color: var(--avha-btn-hover-color, #fff);
    background: var(--avha-btn-hover-bg, #4c40cf);
    border-color: var(--avha-btn-hover-bg, #4c40cf);
    filter: var(--avha-btn-hover-filter, brightness(1.08));
    transform: translateY(-1px);
}
.avha-btn:focus-visible { outline: 2px solid var(--avha-btn-border, #4c40cf); outline-offset: 2px; }

/* ── Formulaire intégré ─────────────────────────────────────────────────── */

.avha-form { margin: 1.5em 0; }

.avha-iframe {
    display: block;
    width: 100%;
    height: 750px; /* avant le premier message de hauteur */
    border: 0;
    background: transparent;
    transition: height .25s ease;
}

/* ── Modale ─────────────────────────────────────────────────────────────── */

html:has(.avha-modal[open]) { overflow: hidden; }

.avha-modal {
    width: min(760px, calc(100vw - 32px));
    max-height: calc(100dvh - 48px);
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: var(--avha-radius, 12px);
    background: var(--avha-surface);
    box-shadow: 0 24px 64px rgba(0, 0, 0, .3);
}
.avha-modal[open] { display: flex; flex-direction: column; }
.avha-modal::backdrop { background: rgba(15, 15, 30, .55); backdrop-filter: blur(2px); }

.avha-modal__header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px 14px 24px;
    border-bottom: 1px solid var(--avha-border);
}
.avha-modal__title {
    flex: 1;
    margin: 0;
    font-size: 1.1em;
    line-height: 1.3;
}
.avha-modal__close {
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 28px;
    line-height: 1;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}
.avha-modal__close:hover { background: rgba(0, 0, 0, .06); }

/* Un seul ascenseur : celui de la modale, l'iframe prend toute sa hauteur. */
.avha-modal__body {
    flex: 1 1 auto;
    min-height: 0; /* sans ça le corps ne rétrécit pas et la modale coupe le bas */
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 600px) {
    .avha-modal {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }
}

.avha-notice { font-style: italic; color: var(--avha-muted, rgba(0, 0, 0, .6)); }
