/* =============================================
   WooBiller - Cookie Consent Banner + Modal + FAB
   GDPR / Garante 10 giugno 2021 compliant
   ============================================= */

/* --- Reset minimo per i bottoni interni al consent --- */
.consent-banner button,
.consent-modal button,
.consent-fab { font-family: inherit; }

/* --- Pulsanti dedicati al consent (no clash con .button del sito) --- */
.consent-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}
.consent-btn:hover { transform: translateY(-1px); }
.consent-btn--primary {
    background: var(--navy);
    color: #fff;
    box-shadow: 0 10px 24px rgba(7,20,43,.18);
}
.consent-btn--primary:hover { background: var(--navy-2); }
.consent-btn--outline {
    background: #fff;
    color: var(--ink);
    border-color: var(--line);
}
.consent-btn--outline:hover { border-color: var(--blue); color: var(--blue); }
.consent-btn--ghost {
    background: transparent;
    color: var(--muted);
}
.consent-btn--ghost:hover { color: var(--ink); background: rgba(7,20,43,.04); }

/* --- Banner --- */
.consent-banner {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: 760px;
    margin: 0 auto;
    z-index: 1200;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 24px 60px rgba(7,20,43,.18);
    padding: 24px;
    display: none;
    animation: consentSlideIn .35s ease-out;
}
.consent-banner--open { display: block; }

@keyframes consentSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.consent-banner__title {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 10px;
}
.consent-banner__title svg { color: var(--blue); flex-shrink: 0; }

.consent-banner__text {
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--muted);
    margin: 0 0 16px;
}
.consent-banner__text a {
    color: var(--blue);
    text-decoration: underline;
    font-weight: 600;
}
.consent-banner__text a:hover { color: #1954ca; }

.consent-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

/* --- Modal preferenze --- */
.consent-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(7, 20, 43, .55);
    z-index: 1300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: consentFadeIn .2s ease-out;
}
.consent-modal__backdrop--open { display: flex; }

@keyframes consentFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.consent-modal {
    background: #fff;
    border-radius: var(--radius);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 30px 80px rgba(7,20,43,.28);
    border: 1px solid var(--line);
    animation: consentSlideIn .3s ease-out;
}
.consent-modal__header {
    padding: 22px 24px 14px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.consent-modal__title { font-size: 18px; font-weight: 800; color: var(--ink); margin: 0; }
.consent-modal__close {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
    border: 0;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background-color .2s ease, color .2s ease;
}
.consent-modal__close:hover { background: #f1f5fb; color: var(--ink); }

.consent-modal__body { padding: 18px 24px; }
.consent-modal__intro {
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.6;
    margin: 0 0 16px;
}
.consent-modal__intro a { color: var(--blue); text-decoration: underline; font-weight: 600; }

.consent-cat {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: #fbfdff;
}
.consent-cat__main { flex: 1; min-width: 0; }
.consent-cat__title {
    font-size: 14px;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.consent-cat__locked {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--blue-soft);
    color: #1954ca;
    padding: 3px 8px;
    border-radius: 999px;
}
.consent-cat__desc {
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.55;
    margin: 0;
}

/* iOS-like switch */
.consent-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}
.consent-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.consent-switch__track {
    position: absolute;
    inset: 0;
    background: #cbd6e6;
    border-radius: 999px;
    transition: background-color .2s ease;
    cursor: pointer;
}
.consent-switch__track::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: transform .2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.consent-switch input:checked + .consent-switch__track { background: var(--blue); }
.consent-switch input:checked + .consent-switch__track::before { transform: translateX(20px); }
.consent-switch input:disabled + .consent-switch__track { opacity: .55; cursor: not-allowed; }

.consent-modal__footer {
    padding: 16px 24px 22px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

/* --- Floating Action Button (riapertura preferenze) --- */
.consent-fab {
    position: fixed;
    bottom: 18px;
    left: 18px;
    z-index: 1100;
    width: 50px;
    height: 50px;
    border-radius: 999px;
    background: var(--navy);
    color: #fff;
    border: 0;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(7,20,43,.28);
    display: none;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.consent-fab--visible { display: inline-flex; }
.consent-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(7,20,43,.34);
    background: var(--navy-2);
}
.consent-fab:focus-visible {
    outline: 3px solid var(--blue-soft);
    outline-offset: 2px;
}
.consent-fab svg { width: 24px; height: 24px; }

/* --- Mobile --- */
@media (max-width: 640px) {
    .consent-banner {
        bottom: 12px;
        left: 12px;
        right: 12px;
        padding: 18px;
        border-radius: 18px;
    }
    .consent-banner__actions { justify-content: stretch; }
    .consent-banner__actions .consent-btn { flex: 1 1 auto; }
    .consent-modal { border-radius: 18px; }
    .consent-modal__footer { justify-content: stretch; }
    .consent-modal__footer .consent-btn { flex: 1 1 auto; }
    .consent-fab { width: 46px; height: 46px; bottom: 14px; left: 14px; }
    .consent-fab svg { width: 22px; height: 22px; }
}
