/**
 * Charik Cookie Consent — bannière + modal + bubble persistante
 * Conforme RGPD + Google Consent Mode V2 + recommandations CNIL.
 */

/* ============ Bannière initiale (bas-gauche, compacte) ============ */
.charik-cc-banner {
    position: fixed;
    bottom: 20px; left: 20px;
    width: 360px; max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 20px 60px -20px rgba(15, 23, 42, 0.3), 0 4px 12px -4px rgba(15, 23, 42, 0.1);
    z-index: 9999;
    display: none;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #0F172A;
}
.charik-cc-banner.is-open {
    display: block;
    animation: charik-cc-slide-up 0.3s ease;
}
@keyframes charik-cc-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.charik-cc-banner__icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5DD39E 0%, #2B9FE8 100%);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px -2px rgba(43, 159, 232, 0.3);
}
.charik-cc-banner__icon svg { width: 20px; height: 20px; }
.charik-cc-banner__title {
    font-size: 1rem; font-weight: 700;
    margin: 0 0 8px;
    color: #0F172A;
}
.charik-cc-banner__text {
    font-size: 0.8125rem; color: #475569;
    line-height: 1.5; margin: 0 0 16px;
}
.charik-cc-banner__text a {
    color: #2B9FE8; text-decoration: underline;
}
.charik-cc-banner__actions {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* ============ Boutons partagés ============ */
.charik-cc-btn {
    padding: 10px 14px;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    text-align: center;
    line-height: 1.2;
}
.charik-cc-btn--primary {
    background: linear-gradient(135deg, #5DD39E 0%, #2B9FE8 100%);
    color: #fff;
}
.charik-cc-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -6px rgba(43, 159, 232, 0.5);
}
.charik-cc-btn--secondary {
    background: #fff;
    color: #0F172A;
    border: 1.5px solid #cbd5e1;
}
.charik-cc-btn--secondary:hover {
    border-color: #2B9FE8;
    transform: translateY(-1px);
}
.charik-cc-btn--text {
    background: transparent;
    color: #64748b;
    text-decoration: underline;
    grid-column: span 2;
    padding: 6px;
    font-size: 0.75rem;
}
.charik-cc-btn--text:hover { color: #2B9FE8; }

/* ============ Modal personnalisation (centré) ============ */
.charik-cc-modal {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    align-items: center; justify-content: center;
    padding: 20px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.charik-cc-modal.is-open {
    display: flex;
    animation: charik-cc-fade-in 0.2s ease;
}
@keyframes charik-cc-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.charik-cc-modal__inner {
    background: #fff;
    border-radius: 20px;
    max-width: 540px; width: 100%;
    max-height: 85vh; overflow-y: auto;
    padding: 28px;
    box-shadow: 0 30px 60px -20px rgba(15, 23, 42, 0.4);
}
.charik-cc-modal__head {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 8px;
    gap: 12px;
}
.charik-cc-modal__title {
    font-size: 1.25rem; font-weight: 700;
    margin: 0; color: #0F172A;
    letter-spacing: -0.01em;
}
.charik-cc-modal__close {
    background: transparent; border: none;
    cursor: pointer; padding: 4px;
    color: #94a3b8;
    transition: color .15s ease;
}
.charik-cc-modal__close:hover { color: #0F172A; }
.charik-cc-modal__intro {
    font-size: 0.875rem; color: #475569;
    line-height: 1.55;
    margin: 0 0 20px;
}
.charik-cc-modal__intro a { color: #2B9FE8; text-decoration: underline; }

.charik-cc-cat {
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 10px;
}
.charik-cc-cat__head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
    gap: 12px;
}
.charik-cc-cat__title {
    font-weight: 700;
    font-size: 0.9375rem;
    color: #0F172A;
}
.charik-cc-cat__desc {
    font-size: 0.8125rem; color: #64748b;
    line-height: 1.55; margin: 0;
}
.charik-cc-cat__cookies {
    font-size: 0.7rem; color: #94a3b8;
    margin: 6px 0 0;
    font-style: italic;
    line-height: 1.4;
}

/* Toggle switch */
.charik-cc-toggle {
    position: relative;
    display: inline-block;
    width: 40px; height: 22px;
    flex-shrink: 0;
}
.charik-cc-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.charik-cc-toggle__slider {
    position: absolute; inset: 0;
    background: #cbd5e1;
    border-radius: 22px;
    cursor: pointer;
    transition: background .2s;
}
.charik-cc-toggle__slider::before {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.charik-cc-toggle input:checked + .charik-cc-toggle__slider {
    background: linear-gradient(135deg, #5DD39E 0%, #2B9FE8 100%);
}
.charik-cc-toggle input:checked + .charik-cc-toggle__slider::before { transform: translateX(18px); }
.charik-cc-toggle input:disabled + .charik-cc-toggle__slider {
    opacity: 0.5; cursor: not-allowed;
}
.charik-cc-toggle__locked {
    font-size: 0.7rem; color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.charik-cc-modal__actions {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    gap: 8px; margin-top: 20px;
}

/* ============ Bubble persistante (post-choix) ============ */
.charik-cc-bubble {
    position: fixed;
    bottom: 20px; left: 20px;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid #cbd5e1;
    box-shadow: 0 8px 16px -6px rgba(15, 23, 42, 0.15);
    cursor: pointer;
    display: none;
    align-items: center; justify-content: center;
    z-index: 9998;
    color: #475569;
    transition: transform .2s ease, border-color .2s ease, color .2s ease;
    padding: 0;
}
.charik-cc-bubble.is-visible { display: flex; }
.charik-cc-bubble:hover {
    transform: scale(1.08);
    border-color: #2B9FE8;
    color: #2B9FE8;
}
.charik-cc-bubble svg { width: 22px; height: 22px; }

/* ============ Mobile ============ */
@media (max-width: 540px) {
    .charik-cc-banner {
        bottom: 12px; left: 12px; right: 12px;
        width: auto;
    }
    .charik-cc-modal__inner { padding: 20px; }
    .charik-cc-modal__actions {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .charik-cc-bubble { bottom: 12px; left: 12px; }
}
