/* STG Alerte Mail — Frontend (modal + form) */

.stg-am-trigger-wrap { margin: 12px 0; }
.stg-am-trigger {
    display: inline-block;
    padding: 12px 24px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease;
}
.stg-am-trigger:hover { background: #135e96; }

/* Modal overlay */
.stg-am-modal {
    position: fixed; inset: 0;
    z-index: 99999;
    display: none;
    align-items: center; justify-content: center;
    padding: 16px;
}
.stg-am-modal.is-open {
    display: flex;
    animation: stg-am-fadein .18s ease;
}
@keyframes stg-am-fadein { from { opacity: 0; } to { opacity: 1; } }

.stg-am-modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.55);
}

.stg-am-modal-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0,0,0,.3);
    padding: 28px 28px 24px;
    font-family: inherit;
}

.stg-am-modal-close {
    position: absolute;
    top: 8px; right: 12px;
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    color: #888;
    cursor: pointer;
}
.stg-am-modal-close:hover { color: #222; }

.stg-am-modal-card h3 {
    margin: 0 0 12px;
    font-size: 20px;
    color: #222;
}
.stg-am-intro {
    margin: 0 0 16px;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}

.stg-am-filters-summary {
    background: #f6f7f8;
    border-left: 3px solid #2271b1;
    padding: 10px 14px;
    margin: 0 0 18px;
    font-size: 13px;
    border-radius: 0 4px 4px 0;
}
.stg-am-filters-summary ul { margin: 6px 0 0 18px; padding: 0; }
.stg-am-filters-summary li { margin: 2px 0; }

.stg-am-row { display: flex; gap: 10px; margin-bottom: 12px; }
.stg-am-row > label { flex: 1; }
.stg-am-block { display: block; margin-bottom: 12px; }

/* Fieldset filtres */
.stg-am-filters-fieldset {
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 12px 14px 14px;
    margin: 0 0 16px;
    background: #fafbfc;
}
.stg-am-filters-fieldset legend {
    font-size: 12px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 0 6px;
}

/* Groupe label + pills */
.stg-am-filter-group {
    margin: 0 0 14px;
}
.stg-am-filter-group:last-child {
    margin-bottom: 0;
}
.stg-am-filter-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

/* Conteneur pills (wrap automatique) */
.stg-am-pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Pill = label cliquable contenant un checkbox visuellement masqué */
.stg-am-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    background: #fff;
    color: #444;
    border: 1px solid #d8dde3;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
    user-select: none;
    transition: all .15s ease;
}
.stg-am-pill:hover {
    background: #f4f5f7;
    border-color: #b8c0ca;
}
/* Le checkbox est masqué visuellement mais reste accessible (focus / a11y) */
.stg-am-pill input[type=checkbox] {
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
    pointer-events: none;
}
/* État coché — via classe (toggle JS) ET via :has() (progressive enhancement) */
.stg-am-pill.is-checked,
.stg-am-pill:has(input:checked) {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
    font-weight: 600;
}
.stg-am-pill.is-checked:hover,
.stg-am-pill:has(input:checked):hover {
    background: #135e96;
    border-color: #135e96;
}
/* Focus visible (accessibilité clavier) */
.stg-am-pill:focus-within {
    outline: 2px solid rgba(34,113,177,.35);
    outline-offset: 2px;
}

.stg-am-filters-help {
    margin: 10px 0 0;
    font-size: 11px;
    color: #888;
    font-style: italic;
}

@media (max-width: 480px) {
    /* Padding mobile uniquement : on laisse l'admin contrôler la taille
     * via Typography Elementor sans qu'un override mobile s'impose. */
    .stg-am-pill { padding: 8px 12px; }
}

.stg-am-form label > span {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}
.stg-am-form input[type=text],
.stg-am-form input[type=email] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}
.stg-am-form input[type=text]:focus,
.stg-am-form input[type=email]:focus {
    border-color: #2271b1;
    outline: 2px solid rgba(34,113,177,.2);
    outline-offset: 0;
}

.stg-am-consent {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 14px 0 18px;
    font-size: 12px;
    color: #555;
    line-height: 1.4;
    cursor: pointer;
}
.stg-am-consent input { margin-top: 3px; }

.stg-am-submit {
    width: 100%;
    padding: 12px 18px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease;
}
.stg-am-submit:hover    { background: #135e96; }
.stg-am-submit:disabled { background: #999; cursor: wait; }

.stg-am-feedback {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 13px;
    display: none;
}
.stg-am-feedback.is-success { display: block; background: #ecf7ed; color: #1a6e21; border: 1px solid #c6e8c9; }
.stg-am-feedback.is-error   { display: block; background: #fdecea; color: #a02a2a; border: 1px solid #f5c6c6; }

@media (max-width: 480px) {
    .stg-am-row { flex-direction: column; gap: 0; }
    .stg-am-modal-card { padding: 20px; }
    .stg-am-modal-card h3 { font-size: 18px; }
}
