/**
 * Cookie Consent — Modale plein écran élégante
 * Refonte 2026-05-12 : centrée, lumineuse, sans transform au survol
 */

:root {
    --ccb-bg:           #ffffff;
    --ccb-bg-soft:      #faf8f3;
    --ccb-surface:      #f5f1e8;
    --ccb-border:       rgba(60,40,20,.10);
    --ccb-border-soft:  rgba(60,40,20,.06);
    --ccb-text:         #2c241b;
    --ccb-text-muted:   #6b5d50;
    --ccb-accent:       #8b6914;
    --ccb-accent-hover: #6f5310;
    --ccb-accept:       #2c241b;
    --ccb-accept-hover: #1a140f;
    --ccb-refuse-bg:    transparent;
    --ccb-refuse-hover: #f0eadc;
    --ccb-radius:       16px;
    --ccb-shadow:       0 24px 72px rgba(40,28,16,.18), 0 8px 24px rgba(40,28,16,.08);
    --ccb-z:            10000;
}

/* ── OVERLAY PLEIN ÉCRAN ───────────────────────────────────────────────────── */
#pa-cookie-banner {
    position:        fixed;
    inset:           0;
    width:           100vw;
    height:          100vh;
    max-height:      none;
    margin:          0;
    padding:         24px;
    background:      rgba(20, 15, 10, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index:         var(--ccb-z);
    color:           var(--ccb-text);
    font-family:     inherit;
    display:         flex;
    align-items:     center;
    justify-content: center;
    overflow-y:      auto;
    animation:       ccbFadeIn .25s ease both;
    border:          none;
    border-radius:   0;
    box-shadow:      none;
}

#pa-cookie-banner.ccb-hiding {
    animation: ccbFadeOut .2s ease forwards;
}

@keyframes ccbFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes ccbFadeOut {
    to { opacity: 0; }
}

/* ── CARTE CENTRÉE ─────────────────────────────────────────────────────────── */
.ccb-inner {
    width:           min(640px, 100%);
    background:      var(--ccb-bg);
    border-radius:   var(--ccb-radius);
    box-shadow:      var(--ccb-shadow);
    padding:         32px;
    max-height:      calc(100vh - 48px);
    overflow-y:      auto;
    animation:       ccbScaleIn .3s cubic-bezier(.16,1,.3,1) both;
}

@keyframes ccbScaleIn {
    from { opacity: 0; transform: scale(.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── HEADER ────────────────────────────────────────────────────────────────── */
.ccb-header {
    display:       flex;
    align-items:   flex-start;
    gap:           14px;
    margin-bottom: 20px;
}

.ccb-shield {
    font-size:    1.8rem;
    line-height:  1;
    flex-shrink:  0;
    margin-top:   2px;
}

.ccb-title {
    margin:      0 0 4px;
    font-size:   1.25rem;
    font-weight: 700;
    color:       var(--ccb-text);
    letter-spacing: -.01em;
}

.ccb-subtitle {
    margin:    0;
    font-size: .85rem;
    color:     var(--ccb-text-muted);
}

/* ── INTRO ─────────────────────────────────────────────────────────────────── */
.ccb-intro {
    font-size:     .9rem;
    line-height:   1.65;
    color:         var(--ccb-text-muted);
    margin-bottom: 22px;
}

/* ── CATÉGORIES ────────────────────────────────────────────────────────────── */
.ccb-categories {
    display:        flex;
    flex-direction: column;
    gap:            10px;
    margin-bottom:  20px;
}

.ccb-category {
    background:    var(--ccb-bg-soft);
    border:        1px solid var(--ccb-border-soft);
    border-radius: 12px;
    padding:       14px 16px;
}

.ccb-cat-header {
    display:        flex;
    align-items:    center;
    gap:            12px;
    margin-bottom:  4px;
}

.ccb-cat-info {
    display:    flex;
    align-items: center;
    flex-wrap:  wrap;
    gap:        8px;
    flex:       1;
    min-width:  0;
}

.ccb-cat-label {
    font-weight: 600;
    font-size:   .92rem;
    color:       var(--ccb-text);
}

.ccb-badge {
    font-size:      .68rem;
    font-weight:    700;
    padding:        2px 8px;
    border-radius:  999px;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.ccb-badge-required { background: rgba(139,105,20,.15); color: var(--ccb-accent); }
.ccb-badge-optional { background: rgba(60,40,20,.08);   color: var(--ccb-text-muted); }

.ccb-cat-base {
    font-size:  .72rem;
    color:      var(--ccb-text-muted);
    font-style: italic;
}

.ccb-cat-desc {
    display:      none;
    font-size:    .82rem;
    color:        var(--ccb-text-muted);
    margin:       6px 0 8px;
    line-height:  1.6;
}

/* ── TOGGLE ────────────────────────────────────────────────────────────────── */
.ccb-toggle-wrap {
    position:   relative;
    display:    inline-block;
    width:      42px;
    height:     24px;
    flex-shrink: 0;
    cursor:     pointer;
}

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

.ccb-toggle-track {
    position:      absolute;
    inset:         0;
    border-radius: 999px;
    background:    #c9bda9;
    transition:    background .2s;
}
.ccb-toggle-track::after {
    content:       '';
    position:      absolute;
    top:           3px;
    left:          3px;
    width:         18px;
    height:        18px;
    border-radius: 50%;
    background:    #fff;
    box-shadow:    0 1px 3px rgba(0,0,0,.15);
    transition:    transform .2s;
}

.ccb-toggle-input:checked + .ccb-toggle-track { background: var(--ccb-accent); }
.ccb-toggle-input:checked + .ccb-toggle-track::after { transform: translateX(18px); }
.ccb-toggle-input:disabled + .ccb-toggle-track { opacity: .5; cursor: not-allowed; }
.ccb-toggle-input:focus-visible + .ccb-toggle-track { outline: 2px solid var(--ccb-accent); outline-offset: 2px; }

/* ── DÉTAILS ───────────────────────────────────────────────────────────────── */
.ccb-cat-details summary {
    font-size:    .78rem;
    color:        var(--ccb-accent);
    cursor:       pointer;
    user-select:  none;
    padding:      4px 0;
}
.ccb-cat-details[open] summary { margin-bottom: 8px; }

.ccb-data-table {
    width:           100%;
    border-collapse: collapse;
    font-size:       .76rem;
    color:           var(--ccb-text-muted);
}
.ccb-data-table th,
.ccb-data-table td {
    text-align:    left;
    padding:       5px 8px;
    border-bottom: 1px solid var(--ccb-border-soft);
}
.ccb-data-table th { color: var(--ccb-text); font-weight: 600; }
.ccb-data-table tr:last-child td { border-bottom: none; }

/* ── BLOC JURIDIQUE ────────────────────────────────────────────────────────── */
.ccb-legal-block {
    background:    var(--ccb-bg-soft);
    border:        1px solid var(--ccb-border-soft);
    border-radius: 12px;
    padding:       12px 16px;
    margin-bottom: 22px;
}
.ccb-legal-block summary {
    font-size:   .82rem;
    font-weight: 600;
    color:       var(--ccb-text-muted);
    cursor:      pointer;
    user-select: none;
}
.ccb-legal-block[open] summary { color: var(--ccb-text); margin-bottom: 8px; }
.ccb-legal-content p {
    font-size:     .8rem;
    line-height:   1.65;
    color:         var(--ccb-text-muted);
    margin-bottom: 8px;
}
.ccb-legal-content a { color: var(--ccb-accent); }
.ccb-legal-ref {
    font-size:    .72rem !important;
    color:        var(--ccb-text-muted) !important;
    font-style:   italic;
    border-top:   1px solid var(--ccb-border-soft);
    padding-top:  8px;
    margin-top:   8px !important;
    opacity:      .8;
}

/* ── FOOTER (BOUTONS) ──────────────────────────────────────────────────────── */
.ccb-footer {
    display:         flex;
    gap:             10px;
    flex-wrap:       wrap;
    justify-content: center;
    margin-bottom:   12px;
}

.ccb-btn {
    flex:            1 1 auto;
    min-width:       140px;
    padding:         12px 22px;
    border-radius:   10px;
    font-size:       .9rem;
    font-weight:     600;
    border:          1px solid transparent;
    cursor:          pointer;
    transition:      background .15s, color .15s, border-color .15s;
    white-space:     nowrap;
    text-align:      center;
    font-family:     inherit;
    line-height:     1.2;
}
.ccb-btn:focus-visible { outline: 2px solid var(--ccb-accent); outline-offset: 2px; }

.ccb-btn-accept {
    background: var(--ccb-accept);
    color:      #fff;
}
.ccb-btn-accept:hover { background: var(--ccb-accept-hover); }

.ccb-btn-refuse {
    background:    var(--ccb-refuse-bg);
    color:         var(--ccb-text-muted);
    border-color:  var(--ccb-border);
}
.ccb-btn-refuse:hover {
    background:   var(--ccb-refuse-hover);
    color:        var(--ccb-text);
    border-color: var(--ccb-border);
}

.ccb-btn-custom {
    background: var(--ccb-accent);
    color:      #fff;
}
.ccb-btn-custom:hover { background: var(--ccb-accent-hover); }

.ccb-revoke-hint {
    font-size:   .76rem;
    color:       var(--ccb-text-muted);
    text-align:  center;
    margin:      0;
}
.ccb-link-btn {
    background:  none;
    border:      none;
    color:       var(--ccb-accent);
    cursor:      pointer;
    font-size:   inherit;
    padding:     0;
    text-decoration: underline;
}

/* ── PANNEAU PARAMÈTRES ────────────────────────────────────────────────────── */
.ccb-panel-overlay {
    position: fixed;
    inset:    0;
    background: rgba(20,15,10,.55);
    backdrop-filter: blur(8px);
    z-index:  calc(var(--ccb-z) + 1);
}

#pa-cookie-panel {
    position:      fixed;
    inset:         0;
    margin:        auto;
    width:         min(680px, calc(100vw - 32px));
    height:        fit-content;
    max-height:    calc(100vh - 48px);
    overflow-y:    auto;
    background:    var(--ccb-bg);
    border:        none;
    border-radius: var(--ccb-radius);
    box-shadow:    var(--ccb-shadow);
    z-index:       calc(var(--ccb-z) + 2);
    color:         var(--ccb-text);
    animation:     ccbScaleIn .3s cubic-bezier(.16,1,.3,1) both;
}

.ccb-panel-inner { padding: 28px; }

.ccb-panel-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    margin-bottom:   22px;
}
.ccb-panel-header h2 {
    margin:      0;
    font-size:   1.15rem;
    font-weight: 700;
    color:       var(--ccb-text);
}
.ccb-panel-close {
    background:    none;
    border:        none;
    color:         var(--ccb-text-muted);
    font-size:     1.4rem;
    cursor:        pointer;
    padding:       4px 10px;
    border-radius: 8px;
    transition:    background .15s, color .15s;
}
.ccb-panel-close:hover { background: var(--ccb-surface); color: var(--ccb-text); }

.ccb-panel-body {
    display:       flex;
    flex-direction: column;
    gap:           10px;
    margin-bottom: 22px;
}

.ccb-panel-footer {
    border-top:    1px solid var(--ccb-border-soft);
    padding-top:   18px;
    display:       flex;
    flex-wrap:     wrap;
    align-items:   center;
    gap:           12px;
    justify-content: space-between;
}

.ccb-consent-meta {
    font-size:  .78rem;
    color:      var(--ccb-text-muted);
    flex:       1;
    min-width:  200px;
}
.ccb-consent-meta code {
    background:    var(--ccb-surface);
    padding:       1px 6px;
    border-radius: 4px;
    font-size:     .72rem;
    color:         var(--ccb-text);
}

.ccb-panel-actions {
    display:   flex;
    gap:       10px;
    flex-wrap: wrap;
}

/* ── BOUTON FLOTTANT ───────────────────────────────────────────────────────── */
#ccb-float-btn { display: none !important; }

/* ── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    #pa-cookie-banner { padding: 12px; }
    .ccb-inner { padding: 22px 18px; }
    .ccb-footer { flex-direction: column; }
    .ccb-btn { width: 100%; min-width: 0; }
    .ccb-panel-inner { padding: 22px 18px; }
    .ccb-panel-footer { flex-direction: column; align-items: stretch; }
    .ccb-panel-actions { flex-direction: column; width: 100%; }
    .ccb-panel-actions .ccb-btn { width: 100%; }
}

/* ── ACCESSIBILITÉ ─────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    #pa-cookie-banner,
    #pa-cookie-panel,
    .ccb-inner { animation: none; }
}

@media print {
    #pa-cookie-banner,
    #pa-cookie-panel,
    .ccb-panel-overlay { display: none !important; }
}
