/* Ride results pages (online and offline). Loaded on both, on every ride. */

/* Member and horse suggestion lists: dark text on white (the theme left them white on white). */
.ui-autocomplete.ui-menu,
.ui-autocomplete .ui-menu-item,
.ui-autocomplete .ui-menu-item-wrapper {
    background: #fff;
    color: #1f2328;
}
.ui-autocomplete .ui-menu-item-wrapper.ui-state-active,
.ui-autocomplete .ui-menu-item-wrapper:hover {
    background: #e8f0fb;
    color: #0b2545;
    border-color: transparent;
}
.ui-autocomplete {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #c9d1d9;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
    z-index: 1000;
}

/* ---- Intro roster (rides with Intro distances, 2027 season on) ---- */

.ir {
    --ir-ink: #1f2328;
    --ir-soft: #57606a;
    --ir-line: #d0d7de;
    --ir-bg: #fff;
    --ir-tint: #f6f8fa;
    --ir-brand: #0b5cad;
    --ir-brand-ink: #fff;
    --ir-ok: #1a7f37;
    --ir-ok-bg: #dafbe1;
    --ir-warn: #9a6700;
    --ir-warn-bg: #fff8c5;
    --ir-bad: #cf222e;
    --ir-bad-bg: #ffebe9;
    margin: 28px 0;
    padding: 24px;
    border: 1px solid var(--ir-line);
    border-radius: 14px;
    background: var(--ir-bg);
    color: var(--ir-ink);
    font-size: 16px;
    line-height: 1.45;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
    scroll-margin-top: 90px;
}
.ir *, .ir *::before, .ir *::after { box-sizing: border-box; }
.ir button, .ir input, .ir select { font: inherit; color: inherit; }

.ir-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px 24px;
    margin-bottom: 18px;
}
.ir-title { flex: 1 1 380px; }
.ir-title h3 {
    margin: 0 0 4px;
    font-size: 24px;
    line-height: 1.2;
    color: var(--ir-ink);
}
.ir-lede { margin: 0; color: var(--ir-soft); max-width: 62ch; }
.ir-lede strong { color: var(--ir-ink); }

.ir-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ir-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--ir-tint);
    border: 1px solid var(--ir-line);
    font-size: 14px;
    white-space: nowrap;
}
.ir-chip strong { font-size: 16px; }
.ir-chip--fee { background: #eaf2fb; border-color: #b6cfee; }
.ir-chip small { color: var(--ir-soft); font-size: 12px; }

/* distance tabs */
.ir-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 14px;
    scrollbar-width: thin;
}
.ir-tab {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: auto auto;
    grid-template-rows: auto auto;
    column-gap: 12px;
    align-items: center;
    min-height: 56px;
    padding: 8px 14px;
    border: 1px solid var(--ir-line);
    border-radius: 10px;
    background: var(--ir-bg);
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.ir-tab:hover { border-color: #8c959f; }
.ir-tab:focus-visible { outline: 3px solid #80b3ff; outline-offset: 2px; }
.ir-tab.is-on {
    border-color: var(--ir-brand);
    background: #eaf2fb;
    box-shadow: inset 0 0 0 1px var(--ir-brand);
}
.ir-tab-mi { font-weight: 700; font-size: 17px; }
.ir-tab-meta { grid-column: 1; font-size: 13px; color: var(--ir-soft); }
.ir-tab-n {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--ir-tint);
    border: 1px solid var(--ir-line);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}
.ir-tab.is-on .ir-tab-n { background: var(--ir-brand); border-color: var(--ir-brand); color: var(--ir-brand-ink); }

.ir-note {
    margin: 0 0 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--ir-tint);
    border: 1px solid var(--ir-line);
    font-size: 15px;
}
.ir-note--warn { background: var(--ir-warn-bg); border-color: #e3c867; color: #4d3800; }

/* rider cards */
.ir-list { display: grid; gap: 10px; }
.ir-blank, .ir-empty {
    padding: 22px;
    border: 1px dashed var(--ir-line);
    border-radius: 10px;
    text-align: center;
    color: var(--ir-soft);
}
.ir-blank p { margin: 0; }
.ir-blank p + p { margin-top: 4px; }
.ir-blank strong { color: var(--ir-ink); }
.ir-empty--error { border-style: solid; border-color: #ffc1c0; background: var(--ir-bad-bg); color: #82071e; }

.ir-card {
    position: relative;
    display: grid;
    grid-template-columns: 32px 1fr 40px;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--ir-line);
    border-radius: 12px;
    background: var(--ir-bg);
    animation: ir-in .18s ease-out;
}
.ir-card.has-error { border-color: var(--ir-bad); box-shadow: 0 0 0 1px var(--ir-bad); }
@keyframes ir-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ir-card { animation: none; } .ir-spin { animation: none !important; } }

.ir-num {
    width: 32px;
    height: 32px;
    margin-top: 22px;
    border-radius: 50%;
    background: var(--ir-tint);
    border: 1px solid var(--ir-line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--ir-soft);
}
.ir-body {
    display: grid;
    grid-template-columns: minmax(240px, 1.5fr) minmax(180px, 1fr) minmax(250px, auto);
    gap: 12px 16px;
    min-width: 0;
}
.ir-field { min-width: 0; }
.ir-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ir-soft);
    text-transform: none;
}
.ir-opt { font-weight: 400; }

.ir-input, .ir-pull {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #afb8c1;
    border-radius: 8px;
    background: #fff;
    color: var(--ir-ink);
    box-shadow: none;
    margin: 0;
}
.ir-input::placeholder { color: #6e7781; opacity: 1; }
.ir-input:focus, .ir-pull:focus, .ir-done:focus-visible, .ir-add:focus-visible,
.ir-remove:focus-visible, .ir-link:focus-visible {
    outline: 3px solid #80b3ff;
    outline-offset: 1px;
    border-color: var(--ir-brand);
}
.ir-input[disabled], .ir-pull[disabled], .ir-done[disabled] { background: var(--ir-tint); cursor: not-allowed; }

/* name above email, each the full rider column, so a long name or address is never cut off */
.ir-guest { display: grid; grid-template-columns: 1fr; gap: 8px; }

.ir-picked {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    min-height: 44px;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--ir-tint);
    border: 1px solid var(--ir-line);
}
.ir-picked-name { font-weight: 600; }

.ir-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    background: #ddf4ff;
    color: #0a3069;
    white-space: nowrap;
}
.ir-badge--ok { background: var(--ir-ok-bg); color: #116329; }
.ir-badge--muted { background: #eaeef2; color: #424a53; }

.ir-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--ir-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    font-size: 14px;
}
.ir-picked .ir-link { margin-left: auto; }
.ir-field--rider > .ir-link { margin-top: 6px; }

/* combobox menu */
.ir-combo { position: relative; }
.ir-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 280px;
    z-index: 50;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid #afb8c1;
    border-radius: 10px;
    background: #fff;
    color: var(--ir-ink);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
}
.ir-menu[hidden] { display: none; }
.ir-opt-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--ir-ink);
}
.ir-opt-row.is-active, .ir-opt-row:hover { background: #e8f0fb; }
.ir-opt-name { font-weight: 600; }
.ir-opt-meta { font-size: 13px; color: var(--ir-soft); }
.ir-opt-guest { border-top: 1px solid var(--ir-line); margin-top: 4px; }
.ir-opt-guest:first-child { border-top: 0; margin-top: 0; }
.ir-opt-guest .ir-opt-name { color: var(--ir-brand); }
.ir-opt-empty { padding: 10px 12px; color: var(--ir-soft); font-size: 14px; }

/* result */
.ir-result { display: flex; gap: 8px; }
.ir-done {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 44px;
    padding: 0 14px;
    border: 1px solid #afb8c1;
    border-radius: 8px;
    background: #fff;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.ir-done.is-on { background: var(--ir-ok); border-color: var(--ir-ok); color: #fff; }
.ir-pull { flex: 1 1 140px; min-width: 0; cursor: pointer; }
.ir-pull.is-on { border-color: var(--ir-bad); background: var(--ir-bad-bg); color: #82071e; font-weight: 600; }

.ir-remove {
    width: 40px;
    height: 40px;
    margin-top: 22px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: none;
    color: var(--ir-soft);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ir-remove:hover { background: var(--ir-bad-bg); color: var(--ir-bad); border-color: #ffc1c0; }

.ir-error {
    grid-column: 2 / -1;
    margin: 0;
    color: var(--ir-bad);
    font-size: 14px;
    font-weight: 600;
}

.ir-undo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #24292f;
    color: #fff;
    font-size: 15px;
}
.ir-undo .ir-link { color: #9ecbff; font-weight: 600; font-size: 15px; }

.ir-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 52px;
    margin-top: 12px;
    border: 2px dashed #8cb4e2;
    border-radius: 12px;
    background: #f3f8fe;
    color: var(--ir-brand);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.ir-add span { font-size: 22px; line-height: 1; }
.ir-add:hover { background: #e4effc; border-color: var(--ir-brand); }

/* save status */
.ir-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 14px -24px -24px;
    padding: 12px 24px;
    border-top: 1px solid var(--ir-line);
    border-radius: 0 0 14px 14px;
    background: rgba(255, 255, 255, .96);
    font-size: 14px;
    color: var(--ir-soft);
}
.ir-bar[data-state="offline"],
.ir-bar[data-state="attention"] { background: var(--ir-warn-bg); color: #4d3800; }
.ir-bar[data-state="error"] { background: var(--ir-bad-bg); color: #82071e; }
.ir-bar .ir-link { font-size: 14px; }
.ir-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ir-ok); flex: 0 0 auto; }
.ir-dot--busy { background: var(--ir-brand); animation: ir-pulse 1s ease-in-out infinite; }
.ir-dot--warn { background: #bf8700; }
.ir-dot--bad { background: var(--ir-bad); }
@keyframes ir-pulse { 50% { opacity: .35; } }

.ir-spin {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    vertical-align: -3px;
    border: 2px solid var(--ir-line);
    border-top-color: var(--ir-brand);
    border-radius: 50%;
    animation: ir-rot .8s linear infinite;
}
@keyframes ir-rot { to { transform: rotate(360deg); } }

/* the old headcount box, replaced on these rides by the list */
.ir-legacy-hidden { display: none !important; }
.ir-headcount {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    color: #0b5cad;
    font-weight: 600;
    text-decoration: none;
}
.ir-headcount:hover { text-decoration: underline; }

@media (max-width: 1100px) {
    .ir-body { grid-template-columns: 1fr 1fr; }
    .ir-field--result { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
    .ir { padding: 16px; margin: 20px -4px; border-radius: 12px; }
    .ir-bar { margin: 14px -16px -16px; padding: 12px 16px; }
    .ir-title h3 { font-size: 21px; }
    .ir-card { grid-template-columns: 1fr 40px; padding: 12px; }
    .ir-num { display: none; }
    .ir-remove { margin-top: 18px; }
    .ir-body { grid-template-columns: 1fr; grid-column: 1; }
    .ir-guest { grid-template-columns: 1fr; }
    .ir-error { grid-column: 1 / -1; }
    .ir-input, .ir-pull { font-size: 16px; } /* stops iOS zooming on focus */
}
