/*-------------------------------------------------------------------------*/
/* Copyright (c) DELTA X MULTIMEDIA                                        */
/* Tutti i diritti sono riservati - All rights reserved                    */
/* https://www.deltaxmultimedia.it - info@deltaxmultimeida.it              */
/* CSS Document                                                            */
/*-------------------------------------------------------------------------*/
/* Compliance Cookie  - v.3.01 March 2021                                  */
/*-------------------------------------------------------------------------*/

.cookie-wrapper {
    position: relative;
    /* per isolare z-index dei figli */
    z-index: 9990;
    /* leggermente sotto la modale */
}

/* Banner */
.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    /*background: linear-gradient(135deg, #e6e6e6, #ffffff);*/
    border: 2px solid #dbdbdb;
    box-shadow: 0 0px 30px rgba(0, 0, 0, 0.1);
    padding: 20px;

    flex-direction: column;

    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    z-index: 9999;
    opacity: 0;
    transition: opacity 1s ease;
    margin: 40px;
}


.cookie-banner.show {
    opacity: 1;
}

.cookie-content {
    display: flex;
    gap: 16px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.cookie-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    color: #000;
}

.cookie-text {
    min-width: 0;
    color: #555;
    font-size: 14px;
}

.cookie-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-cookie-actions {

    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 20px;

}

.btn {
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: #111;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.btn.secondary {
    background: transparent;
    color: #111;
    border-color: #ddd;
    transition: background-color 0.3s ease;
}

.btn.secondary:hover {
    background-color: #c2e7ff !important;
}

.btn.ghost {
    background: transparent;
    color: #444;
}

.btn.ghost:hover {
    /*background-color: #e9e9e9;*/
    background-color: #ffe7e4 !important;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    /* Rimuoviamo align-items: center per permettere lo scroll dal top */
    /* align-items: center; */
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;

    /*  NOVITÀ: Permette alla modale di scorrere se il contenuto è troppo alto */
    overflow-y: auto;
    /*  NOVITÀ: Aggiunge spazio verticale sopra e sotto, visibile quando c'è scroll */
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal .backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
}

.modal .panel {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    width: min(720px, 96vw);
    max-height: none;
    overflow: hidden;

    /*  NOVITÀ: Aggiunge margine per centrare il pannello all'interno del contenitore scorrevole */
    margin: auto 20px;

    z-index: 999;
}

.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 16px;
}

.panel-desc {
    font-size: 14px;
}

#close-modal {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

.prefs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.pref-row {
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 8px;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}

.pref-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pref-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
}

.pref-desc {
    font-size: 14px;
    color: #666;
    margin-left: 28px;
    /* opzionale per allineare al testo sopra */
    padding-top: 6px;
    border-top: 1px solid #f0f0f0;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    font-family: "dxm-icons";
    color: white;
    font-size: 12px;
    line-height: 1;
    background-color: white;
    transition: .4s;
    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    transition:
        transform 0.4s ease,
        background-color 0.4s ease,
        color 0.4s ease,
        opacity 0.4s ease;
    /* transizione dell’icona */

    opacity: 1;

}

/* Regola CSS per eliminare l'animazione durante il setup/reset (come concordato) */
body.no-transition-load .switch .slider,
body.no-transition-load .switch .slider::before {
    transition: none !important;
}


input:checked+.slider {
    background-color: #0e7042;
}

input:checked+.slider:before {
    transform: translateX(24px);
    content: "\e901";
    /* icona checked */
    font-weight: 600;
    color: #0e7042;
    opacity: 1;
}

.switch-fixed input:checked+.slider {
    background-color: #76ad95;
}

@media (max-width:700px) {

    .cookie-banner {
        flex-direction: column;
        align-items: stretch;
        margin: 20px;
        gap: 12px;
    }

    .cookie-actions {
        display: flex;
        justify-content: space-between;
        /* distribuisce spazio tra pulsanti */
        flex-wrap: wrap;
        /* se serve per ridurre larghezza */
    }


    .modal-cookie-actions {
        display: flex;
        justify-content: space-between;
        /* distribuisce spazio tra pulsanti */
        flex-wrap: wrap;
        /* se serve per ridurre larghezza */
    }



    .panel-desc {
        font-size: 13px;
    }

    .pref-title {
        font-size: 15px;
        font-weight: 500;
    }

    .pref-desc {
        font-size: 12px;
    }

    /* Pulsante Preferenze allineato a start */
    #open-settings,
    #modal-accept-all {
        margin-right: auto;
        /* spinge gli altri a destra */
    }

    /* Pulsanti Rifiuta e Accetta restano a destra */
    #reject-all,
    #accept-all,
    #modal-reject,
    #save-prefs {
        margin-left: 8px;
        /* spazio tra di loro */
    }
}


@media (max-width:480px) {

    #cookie-banner-more-info {
        display: none;
    }

    .cookie-text {
        font-size: 12px;
    }

    .cookie-actions {
        display: grid;
        grid-template-columns: auto 1fr auto;
        /* due colonne flessibili + una fissa */
        gap: 10px;
        width: 100%;
    }


    .modal-cookie-actions {
        display: grid;
        grid-template-columns: 1fr 1fr auto;
        /* due colonne flessibili + una fissa */
        gap: 10px;
        width: 100%;
    }

    .modal-cookie-actions .btn,
    .cookie-actions .btn {
        width: 100%;
        text-align: center;
        padding: 10px;
    }

    /* Pulsante Preferenze allineato a start */
    #open-settings,
    #modal-accept-all {
        margin-right: inherit;
        /* spinge gli altri a destra */
    }

    /* Pulsanti Rifiuta e Accetta restano a destra */
    #reject-all,
    #accept-all,
    #modal-reject,
    #save-prefs {
        margin-left: inherit;
        /* spazio tra di loro */
    }
}

@media (max-width:406px) {

    .cookie-actions {
        display: flex;
        flex-direction: row;
    }
}

@media (max-width:380px) {

    .modal-cookie-actions {
        display: flex;
        flex-direction: row;
    }
}