/* ==========================================================
   Cookie banner - Cartomanzia Infinita
   Sfondo nero, testi bianchi, pulsanti blu
   ========================================================== */
:root {
    --cc-bg: #000000;
    --cc-text: #ffffff;
    --cc-muted: #d0d0d0;
    --cc-blue: #1a73e8;
    --cc-blue-hover: #1557b0;
    --cc-border: #2a2a2a;
    --cc-font: var(--font-body, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
}

.cc-banner[hidden], .cc-modal-backdrop[hidden], .cc-recall[hidden] { display: none !important; }

/* ---------- Banner ---------- */
.cc-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 2147483000;
    background: var(--cc-bg);
    color: var(--cc-text);
    border-top: 1px solid var(--cc-border);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.6);
    font-family: var(--cc-font);
    font-size: 0.92rem;
    line-height: 1.55;
    padding: 1.4rem 3.2rem 1.4rem 4%;
    outline: none;
    animation: cc-slide-up 0.35s ease-out;
}

@keyframes cc-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

.cc-banner-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.cc-banner-text { flex: 1; }
.cc-banner p, .cc-modal p { margin: 0 0 0.4rem; color: var(--cc-text); }
.cc-title { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.3px; }
.cc-banner a, .cc-modal a { color: var(--cc-text); text-decoration: underline; text-underline-offset: 2px; }
.cc-banner a:hover, .cc-modal a:hover { color: #9ec5ff; }
.cc-banner strong { color: var(--cc-text); }

.cc-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.cc-btn {
    appearance: none;
    border: 0;
    border-radius: 6px;
    background: var(--cc-blue);
    color: #ffffff;
    font-family: var(--cc-font);
    font-size: 0.92rem;
    font-weight: 600;
    padding: 0.75rem 1.4rem;
    min-width: 130px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    line-height: 1.2;
}
.cc-btn:hover { background: var(--cc-blue-hover); }
.cc-btn:focus-visible, .cc-close:focus-visible, .cc-recall:focus-visible,
.cc-switch input:focus-visible + .cc-slider, .cc-details summary:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.cc-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    width: 36px; height: 36px;
    border: 0;
    background: transparent;
    color: var(--cc-text);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}
.cc-close:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------- Pannello preferenze ---------- */
.cc-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2147483001;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.cc-modal {
    position: relative;
    background: var(--cc-bg);
    color: var(--cc-text);
    border: 1px solid var(--cc-border);
    border-radius: 10px;
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    font-family: var(--cc-font);
    font-size: 0.92rem;
    line-height: 1.55;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}
.cc-modal > .cc-title { padding: 1.4rem 3.5rem 0.6rem 1.5rem; margin: 0; font-size: 1.2rem; }
.cc-modal-body { padding: 0 1.5rem 1rem; overflow-y: auto; }

.cc-cat {
    border: 1px solid var(--cc-border);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    margin: 0.9rem 0;
}
.cc-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.cc-cat-title { font-weight: 700; font-size: 1rem; }
.cc-cat-desc { color: var(--cc-muted) !important; margin: 0.5rem 0 0.3rem !important; }
.cc-always { font-size: 0.8rem; color: var(--cc-muted); white-space: nowrap; }

.cc-details summary { cursor: pointer; color: var(--cc-text); font-size: 0.85rem; text-decoration: underline; }
.cc-details ul { margin: 0.5rem 0 0 1.1rem; padding: 0; list-style: disc; color: var(--cc-muted); font-size: 0.85rem; }
.cc-details li { margin-bottom: 0.25rem; }

/* Interruttore */
.cc-switch { display: flex; align-items: center; gap: 0.9rem; cursor: pointer; flex: 1; justify-content: space-between; }
.cc-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cc-slider {
    position: relative;
    width: 46px; height: 26px;
    background: #4a4a4a;
    border-radius: 26px;
    flex-shrink: 0;
    transition: background-color 0.2s;
}
.cc-slider::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.2s;
}
.cc-switch input:checked + .cc-slider { background: var(--cc-blue); }
.cc-switch input:checked + .cc-slider::after { transform: translateX(20px); }
.cc-switch input:disabled + .cc-slider { opacity: 0.6; cursor: not-allowed; }

.cc-meta { font-size: 0.78rem; color: var(--cc-muted) !important; margin-top: 0.8rem !important; word-break: break-all; }
.cc-meta code { color: var(--cc-text); }

.cc-actions-modal {
    padding: 1rem 1.5rem 1.3rem;
    border-top: 1px solid var(--cc-border);
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ---------- Pulsante di richiamo (in basso a destra) ---------- */
.cc-recall {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 2147482999;
    width: 48px; height: 48px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background: var(--cc-blue);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s, background-color 0.2s;
    padding: 0;
}
.cc-recall:hover { background: var(--cc-blue-hover); transform: scale(1.06); }

html.cc-noscroll, html.cc-noscroll body { overflow: hidden; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
    .cc-banner { padding: 1.2rem 1rem 1rem; }
    .cc-banner-inner { flex-direction: column; align-items: stretch; gap: 1rem; }
    .cc-banner-text { padding-right: 2rem; }
    .cc-actions { flex-direction: column; }
    .cc-btn { width: 100%; }
    .cc-banner { max-height: 85vh; overflow-y: auto; }
}

@media (max-width: 480px) {
    .cc-banner { font-size: 0.85rem; }
    .cc-modal-backdrop { padding: 0; align-items: flex-end; }
    .cc-modal { max-height: 92vh; border-radius: 10px 10px 0 0; }
    .cc-actions-modal { flex-direction: column; }
    .cc-recall { right: 12px; bottom: 12px; width: 44px; height: 44px; }
}

@media print { .cc-banner, .cc-modal-backdrop, .cc-recall { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .cc-banner { animation: none; } }
