/**
 * RNF Live Search v5.1 — Front CSS (complément)
 *
 * Ce fichier complète le CSS inline existant (header Astra) avec :
 *  - Effet fade du placeholder dynamique
 *  - Mode mobile collapsible (icône → barre déployée)
 *  - États supplémentaires du dropdown (vide, suggestion typo, loading)
 *  - Compatibilité avec les classes rnf-lsa__* existantes
 *
 * Si tu retires un jour ton CSS inline, ce fichier reste autonome.
 */

:root {
    --rf-rose: #8B2252;
    --rf-rose-light: #C1526E;
    --rf-rose-bg: rgba(139, 34, 82, .06);
    --rf-nude: #F9F1EE;
    --rf-ink: #2d2d2d;
    --rf-muted: #888;
    --rf-ease: cubic-bezier(.4, 0, .2, 1);
}

/* ═══════════════════════════════════════════
 * Bouton clear — visibilité contrôlée par JS
 * ═══════════════════════════════════════════ */
.rnf-lsa__clear.is-visible {
    visibility: visible;
    opacity: 1;
}

/* ═══════════════════════════════════════════
 * Placeholder fade (cycle de phrases)
 * ═══════════════════════════════════════════ */
.rnf-lsa__input::placeholder {
    transition: opacity .22s var(--rf-ease);
    opacity: 1;
}
.rnf-lsa__input--ph-fade::placeholder {
    opacity: 0;
}

/* ═══════════════════════════════════════════
 * Mode mobile collapsible
 * ═══════════════════════════════════════════ */

/* Trigger : caché par défaut sur desktop, visible sur mobile */
.rnf-lsa__mobile-trigger {
    display: none;
    width: 40px;
    height: 40px;
    margin: 0 auto;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: var(--rf-rose-bg);
    color: var(--rf-rose);
    cursor: pointer;
    transition: background .2s, transform .15s;
}
.rnf-lsa__mobile-trigger:hover {
    background: var(--rf-rose);
    color: #fff;
}
.rnf-lsa__mobile-trigger:active {
    transform: scale(.94);
}

@media (max-width: 768px) {
    /* Mode collapsible activé */
    .rnf-lsa-v3[data-mobile-collapse="1"] .rnf-lsa__mobile-trigger {
        display: flex;
    }

    /* Form caché par défaut */
    .rnf-lsa-v3[data-mobile-collapse="1"] .rnf-lsa__form {
        display: none;
    }

    /* ═══ Trigger : SVG forcé en blanc ═══ */
    .rnf-lsa-v3[data-mobile-collapse="1"] .rnf-lsa__mobile-trigger,
    .rnf-lsa-v3[data-mobile-collapse="1"] .rnf-lsa__mobile-trigger:hover,
    .rnf-lsa-v3[data-mobile-collapse="1"] .rnf-lsa__mobile-trigger:focus {
        background: transparent !important;
        color: #fff !important;
    }
    .rnf-lsa-v3[data-mobile-collapse="1"] .rnf-lsa__mobile-trigger svg {
        stroke: #fff !important;
    }

    /* ═══ Barre ouverte ═══
     * Z-index : .rnf-topbar = 9999 → on passe au-dessus avec 10000
     * top dynamique : calculé en JS via --rnf-notice-bar-height
     */
    .rnf-lsa-v3[data-mobile-collapse="1"].rnf-lsa--mobile-open .rnf-lsa__form {
        display: flex;
        position: fixed !important;
        top: var(--rnf-notice-bar-height, 0px) !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 14px 16px !important;
        z-index: 10000 !important;
        background: var(--rf-rose) !important;
        box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
        animation: rnf-lsa-slide-down .25s var(--rf-ease);
    }

    /* Le champ prend 100% de l'espace dispo */
    .rnf-lsa-v3[data-mobile-collapse="1"].rnf-lsa--mobile-open .rnf-lsa__field {
        width: 100% !important;
        max-width: none !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        gap: 10px;
    }

    /* Input pleine largeur */
    .rnf-lsa-v3[data-mobile-collapse="1"].rnf-lsa--mobile-open .rnf-lsa__input-wrap {
        flex: 1;
        width: 100%;
    }
    .rnf-lsa-v3[data-mobile-collapse="1"].rnf-lsa--mobile-open .rnf-lsa__input {
        width: 100% !important;
        margin-bottom: 0 !important;
    }

    /* Rosy plus petit dans la barre mobile */
    .rnf-lsa-v3[data-mobile-collapse="1"].rnf-lsa--mobile-open .rnf-lsa__rosy {
        height: 38px !important;
        flex-shrink: 0;
    }

    /* Croix de fermeture : par-dessus la barre */
    .rnf-lsa-v3[data-mobile-collapse="1"].rnf-lsa--mobile-open .rnf-lsa__mobile-trigger {
        position: fixed !important;
        top: calc(var(--rnf-notice-bar-height, 0px) + 18px) !important;
        right: 14px !important;
        z-index: 10001 !important;
        background: rgba(255, 255, 255, .2) !important;
        color: #fff !important;
    }

    /* Dropdown des résultats : juste sous la barre */
    .rnf-lsa-v3[data-mobile-collapse="1"].rnf-lsa--mobile-open .rnf-lsa__dropdown {
        position: fixed !important;
        top: calc(var(--rnf-notice-bar-height, 0px) + 72px) !important;
        left: 8px !important;
        right: 8px !important;
        max-height: calc(100vh - 90px) !important;
        z-index: 10000 !important;
    }

    /* Bloquer le scroll body */
    body.rnf-lsa-mobile-active {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }

    /* Icône loupe via CSS (remplacement SVG inline) */
    body .rnf-lsa-v3 .rnf-lsa__mobile-trigger svg {
        display: none !important;
    }
    body .rnf-lsa-v3 .rnf-lsa__mobile-trigger::before {
        content: "" !important;
        display: inline-block !important;
        width: 22px !important;
        height: 22px !important;
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") !important;
        background-repeat: no-repeat !important;
        background-position: center center !important;
        background-size: 22px 22px !important;
        flex-shrink: 0 !important;
    }
}

@keyframes rnf-lsa-slide-down {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
@keyframes rnf-lsa-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ═══════════════════════════════════════════
 * Dropdown — états supplémentaires
 * ═══════════════════════════════════════════ */

/* Loading */
.rnf-lsa__dd-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    color: var(--rf-muted);
    font-size: 14px;
}
.rnf-lsa__dd-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--rf-rose-bg);
    border-top-color: var(--rf-rose);
    border-radius: 50%;
    animation: rnf-lsa-spin .7s linear infinite;
}
@keyframes rnf-lsa-spin {
    to { transform: rotate(360deg); }
}

/* "Vouliez-vous dire ?" */
.rnf-lsa__dd-suggestion {
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--rf-nude) 0%, #fff 100%);
    border-bottom: 1px solid rgba(139, 34, 82, .08);
    font-size: 14px;
    color: var(--rf-ink);
}
.rnf-lsa__dd-rosy-emoji { margin-right: 4px; }
.rnf-lsa__dd-suggestion-link {
    background: none;
    border: 0;
    color: var(--rf-rose);
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.rnf-lsa__dd-suggestion-link:hover { color: var(--rf-rose-light); }

/* État vide */
.rnf-lsa__dd-empty {
    padding: 24px 20px;
    text-align: center;
}
.rnf-lsa__dd-empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: .6;
}
.rnf-lsa__dd-empty-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--rf-ink);
    margin: 0 0 4px;
}
.rnf-lsa__dd-empty-text {
    font-size: 13px;
    color: var(--rf-muted);
    margin: 0 0 16px;
}
.rnf-lsa__dd-empty-cats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.rnf-lsa__dd-empty-cat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    background: var(--rf-nude);
    border-radius: 8px;
    text-decoration: none;
    color: var(--rf-ink);
    transition: transform .15s, background .15s, box-shadow .15s;
    font-size: 12px;
}
.rnf-lsa__dd-empty-cat:hover {
    transform: translateY(-2px);
    background: #fff;
    color: var(--rf-rose);
    box-shadow: 0 2px 8px rgba(139, 34, 82, .1);
}
.rnf-lsa__dd-empty-cat img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 50%;
}
.rnf-lsa__dd-empty-cat span {
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
}