/**
 * PCT Cookies Multisite - banner and preferences panel.
 *
 * Colours come from the theme tokens of theme.json when they exist, with
 * fallbacks so the plugin also works outside this theme.
 */

.pct-cookies,
.pct-cookies-reopen {
    --pct-bg: var(
        --wp--custom--cookie-banner--bg,
        var(--wp--preset--color--dark, #1a1a2e)
    );
    --pct-text: var(
        --wp--custom--cookie-banner--text,
        var(--wp--preset--color--light, #ffffff)
    );
    --pct-radius: var(--wp--custom--cookie-banner--btn-border-radius, 0px);
    --pct-accept-text: var(
        --wp--custom--cookie-banner--btn-accept--text-color,
        var(--wp--preset--color--dark, #111111)
    );
    --pct-accept-bg: var(
        --wp--custom--cookie-banner--btn-accept--bg-color,
        var(--wp--preset--color--primary, #f0c400)
    );
    --pct-accept-border: var(
        --wp--custom--cookie-banner--btn-accept--border-color,
        var(--wp--preset--color--primary, #f0c400)
    );
    --pct-accept-text-hover: var(
        --wp--custom--cookie-banner--btn-accept--hover--text-color,
        var(--wp--preset--color--primary, #f0c400)
    );
    --pct-accept-bg-hover: var(
        --wp--custom--cookie-banner--btn-accept--hover--bg-color,
        var(--wp--preset--color--dark, #111111)
    );
    --pct-reject-text: var(
        --wp--custom--cookie-banner--btn-reject--text-color,
        var(--wp--preset--color--primary, #f0c400)
    );
    --pct-reject-bg: var(
        --wp--custom--cookie-banner--btn-reject--bg-color,
        transparent
    );
    --pct-reject-border: var(
        --wp--custom--cookie-banner--btn-reject--border-color,
        var(--wp--preset--color--primary, #f0c400)
    );
    --pct-muted: rgba(255, 255, 255, 0.78);
    --pct-gap: 16px;
    --pct-font-size: 15px;
    font-size: var(--pct-font-size);
    line-height: 1.5;
    box-sizing: border-box;
}

.pct-cookies *,
.pct-cookies *::before,
.pct-cookies *::after,
.pct-cookies-reopen * {
    box-sizing: inherit;
}

html.pct-cookies-locked {
    overflow: hidden;
}

/* --- Banner ------------------------------------------------------------ */

.pct-cookies__banner {
    position: fixed;
    z-index: 999999;
    background: var(--pct-bg);
    color: var(--pct-text);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
}

.pct-cookies__banner[hidden],
.pct-cookies__overlay[hidden] {
    display: none !important;
}

.pct-cookies[data-pct-position="bar"] .pct-cookies__banner {
    left: 0;
    right: 0;
    bottom: 0;
}

.pct-cookies[data-pct-position="card"] .pct-cookies__banner {
    left: 24px;
    bottom: 24px;
    max-width: 440px;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
}

.pct-cookies[data-pct-position="modal"] .pct-cookies__banner {
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.55);
    box-shadow: none;
}

.pct-cookies[data-pct-position="modal"]
    .pct-cookies__banner
    .pct-cookies__inner {
    max-width: 640px;
    width: 100%;
    background: var(--pct-bg);
    border-radius: 6px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.pct-cookies__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--pct-gap);
}

.pct-cookies__content {
    flex: 1 1 320px;
    min-width: 0;
}

.pct-cookies__title {
    margin: 0 0 6px;
    font-size: 1.1em;
    line-height: 1.25;
    color: inherit;
}

.pct-cookies__message {
    color: var(--pct-muted);
}

.pct-cookies__message p {
    margin: 0 0 6px;
}

.pct-cookies__message p:last-child {
    margin-bottom: 0;
}

.pct-cookies__link {
    color: var(--pct-accept-bg);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.pct-cookies__link:hover,
.pct-cookies__link:focus {
    color: var(--pct-text);
}

.pct-cookies__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* --- Buttons ----------------------------------------------------------- */

.pct-cookies__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--pct-radius);
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}

.pct-cookies__btn--accept {
    background: var(--pct-accept-bg);
    border-color: var(--pct-accept-border);
    color: var(--pct-accept-text);
}

.pct-cookies__btn--accept:hover,
.pct-cookies__btn--accept:focus-visible {
    background: var(--pct-accept-bg-hover);
    border-color: var(--pct-accept-bg-hover);
    color: var(--pct-accept-text-hover);
}

.pct-cookies__btn--reject {
    background: var(--pct-reject-bg);
    border-color: var(--pct-reject-border);
    color: var(--pct-reject-text);
}

.pct-cookies__btn--reject:hover,
.pct-cookies__btn--reject:focus-visible {
    background: var(--pct-accept-bg);
    border-color: var(--pct-accept-bg);
    color: var(--pct-accept-text);
}

.pct-cookies__btn--configure {
    background: transparent;
    border-color: transparent;
    color: var(--pct-text);
    text-decoration: underline;
    text-underline-offset: 3px;
    padding-inline: 8px;
}

.pct-cookies__btn--configure:hover,
.pct-cookies__btn--configure:focus-visible {
    color: var(--pct-accept-bg);
}

.pct-cookies__btn--ghost {
    background: transparent;
    border-color: var(--pct-reject-border);
    color: var(--pct-text);
}

.pct-cookies__btn--ghost:hover,
.pct-cookies__btn--ghost:focus-visible {
    border-color: var(--pct-text);
}

.pct-cookies__btn--link {
    background: transparent;
    border-color: transparent;
    color: var(--pct-muted);
    text-decoration: underline;
    text-underline-offset: 3px;
    padding-inline: 8px;
}

.pct-cookies__btn--link:hover,
.pct-cookies__btn--link:focus-visible {
    color: var(--pct-text);
}

.pct-cookies__btn:focus-visible,
.pct-cookies__close:focus-visible,
.pct-cookies__switch-input:focus-visible + .pct-cookies__switch-label,
.pct-cookies-reopen:focus-visible {
    outline: 3px solid var(--pct-accept-bg);
    outline-offset: 2px;
}

/* --- Preferences dialog ------------------------------------------------ */

.pct-cookies__overlay {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.6);
    overflow-y: auto;
}

.pct-cookies__dialog {
    width: 100%;
    max-width: 680px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    background: var(--pct-bg);
    color: var(--pct-text);
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.pct-cookies__dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.pct-cookies__dialog-title {
    margin: 0;
    font-size: 1.15em;
    color: inherit;
}

.pct-cookies__close {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.pct-cookies__close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.pct-cookies__dialog-body {
    padding: 8px 24px;
    overflow-y: auto;
}

.pct-cookies__group {
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pct-cookies__group:last-child {
    border-bottom: 0;
}

.pct-cookies__group-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.pct-cookies__group-text {
    min-width: 0;
}

.pct-cookies__group-title {
    margin: 0 0 4px;
    font-size: 1em;
    color: inherit;
}

.pct-cookies__group-description {
    margin: 0;
    color: var(--pct-muted);
    font-size: 0.92em;
}

.pct-cookies__group-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.pct-cookies__badge {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pct-muted);
    white-space: nowrap;
}

.pct-cookies__dialog-policy {
    margin: 0;
    padding: 0 0 4px;
}

.pct-cookies__dialog-footer {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.08);
}

/* --- Switch ------------------------------------------------------------ */

.pct-cookies__switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex: 0 0 auto;
}

.pct-cookies__switch-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}

.pct-cookies__switch-label {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

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

.pct-cookies__switch-input:checked + .pct-cookies__switch-label {
    background: var(--pct-accept-bg);
}

.pct-cookies__switch-input:checked + .pct-cookies__switch-label::after {
    transform: translateX(20px);
}

.pct-cookies__switch-input:disabled + .pct-cookies__switch-label {
    cursor: not-allowed;
    opacity: 0.65;
}

/* --- Reopen button ----------------------------------------------------- */

.pct-cookies-reopen {
    position: fixed;
    bottom: 20px;
    z-index: 999998;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--pct-accept-border);
    border-radius: var(--pct-radius);
    background: var(--pct-bg);
    color: var(--pct-text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.pct-cookies-reopen[hidden] {
    display: none !important;
}

.pct-cookies-reopen::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--pct-accept-bg);
    box-shadow: inset 0 0 0 2px var(--pct-bg);
    background: var(--pct-accept-bg);
}

.pct-cookies-reopen--bottom-left {
    left: 20px;
}

.pct-cookies-reopen--bottom-right {
    right: 20px;
}

.pct-cookies-reopen:hover {
    background: var(--pct-accept-bg);
    color: var(--pct-accept-text);
}

/* --- Utilities --------------------------------------------------------- */

.pct-cookies__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}

@media (max-width: 782px) {
    .pct-cookies[data-pct-position="card"] .pct-cookies__banner {
        left: 0;
        right: 0;
        bottom: 0;
        max-width: none;
        border-radius: 0;
    }

    .pct-cookies__inner {
        padding: 16px;
        gap: 12px;
    }

    .pct-cookies__actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .pct-cookies__btn {
        width: 100%;
    }

    .pct-cookies__dialog-footer {
        flex-direction: column-reverse;
    }

    .pct-cookies-reopen {
        bottom: 12px;
    }

    .pct-cookies-reopen--bottom-left {
        left: 12px;
    }

    .pct-cookies-reopen--bottom-right {
        right: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pct-cookies__btn,
    .pct-cookies__switch-label,
    .pct-cookies__switch-label::after {
        transition: none;
    }
}
