/**
 * UCB Sliding Side Cart
 *
 * Ticket-stub drawer: dark marquee header (Knockout type + gold bulb strip),
 * cream paper body, line items as perforated stubs, brick-red pill checkout.
 * Brand palette per ucb-dialog.css / ucb-site.css: red #a4281d, gold #e5a800.
 */

.ucb-sc,
.ucb-sc-fab {
    --sc-red: #a4281d;
    --sc-red-deep: #7e1a12;
    --sc-gold: #e5a800;
    --sc-gold-soft: #ffd66b;
    --sc-ink: #1b1713;
    --sc-ink-2: #2a241e;
    --sc-paper: #f5f0e6;
    --sc-card: #fffdf8;
    --sc-line: #e3dccc;
    --sc-muted: #7c7568;
    --sc-font: 'DM Sans', -apple-system, sans-serif;
    --sc-display: 'Knockout 31 Junior Middlewt', 'Arial Narrow', var(--sc-font);
    --sc-ease: cubic-bezier(0.32, 0.72, 0, 1);
    font-family: var(--sc-font);
}

/* Author display values (flex etc.) would otherwise beat the UA's
   [hidden] { display:none } — make hidden always win. */
.ucb-sc [hidden],
.ucb-sc-fab[hidden] {
    display: none !important;
}

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

.ucb-sc-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    z-index: 99990;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(160deg, #b53225 0%, var(--sc-red) 55%, var(--sc-red-deep) 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(126, 26, 18, 0.42), 0 2px 5px rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    transition: transform 0.22s var(--sc-ease), box-shadow 0.22s var(--sc-ease);
    animation: ucb-sc-fab-in 0.45s var(--sc-ease) both;
}

.ucb-sc-fab:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 24px rgba(126, 26, 18, 0.5), 0 3px 7px rgba(0, 0, 0, 0.24);
}

.ucb-sc-fab:focus-visible {
    outline: 3px solid var(--sc-gold);
    outline-offset: 3px;
}

.ucb-sc-fab__icon {
    width: 26px;
    height: 26px;
    display: block;
}

.ucb-sc-fab__count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 23px;
    height: 23px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--sc-gold);
    color: var(--sc-ink);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 23px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.ucb-sc-fab.is-bump .ucb-sc-fab__count {
    animation: ucb-sc-bump 0.45s var(--sc-ease);
}

@keyframes ucb-sc-fab-in {
    from { transform: translateY(16px) scale(0.6); opacity: 0; }
    to   { transform: translateY(0) scale(1);      opacity: 1; }
}

@keyframes ucb-sc-bump {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.45); }
    100% { transform: scale(1); }
}

/* ------------------------------------------------------------------ */
/* Drawer shell                                                        */
/* ------------------------------------------------------------------ */

.ucb-sc {
    position: fixed;
    inset: 0;
    z-index: 99999;
    visibility: hidden;
    transition: visibility 0s linear 0.4s;
}

.ucb-sc.is-open {
    visibility: visible;
    transition-delay: 0s;
}

.ucb-sc__overlay {
    position: absolute;
    inset: 0;
    background: rgba(20, 14, 10, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.35s ease;
    cursor: pointer;
}

.ucb-sc.is-open .ucb-sc__overlay {
    opacity: 1;
}

.ucb-sc__panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(420px, 100vw);
    display: flex;
    flex-direction: column;
    background:
        repeating-linear-gradient(-45deg, rgba(27, 23, 19, 0.016) 0 2px, transparent 2px 6px),
        var(--sc-paper);
    box-shadow: -18px 0 48px rgba(0, 0, 0, 0.35);
    transform: translateX(102%);
    transition: transform 0.4s var(--sc-ease);
}

.ucb-sc.is-open .ucb-sc__panel {
    transform: translateX(0);
}

body.ucb-sc-lock {
    overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Header — dark marquee with gold bulb strip                          */
/* ------------------------------------------------------------------ */

.ucb-sc__header {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 22px 24px;
    background: linear-gradient(175deg, var(--sc-ink-2) 0%, var(--sc-ink) 70%);
    color: #fff;
}

.ucb-sc__title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--sc-display);
    font-size: 34px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.045em;
    text-transform: uppercase;
    color: #fff;
}

.ucb-sc__count-chip {
    display: inline-block;
    min-width: 27px;
    padding: 5px 8px 4px;
    border-radius: 999px;
    background: var(--sc-gold);
    color: var(--sc-ink);
    font-family: var(--sc-font);
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    transform: translateY(-2px);
}

.ucb-sc__close {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.ucb-sc__close:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: rotate(90deg);
}

.ucb-sc__close:focus-visible {
    outline: 2px solid var(--sc-gold);
    outline-offset: 2px;
}

.ucb-sc__close svg {
    width: 18px;
    height: 18px;
}

/* Marquee bulbs along the header's bottom edge */
.ucb-sc__bulbs {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 5px;
    height: 6px;
    background-image: radial-gradient(circle at 3px 3px, var(--sc-gold) 2.1px, rgba(229, 168, 0, 0.18) 2.9px, transparent 3.4px);
    background-size: 22px 6px;
    background-position: 11px 0;
}

/* Perforated tear line between header and body */
.ucb-sc__perf {
    flex: 0 0 auto;
    height: 12px;
    margin-top: -1px;
    background-image: radial-gradient(circle at 6px 0, var(--sc-ink) 5px, transparent 5.6px);
    background-size: 26px 12px;
    background-position: 7px 0;
    background-repeat: repeat-x;
}

/* ------------------------------------------------------------------ */
/* Body                                                                */
/* ------------------------------------------------------------------ */

.ucb-sc__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 18px 24px;
}

/* Loading dots */
.ucb-sc__loading {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 48px 0;
}

.ucb-sc__loading span:not(.screen-reader-text) {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--sc-gold);
    animation: ucb-sc-dot 1s ease-in-out infinite;
}

.ucb-sc__loading span:nth-child(2) { animation-delay: 0.15s; }
.ucb-sc__loading span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ucb-sc-dot {
    0%, 100% { transform: translateY(0);    opacity: 0.5; }
    45%      { transform: translateY(-7px); opacity: 1; }
}

/* Add-to-cart progress bar — thin indeterminate sweep at the top of the body
   while an add is in flight (JS-inserted as the body's first child). */
.ucb-sc__progress {
    position: relative;
    height: 3px;
    margin: 0 0 14px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(27, 23, 19, 0.1);
}

.ucb-sc__progress::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -40%;
    width: 40%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--sc-red), var(--sc-gold));
    animation: ucb-sc-progress 1.05s var(--sc-ease) infinite;
}

@keyframes ucb-sc-progress {
    0%   { left: -45%; }
    100% { left: 100%; }
}

/* Error */
.ucb-sc__error {
    margin: 12px 4px;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid #e8b4ae;
    background: #fdf1ef;
    color: #7e1a12;
    font-size: 14px;
}

.ucb-sc__error p { margin: 0 0 10px; }

.ucb-sc__retry {
    border: 0;
    border-radius: 999px;
    padding: 7px 18px;
    background: var(--sc-red);
    color: #fff;
    font-family: var(--sc-font);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    -webkit-appearance: none;
}

.ucb-sc__retry:hover { filter: brightness(1.08); }

/* Empty state */
.ucb-sc__empty {
    text-align: center;
    padding: 56px 26px 40px;
}

.ucb-sc__empty-ticket {
    width: 120px;
    height: 72px;
    color: var(--sc-gold);
    transform: rotate(-6deg);
    margin-bottom: 18px;
    filter: drop-shadow(0 4px 10px rgba(229, 168, 0, 0.25));
}

.ucb-sc__empty-title {
    margin: 0 0 6px;
    font-family: var(--sc-display);
    font-size: 30px;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sc-ink);
}

.ucb-sc__empty-sub {
    margin: 0 auto 26px;
    max-width: 22em;
    font-size: 14.5px;
    color: var(--sc-muted);
    /* Balance the two lines so we don't get a lone "in it." orphan. */
    text-wrap: balance;
}

.ucb-sc__browse {
    display: inline-block;
    border-radius: 999px;
    padding: 12px 30px;
    background: var(--sc-gold);
    color: var(--sc-ink) !important;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none !important;
    box-shadow: 0 3px 10px rgba(229, 168, 0, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ucb-sc__browse:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(229, 168, 0, 0.45);
    color: var(--sc-ink);
}

.ucb-sc__browse:focus-visible {
    outline: 3px solid var(--sc-red);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Line items — ticket stubs                                           */
/* ------------------------------------------------------------------ */

.ucb-sc__items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ucb-sc__item {
    position: relative;
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr) auto;
    gap: 0 14px;
    align-items: start;
    background: var(--sc-card);
    border: 1px solid var(--sc-line);
    border-radius: 10px;
    padding: 14px 16px 14px 14px;
    box-shadow: 0 2px 8px rgba(27, 23, 19, 0.06);
    transition: opacity 0.2s ease;
}

.ucb-sc.is-open .ucb-sc__item {
    animation: ucb-sc-item-in 0.4s var(--sc-ease) both;
    animation-delay: calc(var(--sc-i, 0) * 45ms + 0.12s);
}

@keyframes ucb-sc-item-in {
    from { transform: translateX(28px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.ucb-sc__item.is-busy {
    opacity: 0.6;
    pointer-events: none;
}

/* Remove-in-flight: swap the trash icon for a spinner (bright red so it reads
   even against the dimmed row) — instant feedback that the delete registered. */
.ucb-sc__remove-spin {
    display: none;
}

.ucb-sc__item.is-busy .ucb-sc__remove svg {
    display: none;
}

.ucb-sc__item.is-busy .ucb-sc__remove-spin {
    display: block;
    width: 16px;
    height: 16px;
    box-sizing: border-box;
    border: 2px solid var(--sc-line);
    border-top-color: var(--sc-red);
    border-radius: 999px;
    animation: ucb-sc-spin 0.6s linear infinite;
}

/* Quantity-change-in-flight: keep the row interactive (unlike is-busy), just
   fade the stale line total and spin a small loader over it. */
.ucb-sc__item-spin {
    display: none;
}

.ucb-sc__item.is-saving .ucb-sc__item-total {
    opacity: 0.3;
    transition: opacity 0.15s ease;
}

.ucb-sc__item.is-saving .ucb-sc__item-spin {
    display: block;
    position: absolute;
    top: 3px;
    right: 0;
    width: 14px;
    height: 14px;
    box-sizing: border-box;
    border: 2px solid var(--sc-line);
    border-top-color: var(--sc-gold);
    border-radius: 999px;
    animation: ucb-sc-spin 0.6s linear infinite;
}

@keyframes ucb-sc-spin {
    to { transform: rotate(360deg); }
}

/* Stub tear line before the price column, with punched notches */
.ucb-sc__item-right {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    align-self: stretch;
    padding-left: 14px;
    border-left: 1.5px dashed var(--sc-line);
}

.ucb-sc__item-right::before,
.ucb-sc__item-right::after {
    content: '';
    position: absolute;
    left: -7px;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--sc-paper);
    border: 1px solid var(--sc-line);
}

.ucb-sc__item-right::before { top: -20px; }
.ucb-sc__item-right::after  { bottom: -20px; }

.ucb-sc__thumb {
    width: 62px;
    height: 62px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--sc-paper);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sc-gold);
}

.ucb-sc__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    max-width: 100%;
}

.ucb-sc__thumb svg {
    width: 34px;
    height: 24px;
}

.ucb-sc__item-main {
    min-width: 0;
    padding: 2px 0;
}

.ucb-sc__item-name {
    display: block;
    margin: 0 0 4px;
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--sc-ink) !important;
    text-decoration: none !important;
}

a.ucb-sc__item-name:hover {
    color: var(--sc-red) !important;
}

a.ucb-sc__item-name:focus-visible {
    outline: 2px solid var(--sc-red);
    outline-offset: 2px;
}

.ucb-sc__item-type {
    display: inline-block;
    margin: 0 0 6px;
    padding: 3px 9px 2px;
    border-radius: 999px;
    background: rgba(229, 168, 0, 0.16);
    border: 1px solid rgba(229, 168, 0, 0.45);
    color: #8a6400;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    line-height: 1.4;
}

.ucb-sc__item-meta {
    margin: 0 0 8px;
    font-size: 12.5px;
    color: var(--sc-muted);
    line-height: 1.35;
}

.ucb-sc__item-price-each {
    font-size: 12.5px;
    color: var(--sc-muted);
}

/* Quantity stepper */
.ucb-sc__qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--sc-line);
    border-radius: 999px;
    background: #fff;
    overflow: hidden;
}

.ucb-sc__qty-btn {
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    color: var(--sc-ink);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    transition: background 0.12s ease;
}

.ucb-sc__qty-btn:hover:not(:disabled) {
    background: #f3eee2;
    color: var(--sc-red);
}

.ucb-sc__qty-btn:focus-visible {
    outline: 2px solid var(--sc-red);
    outline-offset: -2px;
}

.ucb-sc__qty-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.ucb-sc__qty-num {
    min-width: 26px;
    text-align: center;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--sc-ink);
}

.ucb-sc__qty-fixed {
    font-size: 13px;
    color: var(--sc-muted);
}

.ucb-sc__item-total {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--sc-ink);
    white-space: nowrap;
}

.ucb-sc__remove {
    border: 0;
    background: transparent;
    width: 32px;
    height: 32px;
    padding: 6px;
    margin: auto -6px -4px 0;
    border-radius: 999px;
    color: var(--sc-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    transition: color 0.12s ease, background 0.12s ease;
}

.ucb-sc__remove svg {
    width: 18px;
    height: 18px;
    display: block;
}

.ucb-sc__remove:hover {
    color: var(--sc-red);
    background: rgba(164, 40, 29, 0.09);
}

.ucb-sc__remove:focus-visible {
    outline: 2px solid var(--sc-red);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */

.ucb-sc__footer {
    flex: 0 0 auto;
    padding: 16px 22px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    background: var(--sc-card);
    border-top: 1.5px dashed var(--sc-line);
    box-shadow: 0 -6px 18px rgba(27, 23, 19, 0.07);
}

.ucb-sc__subtotal {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 15px;
    font-weight: 700;
    color: var(--sc-ink);
}

.ucb-sc__subtotal-amt {
    font-family: var(--sc-display);
    font-size: 27px;
    letter-spacing: 0.03em;
}

.ucb-sc__fineprint {
    margin: 2px 0 14px;
    font-size: 12px;
    color: var(--sc-muted);
}

.ucb-sc__checkout {
    display: block;
    border-radius: 999px;
    padding: 14px 20px;
    background: linear-gradient(160deg, #b53225 0%, var(--sc-red) 60%, var(--sc-red-deep) 100%);
    color: #fff !important;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    text-decoration: none !important;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 14px rgba(164, 40, 29, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.ucb-sc__checkout:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
    box-shadow: 0 7px 18px rgba(164, 40, 29, 0.42);
    color: #fff;
}

.ucb-sc__checkout:focus-visible {
    outline: 3px solid var(--sc-gold);
    outline-offset: 2px;
}

.ucb-sc__viewcart {
    display: block;
    margin-top: 11px;
    text-align: center;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--sc-muted) !important;
    text-decoration: underline !important;
    text-underline-offset: 3px;
}

.ucb-sc__viewcart:hover {
    color: var(--sc-red) !important;
}

.ucb-sc__viewcart:focus-visible {
    outline: 2px solid var(--sc-red);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Small screens / reduced motion                                      */
/* ------------------------------------------------------------------ */

@media (max-width: 480px) {
    .ucb-sc-fab {
        width: 52px;
        height: 52px;
        right: 14px;
    }

    .ucb-sc__title { font-size: 29px; }

    .ucb-sc__body { padding: 14px 12px 20px; }

    /* Finger-sized touch targets */
    .ucb-sc__qty-btn {
        width: 36px;
        height: 36px;
    }

    .ucb-sc__remove {
        width: 40px;
        height: 40px;
        margin-right: -10px;
    }

    .ucb-sc__item {
        grid-template-columns: 52px minmax(0, 1fr) auto;
        gap: 0 10px;
        padding: 12px 12px 12px 10px;
    }

    .ucb-sc__thumb {
        width: 52px;
        height: 52px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ucb-sc-fab,
    .ucb-sc-fab.is-bump .ucb-sc-fab__count,
    .ucb-sc.is-open .ucb-sc__item {
        animation: none;
    }

    /* Keep the loaders visible (as static rings) but stop them spinning. */
    .ucb-sc__item.is-saving .ucb-sc__item-spin,
    .ucb-sc__item.is-busy .ucb-sc__remove-spin {
        animation: none;
    }

    /* Show the progress bar as a static filled strip instead of a sweep. */
    .ucb-sc__progress::before {
        animation: none;
        left: 0;
        width: 100%;
    }

    .ucb-sc__panel,
    .ucb-sc__overlay,
    .ucb-sc-fab,
    .ucb-sc__close {
        transition-duration: 0.01s;
    }
}
