/**
 * PARTECIPA — Cookie banner self-hosted (D-39). Palette istituzionale navy,
 * bottoni "Accetta tutto" / "Rifiuta tutto" a PARI LARGHEZZA e pari rilievo
 * grafico al primo layer (requisito Garante 2024, LEGAL-01).
 */

/* ── Banner ───────────────────────────────────────────────────────────────── */
.pa-cc {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 99999;
    width: min(680px, calc(100% - 32px));
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(28, 46, 110, 0.18);
    font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.pa-cc__inner { padding: 18px 20px; }
.pa-cc__title { font-size: 1.05rem; margin: 0 0 6px; color: #1C2E6E; font-weight: 700; }
.pa-cc__desc { font-size: 0.9rem; line-height: 1.5; margin: 0 0 14px; }
.pa-cc__desc a { color: #1C2E6E; text-decoration: underline; }

.pa-cc__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* Bottoni d'azione: flex:1 → larghezza identica (delta 0px), pari rilievo navy. */
.pa-cc-btn {
    flex: 1 1 0;
    min-width: 0;
    appearance: none;
    border: 1px solid #1C2E6E;
    background: #1C2E6E;
    color: #ffffff;
    font: inherit;
    font-weight: 600;
    padding: 11px 16px;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    line-height: 1.2;
}
.pa-cc-btn:hover { background: #15235a; border-color: #15235a; }
.pa-cc-btn:focus-visible { outline: 3px solid #B45309; outline-offset: 2px; }

/* "Personalizza" = link, meno prominente (gestione, non scelta binaria). */
.pa-cc-link {
    flex: 0 0 auto;
    appearance: none;
    background: none;
    border: 0;
    color: #1C2E6E;
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    padding: 8px;
}
.pa-cc-link:focus-visible { outline: 3px solid #B45309; outline-offset: 2px; }

/* ── Pannello preferenze ──────────────────────────────────────────────────── */
.pa-cc-prefs {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.5);
    padding: 16px;
}
.pa-cc-prefs[hidden] { display: none; }
.pa-cc-prefs__box {
    background: #ffffff;
    color: #1f2937;
    width: min(560px, 100%);
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 10px;
    padding: 24px;
    font-family: 'Inter', 'Poppins', sans-serif;
}
.pa-cc-prefs__title { margin: 0 0 16px; color: #1C2E6E; font-size: 1.2rem; font-weight: 700; }
.pa-cc-cat {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 0;
    border-top: 1px solid #e5e7eb;
}
.pa-cc-cat p { margin: 4px 0 0; font-size: 0.85rem; color: #4b5563; }
.pa-cc-always { color: #1C2E6E; font-weight: 600; font-size: 0.85rem; white-space: nowrap; }
.pa-cc-prefs__actions { display: flex; gap: 10px; margin-top: 18px; }

/* Switch accessibile */
.pa-cc-switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: 0 0 auto; }
.pa-cc-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pa-cc-switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: background 0.15s; }
.pa-cc-switch span::before { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: transform 0.15s; }
.pa-cc-switch input:checked + span { background: #1C2E6E; }
.pa-cc-switch input:checked + span::before { transform: translateX(20px); }
.pa-cc-switch input:focus-visible + span { outline: 3px solid #B45309; outline-offset: 2px; }

/* Link "Preferenze cookie" nel footer (revoca sempre accessibile). */
.pa-cookie-revoke {
    background: none; border: 0; padding: 0;
    color: inherit; font: inherit;
    text-decoration: underline; cursor: pointer;
}

@media (max-width: 480px) {
    .pa-cc__actions { flex-direction: column; align-items: stretch; }
    .pa-cc-btn { flex: 1 1 auto; }
}
