/* Consent banner and settings dialog. Only loaded when the integration is
   enabled. Uses the shared design tokens from styles.css. */

.consent-banner {
    position: fixed;
    z-index: 60;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 0 16px 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    pointer-events: none;
}

.consent-banner-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
    width: min(1160px, 100%);
    margin: 0 auto;
    max-height: 70dvh;
    overflow-y: auto;
    padding: 20px 24px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: #fff;
    box-shadow: var(--shadow);
    pointer-events: auto;
}

.consent-banner-text p {
    margin: 0;
    color: var(--ink);
    line-height: 1.55;
}

.consent-banner-text a {
    color: var(--dark);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.consent-banner-text a:hover {
    color: var(--green);
}

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

/* Reject and grant are intentionally styled identically (no dark pattern). */
.consent-button {
    min-height: 48px;
    border: 1px solid var(--dark);
    color: var(--dark);
    background: #fff;
}

.consent-button:hover {
    background: #f2f8ed;
}

/* High-contrast, clearly visible focus ring (dark on white ~8.6:1). */
.consent-banner .button:focus-visible,
.consent-dialog .button:focus-visible,
.consent-banner a:focus-visible,
#consent-settings-link:focus-visible {
    outline: 3px solid var(--dark);
    outline-offset: 2px;
}

/* Keep the fixed bar from covering the footer/controls. scroll-padding-bottom
   lives on the root element so keyboard focus never lands underneath the
   banner (WCAG 2.4.11); the body padding compensates the flow content. */
html {
    scroll-padding-bottom: var(--consent-banner-offset, 0px);
}

body.consent-banner-visible {
    padding-bottom: var(--consent-banner-offset, 0px);
}

/* Raise fixed bottom bars above the banner while it is visible so shopping
   actions / the global shopping button stay reachable. */
body.consent-banner-visible .shopping-actions {
    bottom: calc(max(1rem, env(safe-area-inset-bottom)) + var(--consent-banner-offset, 0px));
}

body.consent-banner-visible .global-shopping-button {
    bottom: calc(20px + var(--consent-banner-offset, 0px));
}

.consent-dialog {
    width: min(560px, calc(100% - 28px));
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    padding: 0;
    border: 0;
    border-radius: 20px;
    color: var(--ink);
    background: #fff;
    box-shadow: 0 25px 80px rgba(0, 0, 0, .25);
}

.consent-dialog::backdrop {
    background: rgba(5, 38, 26, .7);
    backdrop-filter: blur(4px);
}

.consent-dialog-body {
    padding: 28px;
}

.consent-dialog h2 {
    margin: 0 0 8px;
    color: var(--dark);
    font-size: 24px;
}

.consent-dialog-intro {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.consent-category {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--cream);
}

.consent-category-info strong {
    display: block;
    color: var(--dark);
}

.consent-category-info p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.consent-category-state {
    align-self: center;
    padding: 6px 10px;
    border-radius: 99px;
    color: var(--dark);
    background: #eef7e8;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.consent-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.consent-dialog-actions .button {
    flex: 1 1 auto;
    min-height: 48px;
}

@media (max-width: 560px) {
    .consent-banner {
        padding: 0 8px 8px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .consent-banner-inner {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
        max-height: 70dvh;
        overflow-y: auto;
        padding: 18px;
    }

    .consent-banner-actions {
        flex-direction: column;
    }

    .consent-banner-actions .button {
        width: 100%;
        white-space: normal;
        text-align: center;
    }

    .consent-dialog-body {
        padding: 22px 18px;
    }

    .consent-category {
        grid-template-columns: minmax(0, 1fr);
    }

    .consent-dialog-actions {
        flex-direction: column;
    }

    .consent-dialog-actions .button {
        width: 100%;
    }
}
