/* ==========================================================================
   cf-consent.css — Pop-up cookies CloudForge (site, portail, blog)
   Carte légère en bas à gauche, croix de fermeture, réglages dans la carte.
   En bas à droite se trouvent déjà le chatbot et le bouton « haut de page » :
   sur mobile, la carte prend toute la largeur et les remonte (margin-bottom).
   Sous les modales Bootstrap : la carte se masque tant qu'une modale est ouverte (JS).
   ========================================================================== */

.cf-consent {
    --cfc-violet: #7C3AED;
    --cfc-violet-hover: #6D28D9;
    --cfc-ink: #1F1B2D;
    --cfc-muted: #6B6780;
    --cfc-border: #E6E2F0;
    --cfc-soft: #F4F2FA;

    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 9997; /* sous le chatbot (9999) et le bouton haut de page (9998) */
    width: min(340px, calc(100vw - 48px));
    box-sizing: border-box;
    padding: 14px 16px 12px;
    background: #FFFFFF;
    color: var(--cfc-ink);
    border: 1px solid var(--cfc-border);
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(31, 27, 45, .08);
    font-size: 13px;
    line-height: 1.45;
    text-align: left;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .22s ease, transform .22s ease;
}

.cf-consent *,
.cf-consent *::before,
.cf-consent *::after { box-sizing: border-box; }

.cf-consent[hidden] { display: none !important; }

.cf-consent.cf-consent--visible {
    opacity: 1;
    transform: none;
}

/* Une modale (onboarding, réglages du compte...) est ouverte : on s'efface. */
.cf-consent.cf-consent--suspended {
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
}

.cf-consent__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 2px;
    background: transparent;
    color: var(--cfc-muted);
    cursor: pointer;
}

.cf-consent__close:hover { background: var(--cfc-soft); color: var(--cfc-ink); }
.cf-consent__close:focus-visible,
.cf-consent__btn:focus-visible,
.cf-consent__link:focus-visible,
.cf-consent__switch input:focus-visible + span {
    outline: 2px solid var(--cfc-violet);
    outline-offset: 2px;
}

.cf-consent__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 28px 4px 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--cfc-ink);
}

.cf-consent__text {
    margin: 0 0 12px;
    color: var(--cfc-muted);
}

.cf-consent__text a {
    color: var(--cfc-violet);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cf-consent__actions {
    display: flex;
    gap: 8px;
}

.cf-consent__btn {
    flex: 1 1 0;
    min-height: 30px;
    padding: 5px 10px;
    border-radius: 3px;
    border: 1px solid var(--cfc-border);
    background: #FFFFFF;
    color: var(--cfc-ink);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

.cf-consent__btn:hover { background: var(--cfc-soft); }

.cf-consent__btn--primary {
    border-color: var(--cfc-violet);
    background: var(--cfc-violet);
    color: #FFFFFF;
}

.cf-consent__btn--primary:hover { background: var(--cfc-violet-hover); border-color: var(--cfc-violet-hover); }

.cf-consent__link {
    display: inline-block;
    margin-top: 8px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--cfc-violet);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.cf-consent__link:hover { text-decoration: underline; }

/* ── Réglages (dans la carte) ─────────────────────────────────────────── */
.cf-consent__category {
    padding: 8px 0;
    border-top: 1px solid var(--cfc-border);
}

.cf-consent__category:last-of-type { margin-bottom: 12px; }

.cf-consent__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-weight: 500;
}

.cf-consent__desc {
    margin: 4px 0 0;
    color: var(--cfc-muted);
    font-size: 12px;
}

.cf-consent__always {
    color: var(--cfc-muted);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.cf-consent__switch {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    cursor: pointer;
}

.cf-consent__switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.cf-consent__switch span {
    width: 30px;
    height: 16px;
    border-radius: 999px;
    background: #D6D2E2;
    position: relative;
    transition: background-color .15s ease;
}

.cf-consent__switch span::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
    transition: transform .15s ease;
}

.cf-consent__switch input:checked + span { background: var(--cfc-violet); }
.cf-consent__switch input:checked + span::after { transform: translateX(14px); }

/* ── Mobile : pleine largeur, chatbot et bouton haut de page remontés ── */
@media (max-width: 576px) {
    .cf-consent {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
    }

    body.cf-consent-open .cf-chat-widget,
    body.cf-consent-open .back-to-top {
        margin-bottom: var(--cf-consent-offset, 0px);
        transition: margin-bottom .22s ease;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cf-consent,
    .cf-consent__switch span,
    .cf-consent__switch span::after { transition: none; }
}
