/*
 * Cookie banner — geometry only.
 *
 * Colour is deliberately absent from this file. BrandCentre.get_styles()
 * emits `.consent-banner` background and colour as !important rules in an
 * inline <style> that is the last thing in the head, so anything said here
 * about background-color or color would simply lose. THEMES.md, "Colour
 * belongs to the tenant", is the long version; site_settings/models.py
 * generate_styles() is where the banner's palette actually lives.
 *
 * Before this file existed the banner had no rules at all. The three
 * position modifiers below were being emitted into the markup by
 * banner.html and matched nothing, so the "where should the banner sit?"
 * setting in the admin did nothing whatsoever and the banner rendered as
 * an unstyled block in normal flow, underneath the footer, where a visitor
 * had to scroll past the whole page to consent to anything.
 */

.consent-banner {
    position: fixed;
    z-index: 1080; /* above MDB's fixed navbar (1030) and its backdrop */
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.25);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.consent-banner[hidden] {
    display: none;
}

.consent-banner__inner {
    padding: 1.25rem 1.5rem;
    margin: 0 auto;
    max-width: 68rem;
}

/* ── Position ─────────────────────────────────────────────────────────
 * The three values of CookieSettings.banner_position. Each is a full
 * placement, so switching between them in the admin needs no other change.
 */

.consent-banner--bottom {
    left: 0;
    right: 0;
    bottom: 0;
}

.consent-banner--bottom-left {
    left: 1rem;
    bottom: 1rem;
    max-width: 26rem;
    border-radius: 0.5rem;
}

.consent-banner--bottom-left .consent-banner__inner {
    padding: 1rem 1.25rem;
}

.consent-banner--centre {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 2rem);
    max-width: 34rem;
    border-radius: 0.5rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

/* ── Contents ─────────────────────────────────────────────────────── */

.consent-banner__title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.consent-banner__body {
    margin-bottom: 0.5rem;
}

.consent-banner__body p:last-child {
    margin-bottom: 0;
}

.consent-banner__policy {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
}

.consent-banner__categories {
    margin: 0.75rem 0;
    padding: 0.75rem 0;
    /* A rule rather than a fill: currentColor follows whatever the tenant's
       footer text colour turns out to be, on a light or a dark banner. */
    border-top: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    max-height: 40vh;
    overflow-y: auto;
}

.consent-banner__categories[hidden] {
    display: none;
}

.consent-category {
    margin-bottom: 0.75rem;
}

.consent-category:last-child {
    margin-bottom: 0;
}

.consent-category__label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.125rem;
    cursor: pointer;
    font-weight: 600;
}

.consent-category__label input[type="checkbox"] {
    /* MDB restyles bare checkboxes off-screen; the banner wants the plain
       control, which is also the one a keyboard user can still reach. */
    position: static;
    opacity: 1;
    pointer-events: auto;
    width: 1rem;
    height: 1rem;
    margin: 0;
    flex: 0 0 auto;
}

.consent-category__locked {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.75;
}

.consent-category__description {
    margin: 0 0 0 1.5rem;
    font-size: 0.8125rem;
    opacity: 0.85;
}

.consent-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.consent-banner__actions .btn {
    margin: 0;
}

.consent-banner__actions .btn[hidden] {
    display: none;
}

/* ── Blocked embeds ───────────────────────────────────────────────── */

.consent-embed__placeholder {
    border: 1px dashed currentColor;
    border-radius: 0.25rem;
    padding: 1.5rem;
    text-align: center;
}

.consent-embed__note {
    font-size: 0.8125rem;
    opacity: 0.8;
    margin: 0.5rem 0 0;
}

@media (max-width: 575.98px) {
    .consent-banner--bottom-left,
    .consent-banner--centre {
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        transform: none;
        width: auto;
        max-width: none;
        border-radius: 0;
    }

    .consent-banner__actions .btn {
        flex: 1 1 100%;
    }
}
