/* Upcoming Races v3.0 */

.ucr-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/*
 * Desktop: ucr-wrap clips, ucr-grid scrolls horizontally (fixed 300px cards)
 * Mobile:  ucr-wrap clips (overflow:hidden), ucr-grid scrolls, each card = 100% width — nothing leaks out
 */

/* ── Clip layer ── */
.ucr-wrap {
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* ── Scroll layer — desktop ── */
.ucr-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #d0d5e8 transparent;
    width: 100%;
    box-sizing: border-box;
}
.ucr-grid::-webkit-scrollbar { height: 5px; }
.ucr-grid::-webkit-scrollbar-track { background: transparent; }
.ucr-grid::-webkit-scrollbar-thumb { background: #d0d5e8; border-radius: 4px; }

/* ── Card — desktop fixed width ── */
.ucr-card {
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 14px rgba(0,0,0,0.10);
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
}

/* ── Card Header ── */
.ucr-card-header {
    background: #415A78;
    padding: 12px 14px 10px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}
.ucr-card-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

/* Race type icon */
.ucr-type-icon {
    width: 34px; height: 34px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: #fff;
}
.ucr-type-icon svg { width: 22px; height: 22px; }
.ucr-type-th { background: rgba(255,255,255,0.15); }
.ucr-type-hs { background: rgba(255,255,255,0.15); }
.ucr-type-do { background: rgba(255,255,255,0.15); }

.ucr-header-info { flex: 1; min-width: 0; }
.ucr-race-label {
    font-size: 14px; font-weight: 700; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ucr-track-label {
    font-size: 11px; color: rgba(255,255,255,0.7);
    margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Header right */
.ucr-card-header-right {
    display: flex; flex-direction: column;
    align-items: flex-end; gap: 5px; flex-shrink: 0;
}
.ucr-time-chip {
    background: rgba(255,255,255,0.18);
    color: #fff; font-size: 13px; font-weight: 800;
    border-radius: 6px; padding: 3px 9px;
    font-variant-numeric: tabular-nums;
}
.ucr-time-chip.ucr-chip-urgent {
    background: #e74c3c;
    animation: ucr-pulse 1s ease-in-out infinite;
}
.ucr-country-row {
    display: flex; align-items: center; gap: 5px;
}
.ucr-country-name {
    font-size: 11px; font-weight: 600;
    color: rgba(255,255,255,0.8);
}
.ucr-live-dot {
    width: 7px; height: 7px;
    background: #2ecc71; border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(46,204,113,0.3);
    animation: ucr-livepulse 2s ease-in-out infinite;
}

/* ── Column headings ── */
.ucr-col-headings {
    display: flex;
    justify-content: space-between;
    padding: 6px 14px 4px;
    font-size: 10px;
    font-weight: 700;
    color: #aab2c8;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border-bottom: 1px solid #f0f2f8;
    background: #fafbfd;
}

/* ── Runners ── */
.ucr-runners { display: flex; flex-direction: column; }

.ucr-runner-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    gap: 10px;
    border-bottom: 1px solid #f2f4f8;
    background: #fff;
    transition: background 0.1s;
}
.ucr-runner-row:last-child { border-bottom: none; }
.ucr-runner-row:hover { background: #fafbfd; }

/* Fav row highlight */
/* .ucr-runner-fav-row { background: #729370; } */
/* .ucr-runner-fav-row:hover { background: #729370; } */

.ucr-runner-left {
    display: flex; align-items: center;
    gap: 10px; flex: 1; min-width: 0;
}

/* Silk */
.ucr-silk-wrap {
    position: relative; flex-shrink: 0;
    width: 36px; height: 36px;
}
.ucr-silk-img {
    width: 36px; height: 36px;
    border-radius: 7px; object-fit: contain; display: block;
}
.ucr-silk-fb {
    width: 36px; height: 36px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; color: #fff;
}
.ucr-runner-num-badge {
    position: absolute; bottom: -5px; left: 50%;
    transform: translateX(-50%);
    background: #fff; color: #111e40;
    font-size: 9px; font-weight: 800;
    border-radius: 3px; padding: 1px 3px;
    border: 1px solid #e0e4ef; line-height: 1.3;
    min-width: 14px; text-align: center;
}

/* Runner info */
.ucr-runner-info { flex: 1; min-width: 0; }
.ucr-runner-name {
    font-size: 13px; font-weight: 700; color: #111e40;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center; gap: 5px;
}
.ucr-fav-badge {
    font-size: 10px; font-weight: 800;
    /* background: #fff3cd;  */
    color: #729370;
    border: 1px solid #729370;
    border-radius: 4px; padding: 1px 5px;
    white-space: nowrap; flex-shrink: 0;
}
.ucr-runner-meta {
    font-size: 11px; color: #6b7c99;
    margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ucr-placeholder-text { color: #c8cdd9; }

/* ── Win Odds ── */
.ucr-odds {
    min-width: 46px;
    text-align: center;
    font-size: 14px;
    font-weight: 800;
    color: #111e40;
    background: #f0f2f8;
    border-radius: 7px;
    padding: 5px 8px;
    flex-shrink: 0;
}
.ucr-odds-fav {
    background: #729370;
    color: #111e40;
}
.ucr-odds-na {
    color: #aab2c8;
    font-weight: 600;
}

/* ── FO / TO odds group (each column only renders if the race has data for it) ── */
.ucr-odds-group {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.ucr-odds-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 46px;
}
.ucr-odds-col-label {
    font-size: 8px;
    font-weight: 800;
    color: #aab2c8;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

/* ── Loading / Empty / Error ── */
.ucr-loading {
    display: flex; align-items: center; gap: 10px;
    padding: 32px 18px; color: #8a9bbf; font-size: 13px;
}
.ucr-spinner {
    width: 18px; height: 18px;
    border: 2px solid #e0e4ef; border-top-color: #415A78;
    border-radius: 50%; animation: ucr-spin 0.7s linear infinite;
}
.ucr-empty { padding: 24px 16px; color: #8a9bbf; font-size: 13px; }
.ucr-err   { color: #e74c3c; font-size: 12px; padding: 12px 0; }

/* ── Animations ── */
@keyframes ucr-pulse {
    0%,100% { opacity:1; } 50% { opacity:0.5; }
}
@keyframes ucr-livepulse {
    0%,100% { box-shadow: 0 0 0 2px rgba(46,204,113,0.3); }
    50%      { box-shadow: 0 0 0 6px rgba(46,204,113,0.0); }
}
@keyframes ucr-spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */

/* Tablet: slightly smaller fixed cards */
@media (max-width: 900px) {
    .ucr-card { flex: 0 0 270px; }
}

/* Mobile: snap carousel — 1 card at a time, no overflow */
@media (max-width: 600px) {
    .ucr-wrap {
        overflow: hidden;   /* hard clip — nothing escapes */
        width: 100%;
        box-sizing: border-box;
    }

    .ucr-grid {
        gap: 0;
        padding-bottom: 0;
        overflow-x: scroll;              /* scroll lives here, inside clip  */
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -ms-overflow-style: none;
        width: 100%;
        box-sizing: border-box;
    }
    .ucr-grid::-webkit-scrollbar { display: none; }

    /* Card = exactly the visible container width — never bleeds */
    .ucr-card {
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        scroll-snap-align: start;
        box-sizing: border-box;
        border-radius: 14px;
    }
}
