/* Cookie consent banner + preferences dialog (wwwroot/js/shared/cookie-consent.js).
   Shared by _Layout and MainLayout; uses --ory-* tokens from theme.css only. */

.ory-consent-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 2000;
    max-width: 1080px;
    margin: 0 auto;
    padding: 18px 20px;
    background: var(--ory-surface);
    border: 1px solid var(--ory-border);
    border-radius: var(--ory-radius-lg);
    box-shadow: var(--ory-shadow-lg);
    font-family: var(--ory-font);
    color: var(--ory-text);
}

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

.ory-consent-inner {
    display: flex;
    align-items: center;
    gap: 20px 28px;
}

.ory-consent-text {
    flex: 1 1 auto;
    min-width: 0;
}

.ory-consent-title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--ory-ink);
}

.ory-consent-banner p,
.ory-consent-dialog p {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ory-text);
}

.ory-consent-banner a,
.ory-consent-dialog a {
    color: var(--ory-accent);
    font-weight: 500;
    text-decoration: underline;
}

.ory-consent-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}

/* Accept and Reject share one style so neither choice is nudged. */
.ory-consent-btn {
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--ory-accent);
    border-radius: var(--ory-radius);
    background: var(--ory-accent);
    color: var(--ory-surface);
    font: 600 14px/1.2 var(--ory-font);
    white-space: nowrap;
    cursor: pointer;
}

    .ory-consent-btn:hover {
        background: var(--ory-accent-hover);
        border-color: var(--ory-accent-hover);
    }

    .ory-consent-btn:focus-visible,
    .ory-consent-close:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px var(--ory-ring);
    }

.ory-consent-btn-link {
    background: transparent;
    border-color: var(--ory-border-strong);
    color: var(--ory-ink);
}

    .ory-consent-btn-link:hover {
        background: var(--ory-hover);
        border-color: var(--ory-border-strong);
    }

/* Preferences dialog */
.ory-consent-dialog {
    /* Re-centre: site resets strip the browser's default dialog margin. */
    position: fixed;
    inset: 0;
    margin: auto;
    height: fit-content;
    overflow-y: auto;
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 0;
    border: 1px solid var(--ory-border);
    border-radius: var(--ory-radius-xl);
    background: var(--ory-surface);
    box-shadow: var(--ory-shadow-pop);
    font-family: var(--ory-font);
    color: var(--ory-text);
}

    .ory-consent-dialog::backdrop {
        background: color-mix(in srgb, var(--ory-dark) 45%, transparent);
    }

.ory-consent-form {
    margin: 0;
    padding: 22px 24px;
}

.ory-consent-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

    .ory-consent-dialog-head h2 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        color: var(--ory-ink);
    }

.ory-consent-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: var(--ory-radius);
    background: transparent;
    color: var(--ory-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

    .ory-consent-close:hover {
        background: var(--ory-hover);
        color: var(--ory-ink);
    }

.ory-consent-intro {
    margin-bottom: 12px !important;
}

.ory-consent-category {
    padding: 14px 0;
    border-top: 1px solid var(--ory-hairline);
}

.ory-consent-category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
}

    .ory-consent-category-head label {
        margin: 0;
        font-size: 15px;
        font-weight: 600;
        color: var(--ory-ink);
        cursor: pointer;
    }

.ory-consent-always {
    font-weight: 600;
    color: var(--ory-success-ink);
}

/* Toggle switch: real checkbox stretched over the visual track. */
.ory-consent-switch {
    position: relative;
    flex: 0 0 auto;
    width: 44px;
    height: 24px;
}

    .ory-consent-switch input {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        opacity: 0;
        cursor: pointer;
        z-index: 1;
    }

        .ory-consent-switch input:disabled {
            cursor: not-allowed;
        }

    .ory-consent-switch span {
        position: absolute;
        inset: 0;
        border-radius: var(--ory-radius-pill);
        background: var(--ory-border-strong);
        transition: background .15s ease;
    }

        .ory-consent-switch span::after {
            content: "";
            position: absolute;
            top: 3px;
            left: 3px;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: var(--ory-surface);
            box-shadow: var(--ory-shadow-sm);
            transition: transform .15s ease;
        }

    .ory-consent-switch input:checked + span {
        background: var(--ory-accent);
    }

        .ory-consent-switch input:checked + span::after {
            transform: translateX(20px);
        }

    .ory-consent-switch input:disabled + span {
        opacity: .6;
    }

    .ory-consent-switch input:focus-visible + span {
        box-shadow: 0 0 0 3px var(--ory-ring);
    }

.ory-consent-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--ory-hairline);
}

@media (max-width: 767.98px) {
    .ory-consent-banner {
        left: 12px;
        right: 12px;
        bottom: 12px;
        padding: 16px;
    }

    .ory-consent-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .ory-consent-actions {
        flex-wrap: wrap;
    }

        .ory-consent-actions .ory-consent-btn {
            flex: 1 1 calc(50% - 4px);
        }

        .ory-consent-actions .ory-consent-btn-link {
            flex-basis: 100%;
            order: 3;
        }

    .ory-consent-form {
        padding: 18px 16px;
    }

    .ory-consent-dialog-actions {
        flex-wrap: wrap;
    }

        .ory-consent-dialog-actions .ory-consent-btn {
            flex: 1 1 calc(50% - 4px);
        }
}

@media (prefers-reduced-motion: reduce) {
    .ory-consent-switch span,
    .ory-consent-switch span::after {
        transition: none;
    }
}
