/*
 * CLA cookie banner (BL-09). Self-contained: loaded by every layout, including LMSMaster,
 * which uses Bootstrap 5 and doesn't load site.css. Behaviour: wwwroot/Scripts/consent.js.
 *
 * The banner is a fixed band at the bottom. While it shows, the page reserves the same
 * space at the bottom (padding + scroll-padding), so it never covers the focused element
 * and doesn't shift the layout. On short viewports (e.g. 400% zoom) it sits in the page
 * flow at the top instead.
 */

#gdpr {
    display: none;
}

html.cla-consent-open #gdpr {
    display: block;
}

html.cla-consent-open {
    scroll-padding-bottom: var(--cla-consent-space, 0px);
}

html.cla-consent-open body {
    padding-bottom: var(--cla-consent-space, 0px);
}

.cla-consent {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    max-height: 70vh;
    overflow-y: auto;
    background-color: #0b2341;
    color: #fff;
    border-top: 4px solid #dd550c;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.35);
    font-size: 1rem;
    line-height: 1.5;
    text-align: left;
}

.cla-consent__inner {
    position: relative;
    max-width: 1140px;
    margin: 0 auto;
    padding: 1rem 4rem 1rem 1rem;
}

.cla-consent__main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
}

.cla-consent__text {
    flex: 1 1 28rem;
    margin: 0;
    color: #fff;
    font-size: 1rem;
}

.cla-consent a,
.cla-consent a:visited {
    color: #fff;
    font-weight: bold;
    text-decoration: underline;
}

.cla-consent a:hover {
    text-decoration-thickness: 2px;
}

.cla-consent__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

/* Accept, Deny and Save share one style: same size, colour and weight. */
.cla-consent__btn {
    min-width: 7rem;
    min-height: 44px;
    margin: 0;
    padding: 0.5rem 1.25rem;
    border: 2px solid #fff;
    border-radius: 0;
    background-color: #fff;
    color: #0b2341;
    font: inherit;
    font-weight: bold;
    line-height: 1.2;
    cursor: pointer;
}

.cla-consent__btn:hover {
    background-color: #0b2341;
    color: #fff;
}

.cla-consent__textbtn,
.cla-consent__close {
    margin: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font: inherit;
    cursor: pointer;
}

.cla-consent__textbtn {
    min-height: 44px;
    padding: 0.25rem 0.5rem;
    text-decoration: underline;
}

.cla-consent__close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 2rem;
    line-height: 1;
}

.cla-consent__btn:focus-visible,
.cla-consent__textbtn:focus-visible,
.cla-consent__close:focus-visible,
.cla-consent a:focus-visible,
.cla-consent input:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
    box-shadow: none;
}

.cla-consent__settings {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.4);
}

.cla-consent__settings[hidden] {
    display: none;
}

.cla-consent__settings fieldset {
    min-width: 0;
    margin: 0 0 1rem;
    padding: 0;
    border: 0;
}

.cla-consent__settings legend {
    width: auto;
    margin-bottom: 0.5rem;
    padding: 0;
    color: #fff;
    font-size: 1.125rem;
    font-weight: bold;
}

.cla-consent__option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.cla-consent__option input {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    margin: 0;
    accent-color: #dd550c;
}

.cla-consent__option label {
    margin: 0;
    color: #fff;
    font-size: 1rem;
}

.cla-consent__note {
    margin: 0;
    color: #fff;
    font-size: 0.9375rem;
}

/* Narrow screens: keep the band compact. */
@media (max-width: 36em) {
    .cla-consent__inner {
        padding: 0.75rem 3rem 0.75rem 0.75rem;
    }

    .cla-consent__text,
    .cla-consent__option label {
        font-size: 0.9375rem;
    }

    .cla-consent__main {
        gap: 0.5rem;
    }

    .cla-consent__close {
        top: 0.25rem;
        right: 0.25rem;
    }
}

/* Short viewports (landscape phones, 400% zoom): sit in the page flow at the top. */
@media (max-height: 30rem) {
    .cla-consent {
        position: relative;
        max-height: none;
        overflow: visible;
        box-shadow: none;
        border-top: 0;
        border-bottom: 4px solid #dd550c;
    }
}

/* "Cookie settings" in each footer: reads like the footer links around it. */
.cla-consent-settings-link {
    display: inline;
    min-height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
}

.cla-consent-settings-link:hover {
    text-decoration: underline;
}

@media (prefers-reduced-motion: no-preference) {
    .cla-consent__btn {
        transition: background-color 0.15s, color 0.15s;
    }
}
