﻿/*
 * Cookie consent banner and preferences dialog.
 *
 * Loaded on every page from App.razor's static <head>, so unlike the marketing
 * sheets these rules are NOT .B-scoped — the banner has to look the same on the
 * marketing site, the customer portal, the admin portal and the demo. Every
 * selector is .vp-consent-prefixed to keep it out of the way of page styles.
 *
 * All colors, radii, button heights and font sizes come from the design tokens
 * in verapath-variables.css. No literal hex values (see Website/CLAUDE.md).
 */

.vp-consent {
    position: fixed;
    z-index: 2147483000; /* above the fixed marketing nav and any page overlay */
    inset: auto 0 0 0;
    display: flex;
    justify-content: center;
    padding: 16px;
    pointer-events: none;
}

/* The preferences dialog covers the viewport and dims what is behind it; the
   first-visit banner only occupies the bottom strip and never blocks reading
   the page, which is deliberate — a cookie wall is not valid consent. */
.vp-consent--modal {
    inset: 0;
    align-items: center;
    background: color-mix(in srgb, var(--color-midnight) 55%, transparent);
}

.vp-consent__panel {
    pointer-events: auto;
    width: 100%;
    max-width: 680px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: var(--color-white);
    color: var(--color-text);
    border: 1px solid var(--color-gray-02);
    border-radius: var(--btn-border-radius);
    box-shadow: 0 12px 32px color-mix(in srgb, var(--color-midnight) 18%, transparent);
    padding: 20px;
}

.vp-consent__title {
    margin: 0 0 8px;
    font-size: var(--font-size-dialog-title);
    font-weight: var(--font-weight-bold);
    color: var(--color-midnight);
}

.vp-consent__body {
    margin: 0 0 16px;
    font-size: var(--font-size-label);
    line-height: 1.5;
    color: var(--color-midnight);
}

.vp-consent__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

/* Accept and reject share one class for size, shape and weight. Only the fill
   differs, so refusing is visually no harder than agreeing — under CNIL
   guidance a reject control that is smaller, flatter or buried does not count
   as freely given consent. If counsel wants strict visual parity, give
   --accept the same background as --reject; nothing else needs to change. */
.vp-consent__btn {
    height: var(--btn-height);
    padding: var(--btn-padding);
    border: none;
    border-radius: var(--btn-border-radius);
    font-size: var(--font-size-label);
    font-weight: var(--btn-font-weight);
    font-family: inherit;
    cursor: pointer;
}

.vp-consent__btn--accept {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}

.vp-consent__btn--accept:hover {
    background: var(--btn-primary-bg-hover);
}

.vp-consent__btn--accept:active {
    background: var(--btn-primary-bg-active);
}

.vp-consent__btn--reject {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
}

.vp-consent__btn--reject:hover {
    background: var(--btn-secondary-bg-hover);
}

.vp-consent__btn--reject:active {
    background: var(--btn-secondary-bg-active);
}

.vp-consent__link {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: var(--font-size-label);
    font-weight: var(--font-weight-medium);
    color: var(--color-midnight);
    text-decoration: underline;
    cursor: pointer;
}

.vp-consent__group {
    border-top: 1px solid var(--color-gray-03);
    padding: 16px 0;
}

.vp-consent__group-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.vp-consent__group-title {
    margin: 0;
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-bold);
    color: var(--color-midnight);
}

.vp-consent__group-body {
    margin: 0;
    font-size: var(--font-size-label);
    line-height: 1.5;
    color: var(--color-midnight);
}

.vp-consent__always {
    font-size: var(--font-size-label);
    font-weight: var(--font-weight-medium);
    color: var(--color-gray-01);
}

.vp-consent__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-label);
    color: var(--color-midnight);
    cursor: pointer;
}

.vp-consent__toggle input {
    width: var(--control-size-checkbox);
    height: var(--control-size-checkbox);
    accent-color: var(--color-green);
    cursor: pointer;
}

/* Keyboard focus must stay clearly visible — this dialog is operable by
   keyboard only and the focus ring is the sole indicator of position. */
.vp-consent__btn:focus-visible,
.vp-consent__link:focus-visible,
.vp-consent__toggle input:focus-visible {
    outline: 2px solid var(--color-bright-green);
    outline-offset: 2px;
}

@media (max-width: 560px) {
    .vp-consent__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .vp-consent__btn {
        width: 100%;
    }

    .vp-consent__link {
        align-self: center;
        padding-top: 4px;
    }
}

/* ── Withdrawal entry point ───────────────────────────────────────────────
 *
 * Two shapes of the same control, both carrying [data-vp-consent-manage] so
 * cookie-consent.js binds them without an inline onclick:
 *
 *   .vp-consent-manage-link  the marketing footer's Legal column, styled to
 *                            match the anchors beside it (the footer rules in
 *                            vp-site.css / vp-marketing.css name this class
 *                            alongside `a`); this only resets the button.
 *   .vp-consent-manage       rendered by the script on layouts that have no
 *                            footer at all — customer portal, admin portal,
 *                            demo, marketing thank-you — so withdrawing stays
 *                            as easy as consenting there too (Art. 7(3)).
 */
.vp-consent-manage-link {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: .95rem;
    font-weight: inherit;
    padding: .3rem 0;
    cursor: pointer;
}

.vp-consent-manage {
    position: fixed;
    z-index: 2147482000; /* below the banner, above page chrome */
    left: 12px;
    bottom: 12px;
    background: var(--color-white);
    color: var(--color-midnight);
    border: 1px solid var(--color-gray-02);
    border-radius: var(--btn-border-radius);
    padding: 6px 12px;
    font-family: inherit;
    font-size: var(--font-size-label);
    font-weight: var(--font-weight-medium);
    opacity: .75;
    cursor: pointer;
}

.vp-consent-manage:hover,
.vp-consent-manage:focus-visible {
    opacity: 1;
}

.vp-consent-manage-link:focus-visible,
.vp-consent-manage:focus-visible {
    outline: 2px solid var(--color-bright-green);
    outline-offset: 2px;
}

@media print {
    /* Nothing to click on paper. */
    .vp-consent,
    .vp-consent-manage {
        display: none;
    }
}
