/* ── Cookie Consent Manager – Frontend ── */

/* ══════════════════════════════════════════════
   CSS Variables — Dark theme (défaut)
══════════════════════════════════════════════ */
#ccm-root {
    --ccm-bg:           #1a1a2e;
    --ccm-title:        #ffffff;
    --ccm-text:         #e8e8f0;
    --ccm-text-muted:   #b8b8cc;
    --ccm-text-body:    #9898b8;
    --ccm-divider:      rgba(255, 255, 255, .08);
    --ccm-shadow-sm:    rgba(0, 0, 0, .38);
    --ccm-shadow-lg:    rgba(0, 0, 0, .52);
    --ccm-overlay:      rgba(0, 0, 0, .62);
    --ccm-toggle-off:   #3a3a5e;
    --ccm-close-color:  #8080a0;
    --ccm-close-hover:  #ffffff;
    --ccm-chevron:      #6060a0;
    --ccm-hover-color:  #c0c8ff;
    --ccm-scrollbar:    rgba(255, 255, 255, .18);
    --ccm-card-border:  transparent;
}

/* ══════════════════════════════════════════════
   CSS Variables — Light theme
══════════════════════════════════════════════ */
#ccm-root.ccm-light {
    --ccm-bg:           #ffffff;
    --ccm-title:        #111827;
    --ccm-text:         #1f2937;
    --ccm-text-muted:   #4b5563;
    --ccm-text-body:    #6b7280;
    --ccm-divider:      rgba(0, 0, 0, .09);
    --ccm-shadow-sm:    rgba(0, 0, 0, .12);
    --ccm-shadow-lg:    rgba(0, 0, 0, .18);
    --ccm-overlay:      rgba(0, 0, 0, .50);
    --ccm-toggle-off:   #d1d5db;
    --ccm-close-color:  #9ca3af;
    --ccm-close-hover:  #111827;
    --ccm-chevron:      #9ca3af;
    --ccm-hover-color:  #2563eb;
    --ccm-scrollbar:    rgba(0, 0, 0, .12);
    --ccm-card-border:  rgba(0, 0, 0, .10);
}

/* ══════════════════════════════════════════════
   Banner (bottom-left, première visite)
══════════════════════════════════════════════ */
#ccm-banner {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99998;
    width: 360px;
    max-width: calc(100vw - 48px);
    background: var(--ccm-bg);
    color: var(--ccm-text);
    border-radius: 12px;
    border: 1px solid var(--ccm-card-border);
    padding: 20px 22px;
    box-shadow: 0 8px 32px var(--ccm-shadow-sm);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.55;
    animation: ccm-slideUp .3s ease;
}

#ccm-banner.ccm-hidden { display: none !important; }

#ccm-banner h3 {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--ccm-title);
}

#ccm-banner p {
    margin: 0 0 16px;
    color: var(--ccm-text-muted);
}

.ccm-banner-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ccm-banner-btns button {
    flex: 1 1 auto;
    padding: 9px 14px;
    border-radius: 6px;
    border: 2px solid transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.3;
}

.ccm-banner-btns button:hover  { opacity: .85; transform: translateY(-1px); }
.ccm-banner-btns button:active { transform: translateY(0); }

/* ══════════════════════════════════════════════
   Bulle (bottom-left, après consentement)
══════════════════════════════════════════════ */
#ccm-bubble {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99998;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 18px var(--ccm-shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s, box-shadow .2s;
}

#ccm-bubble.ccm-hidden { display: none !important; }
#ccm-bubble:hover  { transform: scale(1.1);  box-shadow: 0 6px 24px var(--ccm-shadow-sm); }
#ccm-bubble:active { transform: scale(1.04); }

#ccm-bubble svg { width: 26px; height: 26px; }

/* ══════════════════════════════════════════════
   Overlay modal
══════════════════════════════════════════════ */
#ccm-overlay {
    position: fixed;
    inset: 0;
    background: var(--ccm-overlay);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: ccm-fadeIn .2s ease;
}

#ccm-overlay.ccm-hidden { display: none !important; }

/* ══════════════════════════════════════════════
   Modal box
══════════════════════════════════════════════ */
#ccm-modal {
    background: var(--ccm-bg);
    color: var(--ccm-text);
    border-radius: 14px;
    border: 1px solid var(--ccm-card-border);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px var(--ccm-shadow-lg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    overflow: hidden;
}

/* Header */
.ccm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--ccm-divider);
    flex-shrink: 0;
}

.ccm-modal-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--ccm-title);
}

#ccm-modal-close {
    background: none;
    border: none;
    color: var(--ccm-close-color);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 0 4px;
    border-radius: 4px;
    transition: color .15s;
    font-family: inherit;
}

#ccm-modal-close:hover { color: var(--ccm-close-hover); }

/* Body / zone scrollable */
.ccm-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 22px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--ccm-scrollbar) transparent;
}

.ccm-modal-body::-webkit-scrollbar       { width: 6px; }
.ccm-modal-body::-webkit-scrollbar-track { background: transparent; }
.ccm-modal-body::-webkit-scrollbar-thumb { background: var(--ccm-scrollbar); border-radius: 3px; }

.ccm-modal-intro {
    color: var(--ccm-text-muted);
    margin: 0 0 14px;
    line-height: 1.65;
}

/* Séparateur accordion */
.ccm-divider {
    height: 1px;
    background: var(--ccm-divider);
    border: none;
    margin: 0;
}

/* ══════════════════════════════════════════════
   Accordion
══════════════════════════════════════════════ */
.ccm-accordion-trigger {
    width: 100%;
    background: none;
    border: none;
    color: var(--ccm-title);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    font-family: inherit;
    transition: color .15s;
}

.ccm-accordion-trigger:hover { color: var(--ccm-hover-color); }

.ccm-accordion-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ccm-chevron {
    width: 16px;
    height: 16px;
    color: var(--ccm-chevron);
    flex-shrink: 0;
    transition: transform .25s;
}

.ccm-accordion-item.is-open .ccm-chevron {
    transform: rotate(90deg);
}

.ccm-always-active {
    font-size: 12px;
    font-weight: 600;
    color: #4ade80;
    letter-spacing: .3px;
}

/* Toggle switch */
.ccm-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.ccm-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.ccm-slider {
    position: absolute;
    inset: 0;
    background: var(--ccm-toggle-off);
    border-radius: 12px;
    transition: background .2s;
}

.ccm-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.ccm-toggle input:checked + .ccm-slider             { background: #2563eb; }
.ccm-toggle input:checked + .ccm-slider::before     { transform: translateX(20px); }
.ccm-toggle input:focus-visible + .ccm-slider       { outline: 2px solid #60a5fa; outline-offset: 2px; }

/* Corps accordion (collapsible) */
.ccm-accordion-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s ease;
}

.ccm-accordion-item.is-open .ccm-accordion-body {
    max-height: 400px;
}

.ccm-accordion-content {
    color: var(--ccm-text-body);
    line-height: 1.65;
    padding-bottom: 16px;
}

/* ══════════════════════════════════════════════
   Footer modal
══════════════════════════════════════════════ */
.ccm-modal-footer {
    display: flex;
    gap: 8px;
    padding: 14px 22px 18px;
    border-top: 1px solid var(--ccm-divider);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.ccm-modal-footer button {
    flex: 1 1 auto;
    padding: 10px 14px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.3;
}

.ccm-modal-footer button:hover  { opacity: .85; transform: translateY(-1px); }
.ccm-modal-footer button:active { transform: translateY(0); }

/* ══════════════════════════════════════════════
   Animations
══════════════════════════════════════════════ */
@keyframes ccm-slideUp {
    from { transform: translateY(18px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@keyframes ccm-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ══════════════════════════════════════════════
   Responsive mobile
══════════════════════════════════════════════ */
@media (max-width: 480px) {
    #ccm-banner {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 12px 12px 0 0;
    }

    #ccm-bubble {
        bottom: 16px;
        left: 16px;
    }

    #ccm-modal {
        max-height: 95vh;
        border-radius: 14px 14px 0 0;
        align-self: flex-end;
    }

    #ccm-overlay {
        align-items: flex-end;
        padding: 0;
    }
}
