/* =============================================
   BESKED - Cookie Consent Banner & Modal
   GDPR / Garante 10 giugno 2021 compliant
   ============================================= */

.consent-banner {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: 760px;
    margin: 0 auto;
    z-index: 1200;
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    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: 700;
    margin-bottom: 8px;
    color: var(--text-strong);
    display: flex;
    align-items: center;
    gap: 8px;
}
.consent-banner__title svg { color: var(--green); flex-shrink: 0; }

.consent-banner__text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.consent-banner__text a {
    color: var(--green);
    text-decoration: underline;
}
.consent-banner__text a:hover { color: var(--green-dark); }

.consent-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}
.consent-banner__actions .btn {
    font-size: 14px;
    padding: 10px 18px;
}

/* Modal backdrop + dialog */
.consent-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .6);
    z-index: 1300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.consent-modal__backdrop--open { display: flex; }

.consent-modal {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
}
.consent-modal__header {
    padding: 24px 24px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.consent-modal__title { font-size: 18px; font-weight: 700; color: var(--text-strong); }
.consent-modal__close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    transition: all var(--transition);
}
.consent-modal__close:hover { background: var(--bg-elevated); color: var(--text); }

.consent-modal__body { padding: 16px 24px; }
.consent-modal__intro {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
}
.consent-modal__intro a { color: var(--green); text-decoration: underline; }

.consent-cat {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.consent-cat__main { flex: 1; }
.consent-cat__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-strong);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.consent-cat__locked {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--green-light);
    color: var(--green-dark);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}
.consent-cat__desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* 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: var(--border-strong);
    border-radius: var(--radius-full);
    transition: background-color var(--transition);
    cursor: pointer;
}
.consent-switch__track::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.consent-switch input:checked + .consent-switch__track { background: var(--green); }
.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 24px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}
.consent-modal__footer .btn { font-size: 14px; padding: 10px 18px; }

/* Mobile: il banner non deve coprire il WA float */
@media (max-width: 640px) {
    .consent-banner { bottom: 88px; left: 8px; right: 8px; padding: 18px; }
    .consent-banner__actions { justify-content: stretch; }
    .consent-banner__actions .btn { flex: 1 1 auto; justify-content: center; }
    .consent-modal__footer { justify-content: stretch; }
    .consent-modal__footer .btn { flex: 1 1 auto; justify-content: center; }
}
