/**
 * assets/css/cookie-consent.css — enfant.tn / ATDDE
 * Couche 1 : bannière  (#atdde-ccb)
 * Couche 2 : panneau paramètres  (#atdde-ccb-panel)
 */

/* ─── Variables communes ──────────────────────────────── */
:root {
    --ccb-primary   : #c0181e;
    --ccb-primary-d : #8b1010;
    --ccb-surface   : #ffffff;
    --ccb-bg        : #fff8f7;
    --ccb-border    : #d9bfbe;
    --ccb-text      : #201a1a;
    --ccb-muted     : #524342;
    --ccb-radius    : 16px;
    --ccb-shadow    : 0 8px 40px rgba(192,24,30,.13), 0 0 0 1px rgba(192,24,30,.07);
    --ccb-font      : 'Hanken Grotesk', system-ui, sans-serif;
    --ccb-speed     : 380ms;
}

/* ─── COUCHE 1 : Bannière ─────────────────────────────── */
#atdde-ccb {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    z-index: 100001;
    width: calc(100% - 48px);
    max-width: 520px;
    background: var(--ccb-surface);
    border-radius: var(--ccb-radius);
    box-shadow: var(--ccb-shadow);
    opacity: 0;
    transition: transform var(--ccb-speed) cubic-bezier(.34,1.2,.64,1),
                opacity var(--ccb-speed) ease;
    font-family: var(--ccb-font);
    will-change: transform;
}

#atdde-ccb.ccb-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

#atdde-ccb.ccb-hiding {
    transform: translateX(-50%) translateY(130%);
    opacity: 0;
}

.ccb-inner       { padding: 20px 24px 16px; }

.ccb-top {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.ccb-emoji  { font-size: 24px; flex-shrink: 0; margin-top: 1px; }

.ccb-title {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--ccb-text);
    margin-bottom: 4px;
}

.ccb-desc {
    font-size: 13px;
    color: var(--ccb-muted);
    line-height: 1.5;
    margin: 0;
}

/* Boutons bannière */
.ccb-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.ccb-btn {
    flex: 1;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 160ms ease;
    white-space: nowrap;
}

.ccb-btn--outline {
    background: transparent;
    border: 1.5px solid var(--ccb-border);
    color: var(--ccb-muted);
}
.ccb-btn--outline:hover  { border-color: var(--ccb-primary); color: var(--ccb-primary); }

.ccb-btn--secondary {
    background: #fdecea;
    color: var(--ccb-primary);
    border: 1.5px solid transparent;
}
.ccb-btn--secondary:hover { background: #fdd5d3; }

.ccb-btn--primary {
    background: var(--ccb-primary);
    color: #fff;
}
.ccb-btn--primary:hover { background: var(--ccb-primary-d); transform: translateY(-1px); }

.ccb-legal {
    font-size: 11px;
    color: #a08c8b;
    margin: 0;
}
.ccb-legal a { color: var(--ccb-primary); text-decoration: underline; }

/* ─── COUCHE 2 : Panneau paramètres ──────────────────── */
#atdde-ccb-panel {
    position: fixed;
    inset: 0;
    z-index: 100002;
    background: rgba(32, 26, 26, 0.45);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--ccb-speed) ease;
    font-family: var(--ccb-font);
}

#atdde-ccb-panel.ccp-visible { opacity: 1; }

#atdde-ccb-panel.ccp-hiding  { opacity: 0; }

.ccp-box {
    width: 100%;
    max-width: 560px;
    background: var(--ccb-surface);
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform var(--ccb-speed) cubic-bezier(.34,1.2,.64,1);
    overflow: hidden;
}

#atdde-ccb-panel.ccp-visible .ccp-box { transform: translateY(0); }
#atdde-ccb-panel.ccp-hiding  .ccp-box { transform: translateY(100%); }

/* En-tête panneau */
.ccp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 24px 14px;
    border-bottom: 1px solid #f0e4e3;
    flex-shrink: 0;
}

.ccp-back {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid var(--ccb-border);
    background: transparent;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 160ms, color 160ms;
    color: var(--ccb-muted);
    font-family: inherit;
}
.ccp-back:hover { border-color: var(--ccb-primary); color: var(--ccb-primary); }

.ccp-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ccb-text);
}

/* Corps panneau */
.ccp-body {
    overflow-y: auto;
    flex: 1;
    padding: 0 24px;
}

.ccp-intro {
    font-size: 13px;
    color: var(--ccb-muted);
    line-height: 1.5;
    margin: 14px 0;
}

.ccp-toggles {
    border: 1px solid var(--ccb-border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 6px;
}

.ccp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    gap: 16px;
    border-bottom: 1px solid #f0e4e3;
    background: var(--ccb-bg);
}
.ccp-row:last-child { border-bottom: none; }

.ccp-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.ccp-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ccb-text);
}

.ccp-desc {
    font-size: 12px;
    color: var(--ccb-muted);
    line-height: 1.4;
}

.ccp-always-on {
    font-size: 11px;
    font-weight: 700;
    color: #2e7d32;
    background: #e8f5e9;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Switch toggle */
.ccp-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}
.ccp-switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.ccp-slider {
    position: absolute;
    inset: 0;
    background: var(--ccb-border);
    border-radius: 24px;
    transition: background 200ms ease;
}
.ccp-slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 200ms ease;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.ccp-switch input:checked + .ccp-slider             { background: var(--ccb-primary); }
.ccp-switch input:checked + .ccp-slider::before     { transform: translateX(20px); }
.ccp-switch input:focus-visible + .ccp-slider       { outline: 2px solid var(--ccb-primary); outline-offset: 2px; }

/* Pied panneau */
.ccp-footer {
    display: flex;
    gap: 10px;
    padding: 14px 24px 10px;
    border-top: 1px solid #f0e4e3;
    flex-shrink: 0;
}

/* ─── Bouton flottant ─────────────────────────────────── */
#atdde-cookie-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 100000;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid var(--ccb-border);
    box-shadow: 0 2px 12px rgba(192,24,30,.12);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 200ms ease, box-shadow 200ms ease;
}
#atdde-cookie-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(192,24,30,.2);
}

/* ─── Responsive mobile ───────────────────────────────── */
@media (max-width: 560px) {
    #atdde-ccb {
        bottom: 0; left: 0; right: 0;
        width: 100%; max-width: none;
        transform: translateY(120%);
        border-radius: 20px 20px 0 0;
    }
    #atdde-ccb.ccb-visible { transform: translateY(0); }
    #atdde-ccb.ccb-hiding  { transform: translateY(130%); }

    .ccb-inner   { padding: 18px 18px 20px; }
    .ccb-actions { flex-wrap: wrap; }
    .ccb-btn--outline { flex: 0 0 100%; order: 3; }

    #atdde-cookie-btn { bottom: 16px; left: 16px; }
}
