/* ============================================================
   MultiSphera admin — banner consenso cookie (.msc-*) e link legali
   (.legal-links). Caricato da app/Views/partials/cookie_banner.php.
   Nessuna dipendenza da Bootstrap; palette CIAS (#ba243d) in linea
   con auth-modern.css; tema scuro via [data-bs-theme="dark"].
   ============================================================ */
.msc {
    --msc-primary: #ba243d;
    --msc-primary-hover: #9d1e35;
    --msc-bg: #ffffff;
    --msc-text: #2c3e50;
    --msc-muted: #6b7280;
    --msc-border: #d0d4da;
    --msc-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
    --msc-track: #cbd0d6;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.925rem;
    line-height: 1.45;
    color: var(--msc-text);
}
/* L'attributo hidden deve vincere sui display espliciti qui sotto anche dove
   non è caricato il reset di Bootstrap (es. pagine legali). */
.msc[hidden],
.msc [hidden] { display: none !important; }
.msc, .msc *, .msc *::before, .msc *::after { box-sizing: border-box; }
[data-bs-theme="dark"] .msc {
    --msc-bg: #1b1e2e;
    --msc-text: #e2e8f0;
    --msc-muted: #9aa3bd;
    --msc-border: #3e4160;
    --msc-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
    --msc-track: #4a4f6a;
}

/* ---- banner di primo livello (in basso, fisso) ---- */
.msc-banner {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    width: min(960px, calc(100% - 32px));
    z-index: 10600;
    background: var(--msc-bg);
    border: 1px solid var(--msc-border);
    border-radius: 14px;
    box-shadow: var(--msc-shadow);
    padding-block: 20px;
    padding-inline: 24px 56px;
}
.msc-title {
    margin: 0 0 8px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--msc-text);
}
.msc-text {
    margin: 0 0 14px;
    color: var(--msc-text);
}
.msc-link,
.msc-link:visited {
    color: var(--msc-primary);
    text-decoration: underline;
}
.msc-link:hover { color: var(--msc-primary-hover); }

.msc-close {
    position: absolute;
    top: 10px;
    inset-inline-end: 12px;
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    color: var(--msc-muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
}
.msc-close:hover,
.msc-close:focus-visible { color: var(--msc-text); background: rgba(127, 127, 127, 0.15); outline: none; }

/* Tre azioni di pari evidenza: stessa dimensione, stesso stile */
.msc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.msc-btn {
    flex: 1 1 180px;
    min-height: 42px;
    padding: 8px 16px;
    border: 2px solid var(--msc-primary);
    border-radius: 8px;
    background: transparent;
    color: var(--msc-primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.msc-btn:hover,
.msc-btn:focus-visible {
    background: var(--msc-primary);
    color: #fff;
    outline: none;
}
.msc-btn:focus-visible { box-shadow: 0 0 0 3px rgba(186, 36, 61, 0.35); }
.msc-btn-primary { background: var(--msc-primary); color: #fff; }
.msc-btn-primary:hover { background: var(--msc-primary-hover); border-color: var(--msc-primary-hover); }

/* ---- pannello di secondo livello (modale) ---- */
.msc-overlay {
    position: fixed;
    inset: 0;
    z-index: 10650;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.msc-panel {
    position: relative;
    width: min(680px, 100%);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: var(--msc-bg);
    border: 1px solid var(--msc-border);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    padding: 22px 24px 18px;
}
.msc-panel:focus { outline: none; }
.msc-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}
.msc-panel-head .msc-close { position: static; }
body.msc-lock { overflow: hidden; }

.msc-cats {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}
.msc-cat {
    padding: 12px 0;
    border-top: 1px solid var(--msc-border);
}
.msc-cat-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.msc-cat-label {
    flex: 1;
    font-weight: 600;
    cursor: pointer;
}
.msc-always {
    font-size: 0.8rem;
    color: var(--msc-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.msc-cat-text { margin: 6px 0 0; color: var(--msc-muted); }
.msc-cat-unused {
    margin: 4px 0 0;
    font-size: 0.82rem;
    font-style: italic;
    color: var(--msc-muted);
}

/* Interruttore accessibile: input nativo stilizzato, resta un checkbox */
.msc-switch {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    margin: 0;
    border-radius: 12px;
    background: var(--msc-track);
    position: relative;
    cursor: pointer;
    transition: background 0.15s ease;
    flex: 0 0 auto;
}
.msc-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease;
}
.msc-switch:checked { background: var(--msc-primary); }
.msc-switch:checked::after { transform: translateX(20px); }
.msc-switch:disabled { opacity: 0.6; cursor: not-allowed; }
.msc-switch:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(186, 36, 61, 0.35); }

.msc-panel-foot {
    margin: 14px 0 0;
    font-size: 0.85rem;
    color: var(--msc-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    align-items: baseline;
}
.msc-linkbtn {
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--msc-primary);
    text-decoration: underline;
    cursor: pointer;
}
.msc-linkbtn:hover { color: var(--msc-primary-hover); }
.msc-hint { flex-basis: 100%; }
.msc-status { margin: 8px 0 0; min-height: 1.2em; font-size: 0.85rem; color: var(--msc-muted); }

@media (max-width: 575.98px) {
    .msc-banner { bottom: 0; width: 100%; border-radius: 14px 14px 0 0; padding: 18px 48px 16px 18px; }
    .msc-btn { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .msc-btn, .msc-switch, .msc-switch::after { transition: none; }
}

/* ---- link «Privacy e note legali» nei piè di pagina ---- */
.legal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 0.85rem;
}
.legal-links a {
    color: inherit;
    opacity: 0.85;
    text-decoration: none;
}
.legal-links a:hover,
.legal-links a:focus-visible { opacity: 1; text-decoration: underline; }
.login-left .legal-links { margin-top: 18px; color: rgba(255, 255, 255, 0.85); }
.footer .legal-links { justify-content: flex-end; }
