/**
 * Cookies — FAB bleu CTA (#2563EB) + SVG blanc, panneau au-dessus du FAB aligné à gauche.
 * UI toujours en thème sombre (indépendant de data-theme du site).
 */
:root {
    --cookie-cta-blue: #2563eb;
    --cookie-cta-blue-hover: #1d4ed8;
}

.cookie-consent-root {
    position: fixed;
    inset: 0;
    z-index: 100000 !important;
    pointer-events: none;
    opacity: 1 !important;
    visibility: visible !important;
}

.cookie-consent-root > * {
    pointer-events: auto;
}

.cookie-consent-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.12);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

.cookie-consent-root:not(.cookie-consent-root--minimized) .cookie-consent-overlay {
    opacity: 1;
    visibility: visible;
}

.cookie-consent-panel {
    --cookie-fab-size: 56px;
    --cookie-fab-gap: 12px;
    --cookie-fab-bottom: max(1.25rem, env(safe-area-inset-bottom));
    --cookie-fab-left: max(1rem, env(safe-area-inset-left));

    position: fixed;
    left: var(--cookie-fab-left);
    right: auto;
    bottom: calc(var(--cookie-fab-bottom) + var(--cookie-fab-size) + var(--cookie-fab-gap));
    transform: translateY(10px);
    width: min(100vw - 2rem, 440px);
    max-width: calc(100vw - 2 * max(1rem, env(safe-area-inset-left)));
    max-height: min(72vh, 620px);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    z-index: 2;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease, transform 0.28s ease;
}

.cookie-consent-root:not(.cookie-consent-root--minimized) .cookie-consent-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cookie-consent-pill {
    align-self: center;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(30, 30, 30, 0.96);
    color: rgba(248, 250, 252, 0.85);
    font-size: 0.8rem;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.cookie-consent-pill:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

.cookie-consent-card {
    align-self: stretch;
    width: 100%;
    background: #171717;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
    padding: 1.25rem 1.35rem 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cookie-consent-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.cookie-consent-heading-wrap {
    flex: 1;
    min-width: 0;
}

.cookie-consent-kicker {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(248, 250, 252, 0.55);
    margin: 0 0 0.2rem;
}

.cookie-consent-title {
    font-size: clamp(1.35rem, 3.5vw, 1.6rem);
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
    line-height: 1.15;
}

.cookie-consent-icon-box {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--cookie-cta-blue);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cookie-consent-icon-img {
    width: 40px;
    height: 40px;
    display: block;
    filter: brightness(0) invert(1);
}

.cookie-consent-desc {
    font-size: 0.92rem;
    line-height: 1.5;
    color: rgba(248, 250, 252, 0.82);
    margin: 0 0 0.65rem;
}

.cookie-consent-link {
    font-size: 0.88rem;
    font-weight: 600;
    color: #60a5fa;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-consent-link:hover {
    color: #93c5fd;
}

.cookie-consent-info {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.cookie-consent-info-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(248, 250, 252, 0.55);
    margin: 0 0 0.45rem;
}

.cookie-consent-list {
    margin: 0;
    padding-left: 1.15rem;
    font-size: 0.85rem;
    line-height: 1.45;
    color: rgba(248, 250, 252, 0.75);
}

.cookie-consent-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    direction: ltr;
    margin-top: 1rem;
    margin-left: -1.35rem;
    margin-right: -1.35rem;
    width: calc(100% + 2.7rem);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.cookie-consent-footer-choose {
    margin: 0;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(30, 30, 30, 0.9);
    color: rgba(248, 250, 252, 0.75);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.95rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.cookie-consent-footer-choose:hover {
    background: rgba(40, 40, 40, 0.95);
    color: #f8fafc;
}

.cookie-consent-footer-ok {
    margin: 0;
    border: none;
    background: var(--cookie-cta-blue);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.95rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s ease, filter 0.15s ease;
}

.cookie-consent-footer-ok:hover {
    background: var(--cookie-cta-blue-hover);
    filter: brightness(1.02);
}

.cookie-consent-fab {
    position: fixed;
    left: max(1rem, env(safe-area-inset-left));
    bottom: max(1.25rem, env(safe-area-inset-bottom));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cookie-cta-blue);
    color: #fff;
    box-shadow: none;
    transition: transform 0.2s ease, background 0.2s ease;
}

.cookie-consent-fab:hover {
    transform: scale(1.05);
    background: var(--cookie-cta-blue-hover);
    box-shadow: none;
}

.cookie-consent-fab-icon--cookie {
    width: 28px;
    height: 28px;
    display: block;
    filter: brightness(0) invert(1);
}

.cookie-consent-fab-icon--close {
    display: none;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: #fff;
}

.cookie-consent-root:not(.cookie-consent-root--minimized) .cookie-consent-fab-icon--cookie {
    display: none;
}

.cookie-consent-root:not(.cookie-consent-root--minimized) .cookie-consent-fab-icon--close {
    display: block;
}

.cookie-consent-root--instant-open .cookie-consent-overlay,
.cookie-consent-root--instant-open .cookie-consent-panel {
    transition: none !important;
}

.cookie-consent-root--instant-open:not(.cookie-consent-root--minimized) .cookie-consent-panel {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.cookie-consent-root--instant-open:not(.cookie-consent-root--minimized) .cookie-consent-overlay {
    opacity: 1;
    visibility: visible;
}

/* Mobile : fenêtre plus étroite, plus compacte */
@media (max-width: 639px) {
    .cookie-consent-panel {
        --cookie-fab-size: 48px;
        --cookie-fab-gap: 8px;
        --cookie-fab-bottom: max(0.85rem, env(safe-area-inset-bottom));
        --cookie-fab-left: max(0.65rem, env(safe-area-inset-left));

        width: min(100vw - 1.1rem, 300px);
        max-width: calc(100vw - 2 * max(0.55rem, env(safe-area-inset-left)));
        max-height: min(58vh, 480px);
        gap: 0.45rem;
    }

    .cookie-consent-pill {
        font-size: 0.72rem;
        padding: 0.35rem 0.75rem;
    }

    .cookie-consent-card {
        border-radius: 0.75rem;
        padding: 0.85rem 0.95rem 0;
    }

    .cookie-consent-header {
        gap: 0.65rem;
        margin-bottom: 0.35rem;
    }

    .cookie-consent-kicker {
        font-size: 0.72rem;
    }

    .cookie-consent-title {
        font-size: clamp(1.05rem, 4.2vw, 1.25rem);
    }

    .cookie-consent-icon-box {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .cookie-consent-icon-img {
        width: 32px;
        height: 32px;
    }

    .cookie-consent-desc {
        font-size: 0.8rem;
        line-height: 1.42;
        margin: 0 0 0.5rem;
    }

    .cookie-consent-link {
        font-size: 0.78rem;
    }

    .cookie-consent-info {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }

    .cookie-consent-info-title {
        font-size: 0.72rem;
        margin: 0 0 0.35rem;
    }

    .cookie-consent-list {
        font-size: 0.74rem;
        line-height: 1.38;
        padding-left: 1rem;
    }

    .cookie-consent-footer {
        margin-top: 0.65rem;
        margin-left: -0.95rem;
        margin-right: -0.95rem;
        width: calc(100% + 1.9rem);
    }

    .cookie-consent-footer-choose,
    .cookie-consent-footer-ok {
        font-size: 0.76rem;
        padding: 0.72rem 0.4rem;
    }

    .cookie-consent-fab {
        left: max(0.65rem, env(safe-area-inset-left));
        bottom: max(0.85rem, env(safe-area-inset-bottom));
        width: 48px;
        height: 48px;
    }

    .cookie-consent-fab-icon--cookie {
        width: 24px;
        height: 24px;
    }

    .cookie-consent-fab-icon--close {
        width: 20px;
        height: 20px;
    }
}

html[dir="rtl"] .cookie-consent-fab {
    left: auto;
    right: max(1rem, env(safe-area-inset-right));
}

html[dir="rtl"] .cookie-consent-panel {
    left: auto;
    right: max(1rem, env(safe-area-inset-right));
    max-width: calc(100vw - 2 * max(1rem, env(safe-area-inset-right)));
}

@media (max-width: 639px) {
    html[dir="rtl"] .cookie-consent-fab {
        right: max(0.65rem, env(safe-area-inset-right));
    }

    html[dir="rtl"] .cookie-consent-panel {
        right: max(0.65rem, env(safe-area-inset-right));
        max-width: calc(100vw - 2 * max(0.55rem, env(safe-area-inset-right)));
    }
}
