/* PlayCompete — the checkout form.
   ---------------------------------------------------------------------------
   Shared by all three registration forms: races (layouts/app), leagues
   (layouts/league) and tournaments (layouts/tournament). One card: a tinted
   band naming what is being entered, the entry itself, then a tinted foot
   carrying the total and the buttons.

   LAYOUT ONLY. Not one colour is named below - every rule reads a --co-*
   token, and the block underneath maps those onto whichever palette the host
   page happens to carry:

     - A race sits in layouts/app, which loads pc-theme.css and puts
       .pc-public on the body. That palette is PlayCompete's own.
     - A league or tournament sits in its own layout, which loads pc-site.css
       and sets --pcs-brand and --pcs-accent INLINE ON THE BODY from the
       organizer's saved colours. Their registration page is meant to look
       like their league, not like us, so the mapping has to pick those up
       rather than paint teal over them.

   The fallback chain does that without either stylesheet knowing about this
   one: var(--pc-hero, var(--pcs-soft, #eef5f5)) resolves to PlayCompete's
   tint where pc-theme is loaded, the organizer's where pc-site is, and a
   sane neutral if somebody drops .pc-co onto a page with neither.

   Rows fold shut once they already hold an answer, so somebody who entered
   last year reads a few summary lines instead of re-reading every field. A
   row with anything missing opens on load - see the $pcDone flags in
   events/register.blade.php. That is not only a nicety: a required field
   inside a closed <details> cannot be focused, so the browser refuses to
   submit and shows nothing to explain why. */

.pc-co,
.pc-co-wrap {
    --co-tint:   var(--pc-hero,   var(--pcs-soft,   #eef5f5));
    --co-line:   var(--pc-border, var(--pcs-line,   #d9e3e5));
    --co-ink:    var(--pc-navy,   var(--pcs-brand,  #123b4a));
    --co-text:   var(--pc-text,   var(--pcs-muted,  #4c6068));
    --co-accent: var(--pc-teal,   var(--pcs-accent, #087f83));
    --co-sunk:   var(--pc-bg,     var(--pcs-soft,   #f8fafa));
}

/* pc-site has no "tinted panel" colour of its own, so a league or tournament
   would otherwise get a flat grey band where a race gets a tinted one. Mix
   the organizer's accent down instead, and they get the same band in their
   own colour.

   Guarded rather than written straight in: a browser without color-mix would
   compute the custom property as invalid, and `background: var(--co-tint)`
   would then resolve to transparent - a white band on a white page. The
   probe tests the function, not the property, because a custom property
   accepts any value and would report support for everything. */
@supports (background: color-mix(in srgb, red 10%, white)) {
    .pc-co,
    .pc-co-wrap {
        --co-tint: var(--pc-hero, color-mix(in srgb, var(--pcs-accent, #087f83) 9%, #fff));
    }
}

.pc-co-wrap { max-width: 820px; margin-inline: auto; }

.pc-co {
    background: #fff;
    border: 1px solid var(--co-line);
    border-radius: 14px;
    overflow: hidden;
}

.pc-co-head {
    background: var(--co-tint);
    border-bottom: 1px solid var(--co-line);
    padding: 22px 26px;
}

.pc-co-eyebrow {
    color: var(--co-text);
    font-size: .92rem;
    margin: 0 0 2px;
}

.pc-co-head h1 {
    color: var(--co-ink);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    text-wrap: balance;
}

.pc-co-body { padding: 22px 26px; }

.pc-co-foot {
    background: var(--co-tint);
    border-top: 1px solid var(--co-line);
    padding: 20px 26px;
}

/* A heading inside the card, above a block that is not a foldable row. */
.pc-co-h {
    color: var(--co-ink);
    font-size: 1.02rem;
    font-weight: 700;
    margin: 0 0 12px;
}
.pc-co-sec { border-top: 1px solid var(--co-line); padding: 18px 0 2px; }

/* ── Distance ────────────────────────────────────────────────────────────── */

/* Cards rather than a menu. The price is the thing being chosen between, and a
   <select> shows one price at a time with the rest folded away. */
.pc-dist {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.pc-dist-opt {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--co-line);
    border-radius: 10px;
    cursor: pointer;
}

.pc-dist-opt input {
    flex: none;
    width: 1.05rem;
    height: 1.05rem;
    margin: .15rem 0 0;
    accent-color: var(--co-accent);
}

.pc-dist-text { min-width: 0; }
.pc-dist-name  { display: block; font-weight: 700; color: var(--co-ink); }
.pc-dist-price { display: block; color: var(--co-text); }
.pc-dist-note  { display: block; margin-top: 2px; font-size: .82rem; color: var(--co-text); opacity: .85; }

.pc-dist-flag {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: var(--co-line);
    color: var(--co-ink);
    border-radius: 999px;
}
.pc-dist-flag.is-gone { background: #f4dede; color: #8d3a3a; }

.pc-dist-opt:hover:not(.is-disabled) { border-color: var(--co-accent); }

/* The selected card. The inset ring rather than a 2px border, so picking a
   distance does not shift the other cards by a pixel. */
.pc-dist-opt:has(input:checked) {
    border-color: var(--co-accent);
    background: var(--co-tint);
    box-shadow: inset 0 0 0 1px var(--co-accent);
}
.pc-dist-opt:has(input:focus-visible) {
    outline: 2px solid var(--co-accent);
    outline-offset: 2px;
}

.pc-dist-opt.is-disabled {
    background: var(--co-sunk);
    cursor: not-allowed;
    opacity: .6;
}

/* ── Foldable rows ───────────────────────────────────────────────────────── */

/* The group as a whole. Each row draws its own top rule, so the set only
   needs closing off at the bottom. */
.pc-rows { border-bottom: 1px solid var(--co-line); margin-bottom: 20px; }

.pc-row { border-top: 1px solid var(--co-line); }

/* One checkbox is not worth folding away behind an "Edit" link, so it sits
   as a row in its own right. */
.pc-row-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 14px 0;
    border-top: 1px solid var(--co-line);
}
.pc-row-check .form-check-input { margin: 0; flex: none; accent-color: var(--co-accent); }

.pc-row > summary {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 14px 0;
    cursor: pointer;
    list-style: none;
}
.pc-row > summary::-webkit-details-marker { display: none; }
.pc-row > summary:focus-visible {
    outline: 2px solid var(--co-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.pc-row-main  { flex: 1 1 auto; min-width: 0; }
.pc-row-label { display: block; font-weight: 700; color: var(--co-ink); }
.pc-row-value { display: block; color: var(--co-text); overflow-wrap: anywhere; }

/* Open: the fields below state it better than one summary line can. */
.pc-row[open] .pc-row-value { display: none; }

.pc-row-body { padding: 2px 0 16px; }

/* ── Disclosure triangle ─────────────────────────────────────────────────── */

.pc-tri {
    flex: none;
    color: var(--co-accent);
    white-space: nowrap;
}
.pc-tri::before {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    margin-right: 7px;
    vertical-align: middle;
    border-left: 6px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform .15s ease;
}
details[open] > summary .pc-tri::before { transform: rotate(90deg); }

@media (prefers-reduced-motion: reduce) {
    .pc-tri::before { transition: none; }
}

/* ── Total and actions ───────────────────────────────────────────────────── */

/* PcPrice.render marks its last line .pc-total-line, so the itemisation above
   it stays small and the number people are actually deciding on is large. */
.pc-co-foot .pc-total-line strong {
    font-size: 1.15rem;
    color: var(--co-ink);
}

.pc-coupon > summary {
    list-style: none;
    cursor: pointer;
    padding: 4px 0;
}
.pc-coupon > summary::-webkit-details-marker { display: none; }
.pc-coupon > summary:focus-visible {
    outline: 2px solid var(--co-accent);
    outline-offset: 2px;
    border-radius: 4px;
}
.pc-coupon-body { padding-top: 8px; max-width: 360px; }

.pc-co-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

@media (max-width: 575.98px) {
    .pc-co-head,
    .pc-co-body,
    .pc-co-foot { padding-left: 16px; padding-right: 16px; }

    /* The pair stack rather than squeezing onto one line at 320px. */
    .pc-co-actions .btn { width: 100%; }
}

/* ── Legacy sections ─────────────────────────────────────────────────────── */

/* The parts of a registration form the checkout layout does not restructure -
   extras, a donation, a waiver, the pay-now/pay-later choice - were each
   built as their own Tabler card, several with a tint hard-coded into the
   markup. Inside the one checkout card that reads as a stack of boxes in
   four different colours, none of them the organizer's.

   This flattens such a card into a section of its host: no second border, no
   tint of its own, hairline rule above, flush with the rows either side. The
   class is applied deliberately rather than to every .card inside .pc-co,
   because some of these forms use real cards as selectable options and those
   still have to look like cards. */
.pc-co-card {
    margin: 0;
    background: #fff;
    border: 0;
    border-top: 1px solid var(--co-line);
    border-radius: 0;
}
.pc-co-card > .card-header {
    padding: 18px 0 0;
    background: transparent;
    border-bottom: 0;
    min-height: 0;
}
.pc-co-card > .card-body { padding: 14px 0 18px; }
.pc-co-card .card-title {
    color: var(--co-ink);
    font-size: 1.02rem;
    font-weight: 700;
}
