/* File: /css/wlt-consent.css */

/**
 * WLIAATrack consent banner styles.
 *
 * Design goals:
 *  - Fixed-bottom bar (not modal) — less intrusive, doesn't trap focus
 *  - Equal visual weight for Accept / Reject / Customize (regulatory req.)
 *  - Works in dark and light contexts via theme CSS custom properties
 *  - Accessible tap targets (min 44x44) and readable text contrast
 *  - Mobile-first; widens to a row layout at 782px (theme's breakpoint)
 *
 * Uses the theme's --wp--preset--color--* tokens where available, with
 * hard-coded fallbacks so the banner works even if this CSS is loaded
 * outside the theme (e.g., a PHP error page rendered without theme.json).
 */

/* ---------- Container ---------- */

.wlt-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #ffffff;
    color: var( --wp--preset--color--on-surface, #191c1f );
    border-top: 1px solid var( --wp--preset--color--outline-variant, #bfc7cf );
    box-shadow: 0 -4px 16px rgba( 0, 0, 0, 0.08 );
    font-family: var( --wp--preset--font-family--body, system-ui, -apple-system, sans-serif );
    font-size: 14px;
    line-height: 1.5;
}

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

.wlt-consent-banner__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

/* ---------- Text ---------- */

.wlt-consent-banner__title {
    margin: 0 0 0.25rem 0;
    font-family: var( --wp--preset--font-family--heading, inherit );
    font-size: 1.125rem;
    font-weight: 700;
    color: var( --wp--preset--color--on-surface, #191c1f );
}

.wlt-consent-banner__description {
    margin: 0 0 0.5rem 0;
    color: var( --wp--preset--color--on-surface-variant, #40484e );
    font-size: 0.875rem;
}

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

.wlt-consent-banner__privacy-link {
    color: var( --wp--preset--color--primary, #00678d );
    text-decoration: underline;
    margin-left: 0.25rem;
}

.wlt-consent-banner__privacy-link:hover,
.wlt-consent-banner__privacy-link:focus {
    color: var( --wp--preset--color--primary-dark, #005570 );
}

/* ---------- Action buttons ---------- */

.wlt-consent-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
}

/*
 * All three primary buttons share the same base styling. Regulatory
 * guidance says Accept / Reject / Customize must have equal visual
 * weight — same height, same font size, same padding, same border radius.
 * Color is the only differentiator.
 */
.wlt-consent-banner__btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.625rem 1.25rem;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    border: 1px solid transparent;
    border-radius: var( --wp--custom--radius--md, 8px );
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    flex: 1 1 auto;
}

.wlt-consent-banner__btn:focus {
    outline: 2px solid var( --wp--preset--color--primary, #00678d );
    outline-offset: 2px;
}

/* Reject — outlined, neutral */
.wlt-consent-banner__btn--reject {
    background: #ffffff;
    color: var( --wp--preset--color--on-surface, #191c1f );
    border-color: var( --wp--preset--color--outline-variant, #bfc7cf );
}

.wlt-consent-banner__btn--reject:hover,
.wlt-consent-banner__btn--reject:focus {
    background: var( --wp--preset--color--surface-container-low, #f2f4f7 );
    border-color: var( --wp--preset--color--on-surface-variant, #40484e );
}

/* Customize — outlined, slightly distinct */
.wlt-consent-banner__btn--customize {
    background: #ffffff;
    color: var( --wp--preset--color--primary, #00678d );
    border-color: var( --wp--preset--color--primary, #00678d );
}

.wlt-consent-banner__btn--customize:hover,
.wlt-consent-banner__btn--customize:focus {
    background: var( --wp--preset--color--surface-container-low, #f2f4f7 );
}

/* Accept — solid primary */
.wlt-consent-banner__btn--accept {
    background: var( --wp--preset--color--primary, #00678d );
    color: var( --wp--preset--color--on-primary, #ffffff );
    border-color: var( --wp--preset--color--primary, #00678d );
}

.wlt-consent-banner__btn--accept:hover,
.wlt-consent-banner__btn--accept:focus {
    background: var( --wp--preset--color--primary-dark, #005570 );
    border-color: var( --wp--preset--color--primary-dark, #005570 );
}

/* Save preferences (inside customize panel) */
.wlt-consent-banner__btn--save {
    background: var( --wp--preset--color--primary, #00678d );
    color: var( --wp--preset--color--on-primary, #ffffff );
    border-color: var( --wp--preset--color--primary, #00678d );
    flex: 0 0 auto;
}

.wlt-consent-banner__btn--save:hover,
.wlt-consent-banner__btn--save:focus {
    background: var( --wp--preset--color--primary-dark, #005570 );
    border-color: var( --wp--preset--color--primary-dark, #005570 );
}

/* ---------- Customize panel ---------- */

.wlt-consent-banner__categories {
    margin-top: 0.5rem;
    padding-top: 0.875rem;
    border-top: 1px solid var( --wp--preset--color--outline-variant, #bfc7cf );
}

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

.wlt-consent-banner__fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.wlt-consent-banner__legend {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.375rem;
    padding: 0;
}

.wlt-consent-banner__category {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.625rem;
    row-gap: 0.125rem;
    padding: 0.5rem;
    background: var( --wp--preset--color--surface-container-low, #f2f4f7 );
    border-radius: var( --wp--custom--radius--sm, 4px );
    cursor: pointer;
}

.wlt-consent-banner__category input[type="checkbox"] {
    grid-row: 1 / span 2;
    align-self: start;
    margin: 0.25rem 0 0 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.wlt-consent-banner__category input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.wlt-consent-banner__category-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var( --wp--preset--color--on-surface, #191c1f );
}

.wlt-consent-banner__category-desc {
    font-size: 0.8125rem;
    color: var( --wp--preset--color--on-surface-variant, #40484e );
    line-height: 1.45;
}

.wlt-consent-banner__customize-actions {
    margin-top: 0.875rem;
    display: flex;
    justify-content: flex-end;
}

/* ---------- Layout: wider screens ---------- */

@media ( min-width: 782px ) {

    .wlt-consent-banner__inner {
        padding: 1.125rem 2rem;
        flex-direction: row;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .wlt-consent-banner__text {
        flex: 1 1 auto;
        min-width: 0;
    }

    .wlt-consent-banner__actions {
        flex: 0 0 auto;
        align-items: center;
    }

    .wlt-consent-banner__btn {
        flex: 0 0 auto;
    }

    /* Customize panel sits below the whole row when expanded. */
    .wlt-consent-banner__categories {
        flex: 1 0 100%;
        margin-top: 0.25rem;
    }
}

/* ---------- Reduced motion ---------- */

@media ( prefers-reduced-motion: reduce ) {
    .wlt-consent-banner__btn {
        transition: none;
    }
}
