.cookie-consent[hidden],
.cookie-consent-preferences[hidden] {
    display: none !important;
}

.cookie-consent {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    padding: 0;
}

.cookie-consent__panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.55rem 0.85rem;
    background: rgba(15, 28, 47, 0.97);
    color: #f7f7f4;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
}

.cookie-consent__content {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    flex: 1 1 auto;
}

.cookie-consent__text {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.35;
    color: rgba(247, 247, 244, 0.9);
}

.cookie-consent__policy {
    margin: 0;
    flex-shrink: 0;
    font-size: 0.74rem;
}

.cookie-consent__policy a {
    color: #fff;
    text-decoration: underline;
    white-space: nowrap;
}

.cookie-consent__actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.45rem;
    align-items: center;
    flex-shrink: 0;
}

.cookie-consent__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.38rem 0.75rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
}

.cookie-consent__btn--ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.cookie-consent__btn--ghost:hover,
.cookie-consent__btn--ghost:focus-visible {
    background: rgba(255, 255, 255, 0.08);
}

.cookie-consent__btn--primary {
    background: var(--color-primary, #c9972b);
    color: #1b150a;
    border-color: var(--color-primary, #c9972b);
}

.cookie-consent__btn--primary:hover,
.cookie-consent__btn--primary:focus-visible {
    filter: brightness(1.05);
}

.cookie-consent__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.cookie-consent__close:hover,
.cookie-consent__close:focus-visible {
    background: rgba(255, 255, 255, 0.18);
}

.cookie-consent-preferences {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.cookie-consent-preferences__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 20, 0.62);
}

.cookie-consent-preferences__dialog {
    position: relative;
    width: min(720px, 100%);
    max-height: min(88vh, 860px);
    overflow: auto;
    padding: 1.5rem;
    border-radius: 20px;
    background: #fff;
    color: var(--color-text, #111112);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.22);
}

.cookie-consent__eyebrow {
    margin: 0;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-primary, #c9972b);
    font-weight: 600;
}

.cookie-consent__title {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.3;
}

.cookie-consent-preferences__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.cookie-consent-preferences__close {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
}

.cookie-consent-preferences__intro,
.cookie-consent-category p {
    margin: 0;
    font-size: 0.95rem;
}

.cookie-consent-preferences__intro {
    color: rgba(17, 17, 18, 0.78);
    margin-bottom: 0.65rem;
}

.cookie-consent-preferences__policy {
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.cookie-consent-preferences__policy a {
    color: var(--color-secondary, #0f1c2f);
    text-decoration: underline;
    font-weight: 600;
}

.cookie-consent-preferences__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.cookie-consent-categories {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
    display: grid;
    gap: 0.85rem;
}

.cookie-consent-category {
    padding: 1rem 1.05rem;
    border: 1px solid rgba(15, 28, 47, 0.1);
    border-radius: 14px;
    background: var(--color-bg, #f5f5f2);
}

.cookie-consent-category.is-disabled {
    opacity: 0.72;
}

.cookie-consent-category__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.45rem;
}

.cookie-consent-category__head h3 {
    margin: 0;
    font-size: 1rem;
}

.cookie-consent-category__badge {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-secondary, #0f1c2f);
    background: rgba(201, 151, 43, 0.18);
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    white-space: nowrap;
}

.cookie-consent-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.cookie-consent-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-consent-toggle__track {
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: rgba(15, 28, 47, 0.18);
    transition: background 0.2s ease;
    position: relative;
}

.cookie-consent-toggle__track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease;
}

.cookie-consent-toggle input:checked + .cookie-consent-toggle__track {
    background: var(--color-primary, #c9972b);
}

.cookie-consent-toggle input:checked + .cookie-consent-toggle__track::after {
    transform: translateX(20px);
}

.cookie-consent-toggle input:disabled + .cookie-consent-toggle__track {
    opacity: 0.45;
    cursor: not-allowed;
}

.cookie-consent-fab {
    position: fixed;
    left: 1.25rem;
    bottom: 1.25rem;
    z-index: 1100;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 0.95rem;
    border: 1px solid rgba(15, 28, 47, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--color-secondary, #0f1c2f);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
}

.cookie-consent-fab[hidden] {
    display: none !important;
}

.cookie-consent-fab:hover,
.cookie-consent-fab:focus-visible {
    transform: translateY(-1px);
}

body.cookie-preferences-open {
    overflow: hidden;
}

body.cookie-banner-open .whatsapp-fab {
    bottom: 4.5rem;
}

body.cookie-banner-open .cookie-consent-fab {
    bottom: 4.5rem;
}

@media (max-width: 860px) {
    .cookie-consent__panel {
        flex-wrap: wrap;
        padding: 0.6rem 0.7rem 0.65rem;
    }

    .cookie-consent__content {
        flex-wrap: wrap;
        width: 100%;
    }

    .cookie-consent__actions {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 520px) {
    .cookie-consent__policy {
        width: 100%;
    }

    body.cookie-banner-open .whatsapp-fab {
        bottom: 5.5rem;
    }

    body.cookie-banner-open .cookie-consent-fab {
        bottom: 5.5rem;
    }

    .cookie-consent__actions {
        flex-wrap: wrap;
    }

    .cookie-consent__btn {
        flex: 1 1 auto;
    }

    .cookie-consent-fab span {
        display: none;
    }
}

/* Lingue che si leggono da destra a sinistra: i pulsanti flottanti si scambiano
   i lati. Il pulsante dei cookie sta all'angolo opposto a quello di WhatsApp e
   dell'assistente, che in RTL passano a sinistra. */
html[dir="rtl"] .cookie-consent-fab {
    left: auto;
    right: 1.25rem;
}

html[dir="rtl"] .cookie-consent__panel {
    direction: rtl;
}
