/* ============================================================
   Banner cookie — Area Riservata, AdminPanel, Area Partner
   ------------------------------------------------------------
   Spunta dal basso quando la pagina e' pronta. Rifiuta e
   Accetta hanno lo stesso peso: e' un obbligo, non un gusto.
   Sta sotto la finestra dei documenti legali,
   perche' le policy si aprono proprio da qui.
   ============================================================ */

.haccp-cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2146483000;
    display: flex;
    justify-content: center;
    padding: 0 20px 20px;
    pointer-events: none;
}

.haccp-cookie-card {
    position: relative;
    pointer-events: auto;
    width: min(880px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 28px;
    padding: 22px 26px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .18);

    /* la comparsa */
    opacity: 0;
    transform: translateY(22px) scale(.985);
    transition: opacity .34s cubic-bezier(.2, .8, .3, 1),
                transform .42s cubic-bezier(.2, .9, .25, 1);
}
.haccp-cookie-banner.is-visible .haccp-cookie-card {
    opacity: 1;
    transform: none;
}

/* la riga blu in cima: e' il segno del sito, non un'icona a caso */
.haccp-cookie-card::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 26px;
    right: 26px;
    height: 2px;
    background: #2563eb;
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .6s cubic-bezier(.2, .9, .25, 1) .12s;
}
.haccp-cookie-banner.is-visible .haccp-cookie-card::before { transform: scaleX(1); }

.haccp-cookie-x {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #94a3b8;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease;
}
.haccp-cookie-x:hover { background: #f1f5f9; color: #0f172a; }

.haccp-cookie-content { min-width: 0; padding-right: 26px; }

.haccp-cookie-title {
    margin: 0 0 6px;
    font-size: 1.02rem;
    font-weight: 560;
    letter-spacing: -.015em;
    color: #0f172a;
}

.haccp-cookie-message {
    margin: 0;
    font-size: .86rem;
    line-height: 1.6;
    color: #475569;
}

.haccp-cookie-nota {
    margin: 8px 0 0;
    font-size: .8rem;
    line-height: 1.55;
    color: #64748b;
}

.haccp-cookie-links {
    margin: 10px 0 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
    font-size: 10.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.haccp-cookie-links a { color: #2563eb; text-decoration: none; border-bottom: 1px solid currentColor; }
.haccp-cookie-links span { color: #94a3b8; }

.haccp-cookie-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.haccp-btn {
    min-height: 44px;
    padding: 0 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: .84rem;
    font-weight: 600;
    letter-spacing: .02em;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

/* "Rifiuta" e "Accetta": stessa forma, stessa dimensione, stesso rilievo.
   Cambia solo il colore, e nessuno dei due e' spento. */
.haccp-btn-pari {
    background: #fff;
    border-color: #0f172a;
    color: #0f172a;
}
.haccp-btn-pari:hover { background: #f1f5f9; }

.haccp-btn-si {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}
.haccp-btn-si:hover { background: #2563eb; border-color: #2563eb; }

/* "Personalizza" e' una terza via, non una scorciatoia per accettare:
   resta leggibile ma non compete con le due scelte principali. */
.haccp-btn-quiet {
    background: transparent;
    border-color: transparent;
    color: #475569;
    text-decoration: underline;
    text-underline-offset: 4px;
    padding: 0 8px;
}
.haccp-btn-quiet:hover { color: #0f172a; }

.haccp-btn:focus-visible,
.haccp-cookie-x:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* ---------- pannello delle preferenze ---------- */

.haccp-cookie-modal {
    position: fixed;
    inset: 0;
    z-index: 2146483500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .26s ease, visibility .26s ease;
}
.haccp-cookie-modal.is-visible { opacity: 1; visibility: visible; }

.haccp-cookie-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .58);
    backdrop-filter: blur(4px);
}

.haccp-cookie-modal-content {
    position: relative;
    width: min(600px, 100%);
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 40px 90px rgba(15, 23, 42, .34);
    transform: translateY(16px) scale(.985);
    transition: transform .3s cubic-bezier(.2, .8, .3, 1);
}
.haccp-cookie-modal.is-visible .haccp-cookie-modal-content { transform: none; }

.haccp-cookie-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e8ebef;
}
.haccp-cookie-modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 560;
    letter-spacing: -.015em;
    color: #0f172a;
}
.haccp-cookie-modal-close {
    margin-left: auto;
    width: 40px;
    height: 40px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: transparent;
    color: #475569;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.haccp-cookie-modal-close:hover { background: #0f172a; border-color: #0f172a; color: #fff; }

.haccp-cookie-modal-body {
    overflow-y: auto;
    padding: 20px 24px 24px;
}

.haccp-cookie-category {
    padding: 16px 0;
    border-bottom: 1px solid #e8ebef;
}
.haccp-cookie-category:last-of-type { border-bottom: 0; }
.haccp-cookie-category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 6px;
}
.haccp-cookie-category-head strong {
    font-size: .95rem;
    font-weight: 560;
    color: #0f172a;
}
.haccp-cookie-category p {
    margin: 0;
    font-size: .84rem;
    line-height: 1.6;
    color: #475569;
}
.haccp-cookie-required {
    font-family: inherit;
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #94a3b8;
}

.haccp-cookie-switch {
    position: relative;
    flex: 0 0 auto;
    width: 48px;
    height: 28px;
    cursor: pointer;
}
.haccp-cookie-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}
.haccp-cookie-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #D7DBE0;
    transition: background-color .22s ease;
}
.haccp-cookie-slider::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .3);
    transition: transform .24s cubic-bezier(.2, .8, .3, 1);
}
.haccp-cookie-switch input:checked + .haccp-cookie-slider { background: #2563eb; }
.haccp-cookie-switch input:checked + .haccp-cookie-slider::after { transform: translateX(20px); }
.haccp-cookie-switch input:focus-visible + .haccp-cookie-slider { outline: 2px solid #2563eb; outline-offset: 2px; }

.haccp-cookie-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid #e8ebef;
    background: #f1f5f9;
    border-radius: 0 0 14px 14px;
}

.haccp-sr {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- telefono ---------- */

@media (max-width: 720px) {
    .haccp-cookie-banner { padding: 0 12px 12px; }
    .haccp-cookie-card {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 20px 20px 22px;
    }
    .haccp-cookie-card::before { left: 20px; right: 20px; }
    .haccp-cookie-content { padding-right: 34px; }
    .haccp-cookie-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    /* Le due scelte pari restano affiancate e identiche; "Personalizza"
       prende una riga sua e non ruba spazio a nessuna delle due. */
    .haccp-btn-quiet { grid-column: 1 / -1; order: 2; min-height: 40px; }
    .haccp-btn-pari { order: 1; padding: 0 12px; }

    .haccp-cookie-modal { padding: 0; align-items: flex-end; }
    .haccp-cookie-modal-content {
        width: 100%;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
        border-bottom: 0;
    }
    .haccp-cookie-modal-footer { border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .haccp-cookie-card,
    .haccp-cookie-card::before,
    .haccp-cookie-modal,
    .haccp-cookie-modal-content,
    .haccp-cookie-slider,
    .haccp-cookie-slider::after {
        transition: none;
    }
    .haccp-cookie-card { transform: none; }
    .haccp-cookie-card::before { transform: scaleX(1); }
}
