/* ============================================================
   AdSense Legal Pages — Consent UI
   Banner + modal. Isolado do tema.
   ============================================================ */

.alp-consent-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    z-index: 999998;
    display: none;
    opacity: 0;
    transition: opacity .2s ease;
}

.alp-consent-backdrop.is-open {
    display: block;
    opacity: 1;
}

/* ---------- Banner ---------- */

.alp-consent {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    background: #fff;
    border-top: 1px solid #e3e6ea;
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.12);
    padding: 1.25rem 1.5rem;
    transform: translateY(110%);
    transition: transform .3s cubic-bezier(.16, 1, .3, 1);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #1a1a1a;
}

.alp-consent.is-visible { transform: translateY(0); }

.alp-consent__inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.alp-consent__text {
    flex: 1 1 420px;
    min-width: 0;
    margin: 0;
    color: #4a4a4a;
}

.alp-consent__text a {
    color: #1a56db;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.alp-consent__actions {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.alp-consent button {
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.5625rem 1.125rem;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
    border: 1px solid transparent;
}

.alp-consent button:focus-visible,
.alp-consent-modal button:focus-visible {
    outline: 2px solid #1a56db;
    outline-offset: 2px;
}

.alp-btn-accept {
    background: #1a56db;
    color: #fff;
    border-color: #1a56db;
}

.alp-btn-accept:hover {
    background: #123fa8;
    border-color: #123fa8;
}

.alp-btn-reject {
    background: #fff;
    color: #4a4a4a;
    border-color: #c9ced6;
}

.alp-btn-reject:hover {
    background: #f7f8fa;
    border-color: #9aa3af;
}

.alp-btn-customize {
    background: transparent;
    color: #1a56db;
    border-color: transparent;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.alp-btn-customize:hover { color: #123fa8; }

/* ---------- Modal ---------- */

.alp-consent-modal {
    position: fixed;
    z-index: 999999;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(.96);
    width: min(560px, calc(100vw - 2rem));
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
    padding: 1.75rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #1a1a1a;
}

.alp-consent-modal.is-open {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.alp-consent-modal h2 {
    margin: 0 0 0.5rem;
    font-size: 1.1875rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.alp-consent-modal > p {
    margin: 0 0 1.25rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.alp-pref {
    border: 1px solid #e3e6ea;
    border-radius: 8px;
    padding: 0.875rem 1rem;
    margin-bottom: 0.75rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.375rem 1rem;
    align-items: start;
}

.alp-pref__label {
    font-weight: 650;
    font-size: 0.9375rem;
    color: #1a1a1a;
}

.alp-pref__desc {
    grid-column: 1 / -1;
    font-size: 0.8125rem;
    color: #6b7280;
    line-height: 1.55;
    margin: 0;
}

/* ---------- Switch ---------- */

.alp-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex: 0 0 auto;
}

.alp-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.alp-switch__track {
    position: absolute;
    inset: 0;
    background: #c9ced6;
    border-radius: 999px;
    transition: background .2s ease;
    cursor: pointer;
}

.alp-switch__track::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.alp-switch input:checked + .alp-switch__track { background: #1a56db; }
.alp-switch input:checked + .alp-switch__track::before { transform: translateX(20px); }

.alp-switch input:focus-visible + .alp-switch__track {
    outline: 2px solid #1a56db;
    outline-offset: 2px;
}

.alp-switch input:disabled + .alp-switch__track {
    background: #1a56db;
    opacity: .5;
    cursor: not-allowed;
}

.alp-consent-modal__actions {
    display: flex;
    gap: 0.625rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e3e6ea;
    flex-wrap: wrap;
}

.alp-consent-modal__actions .alp-btn-accept { flex: 1 1 auto; }

.alp-consent-modal button {
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.5625rem 1.125rem;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

/* ---------- Responsivo ---------- */

@media (max-width: 640px) {
    .alp-consent { padding: 1rem 1.125rem 1.25rem; }

    .alp-consent__inner { gap: 1rem; }

    .alp-consent__actions { flex: 1 1 100%; }

    .alp-consent__actions button {
        flex: 1 1 calc(50% - 0.3125rem);
        min-width: 0;
    }

    .alp-btn-customize {
        flex: 1 1 100% !important;
        order: 3;
    }

    .alp-consent-modal {
        width: 100vw;
        max-width: 100vw;
        bottom: 0;
        top: auto;
        left: 0;
        transform: translateY(100%) scale(1);
        border-radius: 12px 12px 0 0;
        max-height: 88vh;
    }

    .alp-consent-modal.is-open {
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .alp-consent,
    .alp-consent-modal,
    .alp-switch__track,
    .alp-switch__track::before { transition: none; }
}