/**
 * CookieBar styles — standalone, no framework, no resets required.
 *
 * Every colour is a custom property on .jcb, so a host project can re-skin the
 * whole thing by overriding a handful of variables (see README).
 */

.jcb {
    --jcb-accent: var(--theme-color, #4657CE);
    --jcb-accent-contrast: #FFFFFF;
    --jcb-surface: #FFFFFF;
    --jcb-text: #21243D;
    --jcb-muted: #5A5E75;
    --jcb-border: #DDE0EB;
    --jcb-radius: 10px;
    --jcb-shadow: 0 -2px 24px rgba(20, 24, 60, .14);
    --jcb-z: 99999;

    font-family: inherit;
    color: var(--jcb-text);
}

.jcb *,
.jcb *::before,
.jcb *::after {
    box-sizing: border-box;
}

.jcb-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.jcb-locked {
    overflow: hidden;
}

/* --------------------------------------------------------------------- bar */

.jcb-bar {
    position: fixed;
    left: 0;
    right: 0;
    z-index: var(--jcb-z);
    padding: 20px 24px 12px;
    background: var(--jcb-surface);
    box-shadow: var(--jcb-shadow);
    animation: jcb-slide-up .35s ease;
}

.jcb--bottom .jcb-bar { bottom: 0; }

.jcb--top .jcb-bar {
    top: 0;
    box-shadow: 0 2px 24px rgba(20, 24, 60, .14);
    animation: jcb-slide-down .35s ease;
}

/* Box layout: a compact card instead of a full-width bar. */
.jcb--box .jcb-bar {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: min(420px, calc(100vw - 32px));
    border-radius: var(--jcb-radius);
    padding: 24px;
}

.jcb--box .jcb-bar__inner {
    display: block;
}

.jcb--box .jcb-bar__actions {
    margin-top: 18px;
    justify-content: flex-start;
}

.jcb-bar__inner {
    display: flex;
    align-items: center;
    gap: 32px;
    max-width: 1140px;  /* align with the site's Bootstrap container */
    margin: 0 auto;
}

.jcb-bar__text {
    flex: 1 1 auto;
    min-width: 0;
}

.jcb-bar__title {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--jcb-text);
}

.jcb-bar__body {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--jcb-muted);
}

.jcb-bar__actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.jcb-bar__credit {
    margin-top: 8px;
    font-size: 11px;
    text-align: right;
    color: #9BA0B5;
}

.jcb-link {
    color: var(--jcb-accent);
    text-decoration: underline;
}

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

.jcb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 140px;
    padding: 11px 22px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 999px;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.jcb-btn:focus-visible {
    outline: 2px solid var(--jcb-accent);
    outline-offset: 2px;
}

.jcb-btn--solid {
    color: var(--jcb-accent-contrast);
    background: var(--jcb-accent);
    border-color: var(--jcb-accent);
}

.jcb-btn--solid:hover {
    filter: brightness(.93);
}

.jcb-btn--ghost {
    color: var(--jcb-accent);
    background: transparent;
    border-color: var(--jcb-accent);
}

.jcb-btn--ghost:hover {
    color: var(--jcb-accent-contrast);
    background: var(--jcb-accent);
}

.jcb-caret {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
}

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

.jcb-modal {
    position: fixed;
    inset: 0;
    z-index: calc(var(--jcb-z) + 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.jcb-modal[hidden] {
    display: none;
}

.jcb-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 24, 60, .55);
}

.jcb-modal__dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(640px, 100%);
    max-height: min(80vh, 720px);
    background: var(--jcb-surface);
    border-radius: var(--jcb-radius);
    box-shadow: 0 24px 60px rgba(20, 24, 60, .3);
    animation: jcb-pop .2s ease;
}

/* The dialog receives focus on open only so the focus-trap has an anchor; it is
   not an interactive control, so it should not show a focus ring. */
.jcb-modal__dialog:focus {
    outline: none;
}

.jcb-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--jcb-border);
}

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

.jcb-modal__close {
    padding: 0 4px;
    font-size: 26px;
    line-height: 1;
    color: var(--jcb-muted);
    cursor: pointer;
    background: none;
    border: 0;
}

.jcb-modal__body {
    flex: 1 1 auto;
    padding: 20px 24px;
    overflow-y: auto;
}

.jcb-modal__intro {
    margin: 0 0 18px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--jcb-muted);
}

.jcb-modal__foot {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 24px 22px;
    border-top: 1px solid var(--jcb-border);
}

.jcb-modal__foot .jcb-btn {
    min-width: 0;
    flex: 1 1 auto;
    padding: 10px 16px;
    font-size: 13px;
}

/* -------------------------------------------------------------- categories */

.jcb-cat {
    border-bottom: 1px solid var(--jcb-border);
}

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

.jcb-cat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 44px;
    padding: 10px 0;
}

.jcb-cat__toggle {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
    padding: 0;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--jcb-text);
    text-align: left;
    cursor: pointer;
    background: none;
    border: 0;
}

.jcb-cat__chevron {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--jcb-muted);
    border-bottom: 2px solid var(--jcb-muted);
    transform: rotate(-45deg);
    transition: transform .18s ease;
}

.jcb-cat__toggle[aria-expanded="true"] .jcb-cat__chevron {
    transform: rotate(45deg);
}

.jcb-cat__body {
    padding: 0 0 14px 17px;
}

.jcb-cat__body p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--jcb-muted);
}

.jcb-always {
    flex: 0 0 auto;
    align-self: center;
    font-size: 12px;
    font-weight: 600;
    line-height: 24px;
    color: var(--jcb-accent);
}

/* ------------------------------------------------------------------ switch */

.jcb-switch {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 24px;
    cursor: pointer;
}

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

.jcb-switch__track {
    display: block;
    width: 42px;
    height: 24px;
    background: #C7CBDA;
    border-radius: 999px;
    transition: background-color .18s ease;
}

.jcb-switch__track::after {
    content: "";
    display: block;
    width: 18px;
    height: 18px;
    margin: 3px;
    background: #FFFFFF;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .18s ease;
}

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

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

.jcb-switch input:focus-visible + .jcb-switch__track {
    outline: 2px solid var(--jcb-accent);
    outline-offset: 2px;
}

/* ----------------------------------------------------------------- revisit */

.jcb-revisit {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: calc(var(--jcb-z) - 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: var(--jcb-accent-contrast);
    cursor: pointer;
    background: var(--jcb-accent);
    border: 0;
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(20, 24, 60, .25);
}

.jcb-revisit[hidden] {
    display: none;
}

/* -------------------------------------------------------------- animations */

@keyframes jcb-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@keyframes jcb-slide-down {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
}

@keyframes jcb-pop {
    from { opacity: 0; transform: scale(.97); }
    to   { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .jcb-bar,
    .jcb-modal__dialog {
        animation: none;
    }
}

/* ------------------------------------------------------------------ mobile */

@media (max-width: 991px) {
    .jcb-bar__inner {
        display: block;
    }

    .jcb-bar__actions {
        margin-top: 16px;
    }

    .jcb-bar__actions .jcb-btn {
        flex: 1 1 auto;
        min-width: 0;
    }

    .jcb-bar__credit {
        text-align: left;
    }
}

@media (max-width: 575px) {
    .jcb-bar {
        max-height: 90vh;
        overflow-y: auto;
        padding: 18px 18px 10px;
    }

    .jcb--box .jcb-bar {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
    }

    .jcb-bar__actions .jcb-btn {
        flex: 1 1 100%;
    }

    .jcb-modal__foot .jcb-btn {
        flex: 1 1 100%;
    }
}
