/* ==========================================================================
   Cookie consent - banner + pannello preferenze (GDPR / Provv. Garante 2021)
   ========================================================================== */

:root {
    --cc-primary: #045072;
    --cc-primary-hover: #0491ce;
    --cc-text: #1c2a30;
    --cc-muted: #5a6a72;
    --cc-border: #d8dfe3;
    --cc-bg: #ffffff;
}

/* --- Banner ------------------------------------------------------------- */

.cc-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background: var(--cc-bg);
    color: var(--cc-text);
    border-top: 3px solid var(--cc-primary);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, .18);
    padding: 18px 16px;
    font-size: .95rem;
    line-height: 1.5;
}

.cc-banner[hidden] {
    display: none !important;
}

.cc-banner__inner {
    max-width: 1140px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.cc-banner__text {
    flex: 1 1 340px;
    min-width: 260px;
}

.cc-banner__title {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cc-primary);
}

.cc-banner__text p {
    margin: 0;
    color: var(--cc-muted);
}

.cc-banner__text a {
    color: var(--cc-primary);
    text-decoration: underline;
}

/* Hover giallo come nel resto del sito (il selettore deve essere almeno
   specifico quanto quello sopra, altrimenti il colore base vince). */
.cc-banner__text a:hover,
.cc-banner__text a:focus-visible,
.cc-modal__intro a:hover,
.cc-modal__intro a:focus-visible {
    color: var(--hover-color, #ffd966);
}

.cc-banner__actions {
    flex: 0 1 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* --- Pulsanti (accetta e rifiuta hanno lo stesso peso visivo) ------------ */

.cc-btn {
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    padding: 11px 20px;
    min-width: 148px;
    border-radius: 6px;
    border: 2px solid var(--cc-primary);
    cursor: pointer;
    text-align: center;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.cc-btn:focus-visible {
    outline: 3px solid var(--cc-primary-hover);
    outline-offset: 2px;
}

.cc-btn--accept,
.cc-btn--reject {
    background: var(--cc-primary);
    color: #fff;
}

    .cc-btn--accept:hover,
    .cc-btn--reject:hover {
        background: var(--cc-primary-hover);
        border-color: var(--cc-primary-hover);
    }

.cc-btn--settings {
    background: transparent;
    color: var(--cc-primary);
    min-width: 0;
    border-color: transparent;
    text-decoration: underline;
    padding: 11px 8px;
}

    .cc-btn--settings:hover {
        color: var(--cc-primary-hover);
    }

.cc-btn--save {
    background: var(--cc-primary);
    color: #fff;
}

    .cc-btn--save:hover {
        background: var(--cc-primary-hover);
        border-color: var(--cc-primary-hover);
    }

.cc-btn--ghost {
    background: transparent;
    color: var(--cc-primary);
}

    .cc-btn--ghost:hover {
        background: rgba(4, 80, 114, .08);
    }

/* Chiusura con "X": non equivale ad accettazione, il banner ricomparira' */
.cc-banner__close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: 0;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--cc-muted);
    cursor: pointer;
    padding: 4px 8px;
}

    .cc-banner__close:hover {
        color: var(--cc-text);
    }

/* --- Pannello preferenze ------------------------------------------------ */

.cc-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, .55);
    overflow-y: auto;
}

.cc-modal[hidden] {
    display: none !important;
}

.cc-modal__dialog {
    background: var(--cc-bg);
    color: var(--cc-text);
    width: 100%;
    max-width: 640px;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.cc-modal__header,
.cc-modal__footer {
    padding: 16px 22px;
}

.cc-modal__header {
    border-bottom: 1px solid var(--cc-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cc-modal__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--cc-primary);
}

.cc-modal__body {
    padding: 6px 22px 16px;
    overflow-y: auto;
}

.cc-modal__intro {
    color: var(--cc-muted);
    font-size: .92rem;
    margin: 14px 0 4px;
}

.cc-modal__footer {
    border-top: 1px solid var(--cc-border);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.cc-modal__close {
    background: none;
    border: 0;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--cc-muted);
    cursor: pointer;
    padding: 0 4px;
}

    .cc-modal__close:hover {
        color: var(--cc-text);
    }

/* --- Singola categoria di cookie ---------------------------------------- */

.cc-group {
    border: 1px solid var(--cc-border);
    border-radius: 8px;
    padding: 14px 16px;
    margin-top: 14px;
}

.cc-group__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cc-group__name {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.cc-group__desc {
    margin: 8px 0 0;
    font-size: .88rem;
    color: var(--cc-muted);
}

.cc-group__always {
    font-size: .85rem;
    font-weight: 700;
    color: #006400;
    white-space: nowrap;
}

/* Interruttore */
.cc-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

    .cc-switch input {
        position: absolute;
        opacity: 0;
        width: 46px;
        height: 26px;
        margin: 0;
        cursor: pointer;
    }

.cc-switch__track {
    width: 46px;
    height: 26px;
    border-radius: 13px;
    background: #b9c3c9;
    transition: background-color .15s ease;
    display: block;
    pointer-events: none;
}

    .cc-switch__track::after {
        content: "";
        display: block;
        width: 20px;
        height: 20px;
        margin: 3px;
        border-radius: 50%;
        background: #fff;
        transition: transform .15s ease;
    }

.cc-switch input:checked + .cc-switch__track {
    background: var(--cc-primary);
}

    .cc-switch input:checked + .cc-switch__track::after {
        transform: translateX(20px);
    }

.cc-switch input:focus-visible + .cc-switch__track {
    outline: 3px solid var(--cc-primary-hover);
    outline-offset: 2px;
}

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 767.98px) {
    .cc-banner__inner {
        flex-direction: column;
        align-items: stretch;
    }

    .cc-banner__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .cc-btn {
        width: 100%;
    }

    .cc-modal__footer {
        flex-direction: column;
    }

        .cc-modal__footer .cc-btn {
            width: 100%;
        }
}
