/**
 * Cookie Consent — Styles RGPD
 * ProductiveApp v4.0
 */

/* ── VARIABLES ─────────────────────────────────────────────────────────────── */
:root {
    --ccb-bg:           #0f1117;
    --ccb-surface:      #1a1d27;
    --ccb-surface2:     #22263a;
    --ccb-border:       rgba(255,255,255,.08);
    --ccb-text:         #e2e8f0;
    --ccb-text-muted:   #94a3b8;
    --ccb-accent:       #6c63ff;
    --ccb-accept:       #22c55e;
    --ccb-refuse:       #64748b;
    --ccb-radius:       14px;
    --ccb-shadow:       0 24px 80px rgba(0,0,0,.7);
    --ccb-z:            9999;
}

/* ── BANNIÈRE ──────────────────────────────────────────────────────────────── */
#pa-cookie-banner {
    position:   fixed;
    bottom:     24px;
    left:       50%;
    transform:  translateX(-50%);
    width:      min(780px, calc(100vw - 32px));
    max-height: 85vh;
    overflow-y: auto;
    background: var(--ccb-bg);
    border:     1px solid var(--ccb-border);
    border-radius: var(--ccb-radius);
    box-shadow: var(--ccb-shadow);
    z-index:    var(--ccb-z);
    color:      var(--ccb-text);
    font-family: inherit;
    animation:  ccbSlideUp .35s cubic-bezier(.16,1,.3,1) both;
}

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

@keyframes ccbSlideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(30px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes ccbSlideDown {
    to   { opacity: 0; transform: translateX(-50%) translateY(30px); }
}

/* ── INNER ─────────────────────────────────────────────────────────────────── */
.ccb-inner {
    padding: 24px 28px 20px;
}

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

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

.ccb-title {
    margin:      0 0 2px;
    font-size:   1.1rem;
    font-weight: 700;
    color:       #fff;
}

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

/* ── BODY ──────────────────────────────────────────────────────────────────── */
.ccb-intro {
    font-size:     .875rem;
    line-height:   1.6;
    color:         var(--ccb-text-muted);
    margin-bottom: 20px;
}

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

.ccb-category {
    background:    var(--ccb-surface);
    border:        1px solid var(--ccb-border);
    border-radius: 10px;
    padding:       14px 16px 12px;
    transition:    border-color .2s;
}
.ccb-category:focus-within {
    border-color: var(--ccb-accent);
}

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

.ccb-cat-info {
    display:     flex;
    align-items: center;
    flex-wrap:   wrap;
    gap:         6px;
    flex:        1;
}

.ccb-cat-label {
    font-weight: 600;
    font-size:   .9rem;
    color:       #fff;
}

.ccb-badge {
    font-size:     .7rem;
    font-weight:   700;
    padding:       2px 8px;
    border-radius: 999px;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.ccb-badge-required { background: rgba(108,99,255,.25); color: #a5b4fc; }
.ccb-badge-optional { background: rgba(100,116,139,.2);  color: #94a3b8; }

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

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

/* ── TOGGLE ────────────────────────────────────────────────────────────────── */
.ccb-toggle-wrap {
    position:   relative;
    display:    inline-block;
    width:      44px;
    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:    #374151;
    transition:    background .2s;
}
.ccb-toggle-track::after {
    content:       '';
    position:      absolute;
    top:           3px;
    left:          3px;
    width:         18px;
    height:        18px;
    border-radius: 50%;
    background:    #fff;
    transition:    transform .2s;
}

.ccb-toggle-input:checked + .ccb-toggle-track { background: var(--ccb-accept); }
.ccb-toggle-input:checked + .ccb-toggle-track::after { transform: translateX(20px); }
.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; }

/* ── TABLEAU DE DONNÉES ────────────────────────────────────────────────────── */
.ccb-cat-details summary {
    font-size:  .78rem;
    color:      var(--ccb-accent);
    cursor:     pointer;
    user-select: none;
}
.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:       4px 8px;
    border-bottom: 1px solid var(--ccb-border);
}
.ccb-data-table th {
    color:       #fff;
    font-weight: 600;
}
.ccb-data-table tr:last-child td { border-bottom: none; }

/* ── BLOC JURIDIQUE ────────────────────────────────────────────────────────── */
.ccb-legal-block {
    background:    var(--ccb-surface);
    border:        1px solid var(--ccb-border);
    border-radius: 10px;
    padding:       12px 16px;
    margin-bottom: 20px;
}
.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: #fff; margin-bottom: 12px; }

.ccb-legal-content p {
    font-size:     .78rem;
    line-height:   1.6;
    color:         var(--ccb-text-muted);
    margin-bottom: 8px;
}
.ccb-legal-content a { color: var(--ccb-accent); }
.ccb-legal-ref {
    font-size:  .72rem !important;
    color:      #475569 !important;
    font-style: italic;
    border-top: 1px solid var(--ccb-border);
    padding-top: 8px;
    margin-top:  8px !important;
}

/* ── FOOTER ────────────────────────────────────────────────────────────────── */
.ccb-footer {
    display:   flex;
    gap:       10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.ccb-btn {
    padding:       9px 20px;
    border-radius: 8px;
    font-size:     .875rem;
    font-weight:   600;
    border:        none;
    cursor:        pointer;
    transition:    background .2s, transform .1s;
    white-space:   nowrap;
}
.ccb-btn:active { transform: scale(.97); }

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

.ccb-btn-refuse {
    background: var(--ccb-surface2);
    color:      var(--ccb-text-muted);
    border:     1px solid var(--ccb-border);
}
.ccb-btn-refuse:hover { background: #2d3350; color: #fff; }

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

.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(0,0,0,.6);
    backdrop-filter: blur(4px);
    z-index:  calc(var(--ccb-z) + 1);
}

#pa-cookie-panel {
    position:      fixed;
    top:           50%;
    left:          50%;
    transform:     translate(-50%, -50%);
    width:         min(820px, calc(100vw - 32px));
    max-height:    88vh;
    overflow-y:    auto;
    background:    var(--ccb-bg);
    border:        1px solid var(--ccb-border);
    border-radius: var(--ccb-radius);
    box-shadow:    var(--ccb-shadow);
    z-index:       calc(var(--ccb-z) + 2);
    color:         var(--ccb-text);
    animation:     ccbFadeIn .25s ease both;
}

@keyframes ccbFadeIn {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

.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.1rem;
    font-weight: 700;
}
.ccb-panel-close {
    background:    none;
    border:        none;
    color:         var(--ccb-text-muted);
    font-size:     1.3rem;
    cursor:        pointer;
    padding:       4px 8px;
    border-radius: 6px;
    transition:    background .15s;
}
.ccb-panel-close:hover { background: var(--ccb-surface2); color: #fff; }

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

.ccb-panel-footer {
    border-top:  1px solid var(--ccb-border);
    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-surface2);
    padding:       1px 5px;
    border-radius: 4px;
    font-size:     .72rem;
}

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

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

/* ── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .ccb-inner { padding: 18px 16px 16px; }
    .ccb-footer { flex-direction: column; }
    .ccb-btn { width: 100%; text-align: center; }
    .ccb-panel-inner { padding: 18px 16px; }
    .ccb-panel-footer { flex-direction: column; }
    .ccb-panel-actions { flex-direction: column; width: 100%; }
    .ccb-panel-actions .ccb-btn { width: 100%; }
}
#ccb-float-btn { display: none !important; }

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

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