/*
 * Consent banner, preferences panel, form notices.
 * Themes restyle it by defining any of these on :root (all optional):
 *   --privacy-accent, --privacy-accent-text, --privacy-bg, --privacy-text,
 *   --privacy-muted, --privacy-border, --privacy-radius, --privacy-font, --privacy-z
 * Fallbacks follow the shared theme tokens (--color-primary, --color-text).
 */
.pv-banner,
.pv-modal,
.pv-form-notice,
.pv-form-optin,
.pv-policy-meta,
.pv-account,
.pv-acct-card,
.pv-policy-page {
    --pv-accent: var(--privacy-accent, var(--color-primary, #1f2937));
    --pv-accent-text: var(--privacy-accent-text, #ffffff);
    --pv-bg: var(--privacy-bg, #ffffff);
    --pv-text: var(--privacy-text, var(--color-text, #1f2937));
    --pv-muted: var(--privacy-muted, #4b5563);
    --pv-border: var(--privacy-border, #d1d5db);
    --pv-radius: var(--privacy-radius, 10px);
    --pv-font: var(--privacy-font, inherit);
    --pv-z: var(--privacy-z, 2147483000);
}

.pv-banner[hidden],
.pv-modal[hidden] {
    display: none !important;
}

/* ── Banner ─────────────────────────────────────────────── */
.pv-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    /* --pv-lift: height of the theme's fixed bottom bars, set by privacy.js */
    bottom: calc(16px + var(--pv-lift, 0px));
    z-index: var(--pv-z);
    max-width: 960px;
    margin: 0 auto;
    background: var(--pv-bg);
    color: var(--pv-text);
    border: 1px solid var(--pv-border);
    border-radius: var(--pv-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
    font-family: var(--pv-font);
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}

.pv-banner:focus {
    outline: 3px solid var(--pv-accent);
    outline-offset: 2px;
}

.pv-banner__inner {
    padding: 20px 24px;
}

.pv-banner__title,
.pv-modal__title {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--pv-text);
}

.pv-banner__text,
.pv-modal__text {
    margin: 0 0 16px;
    color: var(--pv-muted);
}

.pv-banner a,
.pv-modal a,
.pv-form-notice a {
    color: var(--pv-accent);
    text-decoration: underline;
}

.pv-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* All three primary actions share one style: rejecting is as easy as accepting. */
.pv-btn {
    flex: 1 1 0;
    min-width: 160px;
    min-height: 44px;
    padding: 10px 16px;
    border: 2px solid var(--pv-accent);
    border-radius: calc(var(--pv-radius) - 4px);
    background: var(--pv-accent);
    color: var(--pv-accent-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.pv-btn:hover {
    filter: brightness(1.08);
}

.pv-btn:focus-visible,
.pv-modal__close:focus-visible,
.pv-switch input:focus-visible + .pv-switch__track {
    outline: 3px solid var(--pv-accent);
    outline-offset: 2px;
}

/* ── Notice bar (notice mode): one compact, non-blocking row ── */
.pv-banner--notice {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.14);
}

.pv-banner--notice .pv-banner__inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
}

.pv-banner--notice .pv-banner__text {
    flex: 1 1 auto;
    margin: 0;
    font-size: 13px;
}

.pv-banner--notice .pv-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
}

.pv-banner--notice .pv-btn {
    min-width: auto;
    min-height: 40px;
    padding: 8px 16px;
    white-space: nowrap;
}

.pv-btn--secondary {
    background: transparent;
    color: var(--pv-accent);
}

/* ── Preferences panel ──────────────────────────────────── */
html.pv-modal-open {
    overflow: hidden;
}

.pv-modal {
    position: fixed;
    inset: 0;
    z-index: calc(var(--pv-z) + 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-family: var(--pv-font);
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}

.pv-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.pv-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 620px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 24px;
    background: var(--pv-bg);
    color: var(--pv-text);
    border-radius: var(--pv-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.pv-modal__dialog:focus {
    outline: none;
}

.pv-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--pv-text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.pv-cats {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
}

.pv-cat {
    padding: 14px 0;
    border-top: 1px solid var(--pv-border);
}

.pv-cat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.pv-cat__label {
    font-weight: 600;
    color: var(--pv-text);
    cursor: pointer;
}

.pv-cat__desc {
    margin: 6px 0 0;
    color: var(--pv-muted);
    font-size: 13px;
}

.pv-cat__always {
    font-size: 12px;
    font-weight: 600;
    color: var(--pv-muted);
    white-space: nowrap;
}

/* Accessible switch built on a native checkbox */
.pv-switch {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.pv-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.pv-switch__track {
    width: 46px;
    height: 26px;
    border-radius: 13px;
    background: #9ca3af;
    position: relative;
    transition: background 0.2s;
    cursor: pointer;
}

.pv-switch__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.2s;
}

.pv-switch input:checked + .pv-switch__track {
    background: var(--pv-accent);
}

.pv-switch input:checked + .pv-switch__track::after {
    transform: translateX(20px);
}

.pv-switch input:disabled + .pv-switch__track {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Form notices ───────────────────────────────────────── */
.pv-form-notice {
    flex-basis: 100%;
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--pv-muted);
    text-align: left;
}

.pv-form-notice p {
    margin: 0;
}

.pv-form-optin {
    display: flex !important;
    align-items: flex-start;
    gap: 8px;
    flex-basis: 100%;
    grid-column: 1 / -1;
    width: 100%;
    margin: 8px 0 12px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--pv-text);
    text-align: left;
    cursor: pointer;
}

.pv-form-optin input {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
}

.pv-policy-meta {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--pv-muted);
}

/* ── Account privacy centre & generic policy page ───────── */
.pv-account,
.pv-acct-card,
.pv-policy-page {
    color: var(--pv-text);
    font-family: var(--pv-font);
    padding: 32px 16px 48px;
}

.pv-account__grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.pv-account__title,
.pv-policy-page__title {
    margin: 0 0 16px;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--pv-text);
}

.pv-account__card {
    margin-bottom: 16px;
    padding: 20px;
    background: var(--pv-bg);
    border: 1px solid var(--pv-border);
    border-radius: var(--pv-radius);
}

.pv-account__card h2 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: var(--pv-text);
}

.pv-account__card p {
    margin: 0 0 14px;
    color: var(--pv-muted);
    font-size: 14px;
    line-height: 1.55;
}

.pv-account__card--danger {
    border-color: #fca5a5;
}

.pv-account__row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pv-account__form {
    display: grid;
    gap: 8px;
    max-width: 360px;
}

.pv-account__form label {
    font-size: 13px;
    font-weight: 600;
}

.pv-account__form input {
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid var(--pv-border);
    border-radius: 6px;
    font: inherit;
    color: var(--pv-text);
    background: #fff;
}

.pv-account__alert {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
}

.pv-account__alert--ok {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.pv-account__alert--error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.pv-account__foot,
.pv-policy-page__foot {
    font-size: 13px;
    color: var(--pv-muted);
}

/* Only our own content: the theme's account navigation keeps its own link styles. */
.pv-account__main a:not(.pv-btn),
.pv-policy-page a {
    color: var(--pv-accent);
    text-decoration: underline;
}

.pv-btn--inline {
    flex: 0 0 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.pv-btn--danger {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

.pv-policy-page__inner {
    max-width: 860px;
    margin: 0 auto;
}

.pv-policy-page__crumbs {
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--pv-muted);
}

.pv-policy-page__body {
    font-size: 15px;
    line-height: 1.7;
}

.pv-policy-page__body h2 {
    margin: 28px 0 8px;
    font-size: 20px;
    font-weight: 700;
}

.pv-policy-page__body ul {
    margin: 0 0 12px;
    padding-left: 22px;
    list-style: disc;
}

.pv-policy-page__body p {
    margin: 0 0 12px;
}

@media (max-width: 900px) {
    .pv-account__grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 600px) {
    .pv-banner {
        left: 8px;
        right: 8px;
        bottom: calc(8px + var(--pv-lift, 0px));
        max-height: calc(100vh - 16px - var(--pv-lift, 0px));
        overflow-y: auto;
    }

    .pv-banner__inner {
        padding: 16px;
    }

    /* Strict banner: keep it short so the page (and "Add to cart") stays usable;
       long texts scroll inside, the three equal buttons share one row. */
    .pv-banner:not(.pv-banner--notice) .pv-banner__inner {
        padding: 12px 14px;
    }

    .pv-banner:not(.pv-banner--notice) .pv-banner__title {
        font-size: 15px;
        margin-bottom: 4px;
    }

    .pv-banner:not(.pv-banner--notice) .pv-banner__text {
        max-height: 16vh;
        overflow-y: auto;
        font-size: 13px;
    }

    .pv-banner:not(.pv-banner--notice) .pv-actions {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px;
    }

    .pv-banner:not(.pv-banner--notice) .pv-btn {
        flex: 1 1 0;
        width: auto;
        min-height: 44px;
        padding: 6px 8px;
        font-size: 13px;
        line-height: 1.2;
        white-space: normal;
    }

    .pv-banner--notice .pv-banner__inner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px 12px;
    }

    .pv-banner--notice .pv-actions {
        flex-direction: row;
    }

    .pv-banner--notice .pv-btn {
        flex: 1 1 0;
        width: auto;
    }

    .pv-actions {
        flex-direction: column;
    }

    .pv-btn {
        width: 100%;
        min-width: 0;
    }

    .pv-modal {
        padding: 0;
        align-items: flex-end;
    }

    .pv-modal__dialog {
        max-height: 92vh;
        border-radius: var(--pv-radius) var(--pv-radius) 0 0;
        padding: 20px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pv-switch__track,
    .pv-switch__track::after {
        transition: none;
    }
}

/* Checkout "save my details on this device" opt-in (universal/checkout.php) */
.pv-fast-checkout a {
    color: inherit;
    text-decoration: underline;
}

/* ── One-time account personalisation card (My Account) ─── */
.pv-acct-card {
    color: var(--pv-text);
    font-family: var(--pv-font);
    text-align: left;
}

.pv-acct-card .pv-account__row {
    margin: 0;
}

.pv-account__status {
    font-size: 14px;
}
