/* ----------------------------------------------------------------
   Chiaromondo – banner e preferenze cookie (vedi js/cm-cookie.js)
   Mobile first: su smartphone il banner occupa la parte bassa dello
   schermo con pulsanti a tutta larghezza; da tablet in su diventa una
   barra orizzontale.
------------------------------------------------------------------- */
.cmc-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    background: #fff;
    color: #2b2f36;
    border-top: 4px solid #1c2e4f;
    box-shadow: 0 -6px 30px rgba(10, 18, 33, 0.25);
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(110%);
    visibility: hidden;
    transition: transform .45s ease, visibility .45s;
    font-family: 'Source Sans 3', 'Myriad Pro', Arial, sans-serif;
}
.cmc-banner.cmc-visibile {
    transform: translateY(0);
    visibility: visible;
}
.cmc-banner p,
.cmc-modale p {
    font-family: inherit;
    font-size: 14.5px;
    line-height: 1.5em;
    color: #2b2f36;
    margin: 0 0 10px;
    letter-spacing: 0;
}
.cmc-banner a,
.cmc-modale a {
    color: #1c2e4f;
    font-weight: 600;
    text-decoration: underline;
    display: inline;
}
.cmc-titolo {
    font-size: 17px !important;
    font-weight: 700;
    color: #1c2e4f !important;
    margin-bottom: 6px !important;
    padding-right: 36px;
}
/* smartphone: Rifiuta e Accetta affiancati (stesso peso), Personalizza sotto */
.cmc-azioni {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 6px;
}
.cmc-banner .cmc-azioni [data-cmc="personalizza"] {
    grid-column: 1 / -1;
    order: 3;
}
.cmc-modale .cmc-azioni [data-cmc="salva"] {
    grid-column: 1 / -1;
    order: 3;
}
/* Accetta e Rifiuta hanno lo stesso peso visivo (nessun "dark pattern") */
.cmc-btn {
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1.2em;
    min-height: 46px;
    padding: 12px 20px;
    border-radius: 30px;
    border: 1.5px solid #1c2e4f;
    background: #1c2e4f;
    color: #fff;
    cursor: pointer;
    width: 100%;
    transition: background .2s, color .2s;
}
.cmc-btn:hover,
.cmc-btn:focus-visible {
    background: #15233d;
    border-color: #15233d;
    color: #fff;
}
.cmc-btn-link {
    background: #fff;
    color: #1c2e4f;
}
.cmc-btn-link:hover,
.cmc-btn-link:focus-visible {
    background: #eef2f7;
    color: #1c2e4f;
    border-color: #1c2e4f;
}
.cmc-btn:focus-visible,
.cmc-x:focus-visible,
.cmc-switch input:focus-visible + .cmc-slider {
    outline: 3px solid #5ab4e6;
    outline-offset: 2px;
}
.cmc-x {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #1c2e4f;
    font-size: 30px;
    line-height: 44px;
    letter-spacing: 0;
    cursor: pointer;
    border-radius: 50%;
}
.cmc-x:hover {
    background: #eef2f7;
    color: #1c2e4f;
    border: 0;
}

/* ---------- finestra preferenze ---------- */
html.cmc-bloccato,
html.cmc-bloccato body {
    overflow: hidden !important;
}
.cmc-overlay {
    position: fixed;
    inset: 0;
    z-index: 100001;
    background: rgba(10, 18, 33, 0.6);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.cmc-overlay[hidden] {
    display: none;
}
.cmc-modale {
    position: relative;
    width: 100%;
    max-width: 620px;
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
    font-family: 'Source Sans 3', 'Myriad Pro', Arial, sans-serif;
    outline: none;
}
.cmc-intro {
    margin-bottom: 14px !important;
}
.cmc-cat {
    border-top: 1px solid #e3e8ef;
    padding: 14px 0 6px;
}
.cmc-cat-testa {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}
.cmc-cat-titolo {
    font-weight: 700;
    color: #1c2e4f;
    font-size: 15.5px;
    margin: 0;
    cursor: pointer;
}
.cmc-cat-titolo span {
    font-weight: 400;
    color: #6b7280;
    font-size: 13px;
}
.cmc-cat p {
    font-size: 13.5px;
    color: #4b5563;
}
.cmc-switch {
    position: relative;
    flex: 0 0 52px;
    width: 52px;
    height: 30px;
}
.cmc-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}
.cmc-switch input:disabled {
    cursor: not-allowed;
}
.cmc-slider {
    position: absolute;
    inset: 0;
    background: #c3cad6;
    border-radius: 30px;
    transition: background .2s;
}
.cmc-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform .2s;
}
.cmc-switch input:checked + .cmc-slider {
    background: #1c2e4f;
}
.cmc-switch input:checked + .cmc-slider::before {
    transform: translateX(22px);
}
.cmc-switch input:disabled + .cmc-slider {
    opacity: .55;
}
.cmc-modale .cmc-azioni {
    border-top: 1px solid #e3e8ef;
    padding-top: 14px;
}

/* link "Preferenze cookie" nel footer */
button.cm-link-cookie {
    display: inline;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    letter-spacing: 0;
    text-transform: none;
    color: inherit;
    cursor: pointer;
    text-decoration: none;
    line-height: inherit;
}
button.cm-link-cookie:hover {
    background: none;
    border: 0;
    color: #fff;
    text-decoration: underline;
}

/* ---------- tablet e desktop ---------- */
@media (min-width: 768px) {
    .cmc-banner {
        display: flex;
        align-items: center;
        gap: 28px;
        padding: 20px 64px 20px 32px;
    }
    .cmc-banner-testo {
        flex: 1 1 auto;
    }
    .cmc-banner .cmc-azioni,
    .cmc-modale .cmc-azioni {
        display: flex;
        flex-direction: row;
    }
    .cmc-banner .cmc-azioni {
        flex: 0 0 auto;
        margin: 0;
    }
    .cmc-azioni [data-cmc] {
        order: 0 !important;
    }
    .cmc-banner .cmc-btn {
        width: auto;
        white-space: nowrap;
    }
    .cmc-banner .cmc-titolo {
        padding-right: 0;
    }
    .cmc-overlay {
        align-items: center;
        padding: 20px;
    }
    .cmc-modale {
        border-radius: 14px;
        padding: 28px 30px;
    }
    .cmc-modale .cmc-azioni {
        justify-content: flex-end;
    }
    .cmc-modale .cmc-btn {
        width: auto;
    }
}
@media (prefers-reduced-motion: reduce) {
    .cmc-banner,
    .cmc-slider,
    .cmc-slider::before {
        transition: none;
    }
}
