/* Overlay — bloqueia interação com a página até aceitar/personalizar */
.memb-cookie-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147482999;
    background:
        linear-gradient(
            180deg,
            rgba(0, 0, 0, 0.78) 0%,
            rgba(13, 16, 32, 0.88) 42%,
            rgba(0, 0, 0, 0.82) 100%
        );
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    pointer-events: auto;
    touch-action: none;
}

.memb-cookie-overlay.is-hidden,
.memb-cookie-overlay[hidden] {
    display: none !important;
}

body.has-memb-cookie-banner {
    overflow: hidden;
}

body.has-memb-cookie-banner > :not(.memb-cookie-overlay):not(.memb-cookie-banner) {
    pointer-events: none !important;
    user-select: none;
}

body.has-memb-cookie-banner .memb-auth-page-frame,
body.has-memb-cookie-banner .memb-auth-page-main,
body.has-memb-cookie-banner .memb-auth-shell {
    pointer-events: none;
    user-select: none;
}

/* Modal centralizado */
.memb-cookie-banner {
    position: fixed;
    z-index: 2147483000;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(calc(100% - 1.5rem), 22rem);
    max-width: 22rem;
    max-height: min(90vh, 34rem);
    margin: 0;
    padding: 0.95rem 1rem 1rem;
    border-radius: 12px;
    background: color-mix(in srgb, #1a2340 94%, #0d1020);
    border: 1px solid color-mix(in srgb, #8eb4ff 22%, transparent);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.55),
        0 0 0 1px color-mix(in srgb, #8eb4ff 12%, transparent);
    color: color-mix(in srgb, #e8eef8 88%, #c8d4ea);
    font-size: 0.8125rem;
    line-height: 1.5;
    pointer-events: auto;
    touch-action: manipulation;
    box-sizing: border-box;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.memb-cookie-banner.is-customizing {
    width: min(calc(100% - 1.5rem), 26rem);
    max-width: 26rem;
    max-height: min(92vh, 38rem);
    padding: 1rem 1rem 1.05rem;
}

.memb-cookie-banner.is-hidden,
.memb-cookie-banner[hidden] {
    display: none !important;
}

.memb-cookie-banner__prefs {
    order: 1;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    pointer-events: none;
    transition:
        max-height 0.38s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.28s ease,
        margin 0.38s ease;
}

.memb-cookie-banner__prefs[hidden] {
    display: block !important;
}

.memb-cookie-banner.is-customizing .memb-cookie-banner__prefs {
    max-height: 24rem;
    opacity: 1;
    margin-bottom: 0;
    pointer-events: auto;
}

.memb-cookie-banner__main {
    order: 2;
}

.memb-cookie-banner.is-customizing .memb-cookie-banner__main {
    display: none;
}

.memb-cookie-banner__prefs-title {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
    color: #f3f6fc;
}

.memb-cookie-banner__prefs-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.memb-cookie-pref {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.65rem 0.7rem;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, #8eb4ff 16%, transparent);
    background: color-mix(in srgb, #111827 55%, #1a2340);
}

.memb-cookie-pref__copy {
    flex: 1 1 auto;
    min-width: 0;
}

.memb-cookie-pref__label {
    display: block;
    margin: 0 0 0.2rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #f3f6fc;
    overflow-wrap: break-word;
    word-break: break-word;
}

.memb-cookie-pref__desc {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.45;
    color: color-mix(in srgb, #c8d4ea 82%, transparent);
    overflow-wrap: break-word;
    word-break: break-word;
}

.memb-cookie-switch {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    margin-top: 0.1rem;
    cursor: pointer;
}

.memb-cookie-switch--locked {
    cursor: default;
    opacity: 0.85;
}

.memb-cookie-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.memb-cookie-switch__track {
    display: block;
    width: 2.35rem;
    height: 1.35rem;
    border-radius: 999px;
    background: color-mix(in srgb, #8eb4ff 18%, #0d1020);
    border: 1px solid color-mix(in srgb, #8eb4ff 28%, transparent);
    box-sizing: border-box;
    transition: background 0.2s ease, border-color 0.2s ease;
    position: relative;
}

.memb-cookie-switch__track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: #c8d4ea;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s ease;
}

.memb-cookie-switch input:checked + .memb-cookie-switch__track {
    background: #8eb4ff;
    border-color: color-mix(in srgb, #8eb4ff 70%, #a8c6ff);
}

.memb-cookie-switch input:checked + .memb-cookie-switch__track::after {
    transform: translateX(1rem);
    background: #0f172a;
}

.memb-cookie-switch input:disabled + .memb-cookie-switch__track {
    background: color-mix(in srgb, #8eb4ff 35%, #1a2340);
    border-color: color-mix(in srgb, #8eb4ff 40%, transparent);
}

.memb-cookie-switch input:disabled:checked + .memb-cookie-switch__track::after {
    transform: translateX(1rem);
    background: #e8eef8;
}

.memb-cookie-banner__prefs-actions {
    display: flex;
    flex-direction: row;
    gap: 0.55rem;
    margin-top: 0.85rem;
}

.memb-cookie-banner__desc {
    margin: 0 0 0.85rem;
    color: color-mix(in srgb, #e8eef8 82%, #8eb4ff);
    font-size: 0.8125rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

.memb-cookie-banner__actions {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0.65rem;
    pointer-events: auto;
}

.memb-cookie-banner__btn-outline,
.memb-cookie-banner__btn-primary {
    flex: 1 1 0;
    min-width: 0;
    border-radius: 8px;
    padding: 0.58rem 0.65rem;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
}

.memb-cookie-banner__btn-outline {
    background: transparent;
    color: color-mix(in srgb, #8eb4ff 88%, #e8eef8);
    border: 1px solid color-mix(in srgb, #8eb4ff 42%, transparent);
}

.memb-cookie-banner__btn-outline:hover,
.memb-cookie-banner__btn-outline:focus-visible {
    background: color-mix(in srgb, #8eb4ff 10%, transparent);
    border-color: color-mix(in srgb, #8eb4ff 55%, transparent);
    outline: none;
}

.memb-cookie-banner__btn-primary {
    border: none;
    background: #8eb4ff;
    color: #0f172a;
}

.memb-cookie-banner__btn-primary:hover,
.memb-cookie-banner__btn-primary:focus-visible {
    background: #a8c6ff;
    outline: none;
}

.memb-cookie-banner__btn-outline:disabled,
.memb-cookie-banner__btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.memb-auth-terms {
    margin: 0.75rem 0 0.25rem;
}

.memb-auth-terms label {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: color-mix(in srgb, #e8eef8 85%, transparent);
    cursor: pointer;
}

.memb-auth-terms input[type="checkbox"] {
    margin-top: 0.15rem;
    flex-shrink: 0;
    accent-color: #8eb4ff;
}

.memb-auth-terms a {
    color: #8eb4ff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

@media (min-width: 640px) {
    .memb-cookie-banner {
        width: min(calc(100% - 2rem), 24rem);
        max-width: 24rem;
        padding: 1rem 1.1rem 1.05rem;
    }

    .memb-cookie-banner.is-customizing {
        width: min(calc(100% - 2rem), 27rem);
        max-width: 27rem;
    }

    .memb-cookie-banner__desc {
        margin-bottom: 0.9rem;
        font-size: 0.84rem;
    }

    .memb-cookie-banner__prefs-title {
        font-size: 1rem;
    }
}
