/* ─── Medula Cookie Banner — stile card centrale bassa, mobile-friendly ───── */

#medula-consent-overlay {
    position: fixed;
    inset: 0;
    background: rgba(36, 35, 35, 0.35);
    backdrop-filter: blur(2px);
    z-index: 2147483645;
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}
#medula-consent-overlay.open { display: block; opacity: 1; }

.medula-consent-card {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(40px);
    width: calc(100% - 32px);
    max-width: 720px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid rgba(67, 59, 52, 0.12);
    box-shadow: 0 24px 60px rgba(36, 35, 35, 0.18), 0 4px 14px rgba(36, 35, 35, 0.08);
    padding: 22px 26px;
    z-index: 2147483646;
    font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: #433B34;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.3s ease, visibility 0s 0.3s;
    box-sizing: border-box;
}
.medula-consent-card.open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    transition: opacity 0.25s ease, transform 0.3s ease, visibility 0s;
}

@media (max-width: 540px) {
    .medula-consent-card {
        bottom: 16px;
        padding: 18px 18px 22px;
        border-radius: 12px;
    }
}

.medula-consent-card * { box-sizing: border-box; }

.medula-consent-title {
    font-size: 16px;
    font-weight: 700;
    color: #242323;
    margin: 0 0 10px;
    letter-spacing: -0.01em;
}

.medula-consent-body {
    font-size: 13.5px;
    line-height: 1.6;
    color: #494647;
    margin-bottom: 18px;
}
.medula-consent-body a {
    color: #0CA8C7;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.medula-consent-body a:hover { text-decoration: none; }

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

.medula-consent-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid rgba(67, 59, 52, 0.22);
    background: #ffffff;
    color: #433B34;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
    text-decoration: none;
    line-height: 1.2;
    min-height: 38px;
}
.medula-consent-btn:hover { background: #F4F4F6; }
.medula-consent-btn:focus-visible {
    outline: 2px solid #0CA8C7;
    outline-offset: 2px;
}
.medula-consent-btn:active { transform: translateY(1px); }

.medula-consent-btn-primary {
    background: #0CA8C7;
    color: #fff;
    border-color: #0CA8C7;
}
.medula-consent-btn-primary:hover {
    background: #089ab7;
    border-color: #089ab7;
}

.medula-consent-btn-ghost {
    background: transparent;
    border-color: transparent;
    color: #494647;
}
.medula-consent-btn-ghost:hover {
    background: #F4F4F6;
    color: #242323;
}

@media (max-width: 540px) {
    .medula-consent-actions {
        flex-direction: column-reverse;
    }
    .medula-consent-actions .medula-consent-btn {
        width: 100%;
    }
}

/* ─── Detail view (Personalizza) ──────────────────────────────────────────── */
.medula-consent-detail {
    display: none;
    margin-top: 4px;
    margin-bottom: 18px;
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 4px;
}
.medula-consent-card.detail-open .medula-consent-detail { display: block; }
.medula-consent-card.detail-open .medula-consent-body { display: none; }

.medula-purpose {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(67, 59, 52, 0.08);
}
.medula-purpose:last-child { border-bottom: none; }
.medula-purpose-text {
    flex: 1;
    min-width: 0;
}
.medula-purpose-label {
    font-size: 13.5px;
    font-weight: 700;
    color: #242323;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.medula-purpose-required {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9BB807;
    background: rgba(155, 184, 7, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
}
.medula-purpose-desc {
    font-size: 12.5px;
    color: #494647;
    line-height: 1.5;
}

/* ─── Toggle switch ───────────────────────────────────────────────────────── */
.medula-toggle {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
    margin-top: 2px;
}
.medula-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.medula-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #B3B1AF;
    border-radius: 22px;
    transition: background-color 0.18s;
}
.medula-toggle-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: transform 0.18s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.medula-toggle input:checked + .medula-toggle-slider {
    background-color: #0CA8C7;
}
.medula-toggle input:checked + .medula-toggle-slider::before {
    transform: translateX(16px);
}
.medula-toggle input:focus-visible + .medula-toggle-slider {
    outline: 2px solid #0CA8C7;
    outline-offset: 2px;
}
.medula-toggle input:disabled + .medula-toggle-slider {
    opacity: 0.55;
    cursor: not-allowed;
    background-color: #9BB807;
}

/* ─── Loading state ──────────────────────────────────────────────────────── */
.medula-consent-loading {
    text-align: center;
    padding: 12px 0;
    font-size: 12px;
    color: #B3B1AF;
}
