/*
 * OA Consent Manager — banner & preferences styles.
 * Self-contained, no external fonts or assets. Colours come from CSS variables
 * injected inline by the plugin (see Frontend::css_variables()).
 */

:root {
    --oacm-color-primary: #1a56db;
    --oacm-color-text: #1f2937;
    --oacm-color-bg: #ffffff;
    --oacm-color-border: #e5e7eb;
    --oacm-color-button-text: #ffffff;
    --oacm-radius: 12px;
    --oacm-btn-radius: 10px;
    --oacm-font-size: 15px;
    --oacm-banner-width: 560px;
    --oacm-shadow: 0 10px 40px rgba(0, 0, 0, .18);
}

#oa-consent-root,
#oa-consent-root * {
    box-sizing: border-box;
}

#oa-consent-root {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: var(--oacm-font-size, 15px);
    line-height: 1.5;
}

/* Optional dim overlay behind the notice (equal-weight, non-dismissive choice). */
.oacm-notice-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147482998;
    background: rgba(15, 23, 42, .45);
    display: none;
}

.oacm-notice-overlay.is-visible {
    display: block;
}

/* --------------------------------------------------------------------- *
 * Banner (notice)
 * --------------------------------------------------------------------- */

.oacm-banner {
    position: fixed;
    z-index: 2147483000;
    display: none;
    color: var(--oacm-color-text);
    background: var(--oacm-color-bg);
    border: 1px solid var(--oacm-color-border);
    border-radius: var(--oacm-radius);
    box-shadow: var(--oacm-shadow);
    padding: 20px 22px;
    width: min(var(--oacm-banner-width, 560px), calc(100% - 32px));
}

.oacm-banner.is-visible {
    display: block;
    animation: oacm-fade-in .25s ease;
}

.oacm-banner--bottom {
    left: 16px;
    bottom: 16px;
}

.oacm-banner--center {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(calc(var(--oacm-banner-width, 560px) + 60px), calc(100% - 32px));
}

.oacm-banner--expanded {
    /* default spacing */
}

.oacm-banner--compact {
    padding: 14px 16px;
}

.oacm-banner__close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: 0;
    background: transparent;
    color: var(--oacm-color-text);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 6px 9px;
    border-radius: 8px;
}

.oacm-banner__close:hover {
    background: rgba(0, 0, 0, .06);
}

.oacm-banner__head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 28px 8px 0;
}

.oacm-banner__logo {
    max-height: 34px;
    width: auto;
}

.oacm-banner__title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: var(--oacm-color-text);
}

.oacm-banner__text {
    margin: 0 0 12px;
}

.oacm-banner--compact .oacm-banner__text {
    font-size: 13.5px;
}

.oacm-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 14px;
}

.oacm-link {
    color: var(--oacm-color-primary);
    text-decoration: underline;
    font-size: 13.5px;
}

.oacm-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* --------------------------------------------------------------------- *
 * Buttons — Reject must be as prominent/accessible as Accept.
 * --------------------------------------------------------------------- */

.oacm-btn {
    flex: 1 1 auto;
    min-width: 120px;
    font-size: 14.5px;
    font-weight: 600;
    padding: 11px 16px;
    border-radius: var(--oacm-btn-radius, 10px);
    cursor: pointer;
    border: 2px solid var(--oacm-color-primary);
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.oacm-btn--primary {
    background: var(--oacm-color-primary);
    color: var(--oacm-color-button-text);
}

.oacm-btn--primary:hover {
    filter: brightness(1.06);
}

.oacm-btn--ghost {
    background: transparent;
    color: var(--oacm-color-primary);
}

.oacm-btn--ghost:hover {
    background: color-mix(in srgb, var(--oacm-color-primary) 10%, transparent);
}

.oacm-btn:focus-visible,
.oacm-banner__close:focus-visible,
.oacm-modal__close:focus-visible,
.oacm-link:focus-visible,
.oacm-switch input:focus-visible + .oacm-switch__slider,
.oacm-fab:focus-visible {
    outline: 3px solid var(--oacm-color-primary);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------- *
 * Preferences modal
 * --------------------------------------------------------------------- */

.oacm-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, .55);
}

.oacm-overlay.is-visible {
    display: flex;
    animation: oacm-fade-in .2s ease;
}

.oacm-modal {
    background: var(--oacm-color-bg);
    color: var(--oacm-color-text);
    border-radius: var(--oacm-radius);
    box-shadow: var(--oacm-shadow);
    width: min(620px, 100%);
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
}

.oacm-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--oacm-color-border);
}

.oacm-modal__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.oacm-modal__close {
    border: 0;
    background: transparent;
    color: var(--oacm-color-text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 8px;
}

.oacm-modal__close:hover {
    background: rgba(0, 0, 0, .06);
}

.oacm-modal__body {
    padding: 8px 20px 4px;
    overflow-y: auto;
}

.oacm-modal__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--oacm-color-border);
}

/* Category rows */

.oacm-cat {
    padding: 14px 0;
    border-bottom: 1px solid var(--oacm-color-border);
}

.oacm-cat:last-child {
    border-bottom: 0;
}

.oacm-cat__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.oacm-cat__label {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.oacm-cat__name {
    font-weight: 700;
    font-size: 15.5px;
}

.oacm-cat__always {
    font-size: 12.5px;
    color: var(--oacm-color-primary);
    font-weight: 600;
}

.oacm-cat__desc {
    margin: 6px 0 0;
    font-size: 13.5px;
    opacity: .85;
}

/* Toggle switch (real checkbox visually styled) */

.oacm-switch {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    width: 46px;
    height: 26px;
    cursor: pointer;
}

.oacm-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.oacm-switch__slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 999px;
    transition: background-color .15s ease;
}

.oacm-switch__slider::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

.oacm-switch input:checked + .oacm-switch__slider {
    background: var(--oacm-color-primary);
}

.oacm-switch input:checked + .oacm-switch__slider::before {
    transform: translateX(20px);
}

.oacm-switch input:disabled + .oacm-switch__slider {
    opacity: .65;
    cursor: not-allowed;
}

/* --------------------------------------------------------------------- *
 * Floating button
 * --------------------------------------------------------------------- */

.oacm-fab {
    position: fixed;
    bottom: 18px;
    z-index: 2147482999;
    background: var(--oacm-color-primary);
    color: var(--oacm-color-button-text);
    border: 0;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--oacm-shadow);
}

.oacm-fab--left { left: 18px; }
.oacm-fab--right { right: 18px; }

/* --------------------------------------------------------------------- *
 * Responsive
 * --------------------------------------------------------------------- */

@media (max-width: 600px) {
    .oacm-banner--bottom {
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: auto;
    }

    .oacm-btn {
        flex: 1 1 100%;
    }

    .oacm-modal {
        max-height: calc(100vh - 16px);
    }
}

/* When the modal is open, prevent background scroll. */
html.oacm-modal-open {
    overflow: hidden;
}

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

@keyframes oacm-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.oacm-banner--center.is-visible {
    animation: oacm-fade-in-center .25s ease;
}

@keyframes oacm-fade-in-center {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .oacm-banner.is-visible,
    .oacm-banner--center.is-visible,
    .oacm-overlay.is-visible,
    .oacm-switch__slider,
    .oacm-switch__slider::before,
    .oacm-btn {
        animation: none !important;
        transition: none !important;
    }
}
