/* Ride page (design system v5): header, stat bar, detail cards and the data-quality strip.
   Loaded last; the legacy rules in visualize.css it overrides are only reachable here. */
/* ---- head ---- */
.ride-head { margin-bottom: 1.5rem; }
.ride-head__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; margin-top: .9rem; }
body[data-wd-page] .ride-head .session-info { flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.ride-title-row { display: flex; align-items: center; gap: .6rem; }
.ride-title-row .v5-title { margin: 0; }
.ride-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; margin-top: .75rem; color: var(--wd-muted); font-size: .875rem; }
.ride-meta__item { display: inline-flex; gap: .4rem; }
.ride-meta__label { margin-right: .4rem; font: 400 .625rem var(--wd-font-mono); letter-spacing: .1em; text-transform: uppercase; align-self: center; }
.ride-meta__rider { color: var(--wd-blue); font-weight: 500; text-decoration: none; }
.ride-meta__rider:hover { text-decoration: underline; }
.ride-meta__date { font: 400 .8125rem var(--wd-font-mono); }
.ride-chip { padding: .18rem .5rem; border-radius: 4px; background: rgba(159, 180, 204, .12); color: var(--wd-steel); font: 500 .625rem var(--wd-font-mono); letter-spacing: .08em; text-transform: uppercase; }
.ride-chip--private { background: rgba(255, 59, 48, .12); color: var(--wd-red-hot); }
.ride-head .validation-pill { margin: 0; padding: .18rem .5rem; border-radius: 4px; font: 500 .625rem var(--wd-font-mono); letter-spacing: .08em; }
.ride-description { max-width: 70ch; margin: .8rem 0 0; color: #c8ced8; font-size: .9375rem; line-height: 1.5; }
.ride-detail { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .6rem; color: var(--wd-muted); font: 400 .6875rem var(--wd-font-mono); }
.ride-detail .validation-detail { margin: 0; }

.ride-actions { display: flex; flex: none; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .6rem; }
.ride-actions .header-controls { display: flex; flex-wrap: wrap; gap: .6rem; }
.ride-actions :is(.share-btn, .export-btn, .privacy-btn, .delete-btn) { min-height: 40px; padding: .5rem 1.1rem; border: 1px solid var(--wd-border-control); border-radius: var(--wd-radius-pill); background: var(--wd-surface-raised); color: var(--wd-text); font: 500 .875rem/1 var(--wd-font); letter-spacing: 0; text-transform: none; box-shadow: none; transform: none; gap: .4rem; }
.ride-actions :is(.export-btn, .privacy-btn, .delete-btn) { display: inline-flex; align-items: center; }
.ride-actions :is(.export-btn, .privacy-btn):hover { border-color: rgba(239, 68, 68, .5); background: var(--wd-surface-raised); color: var(--wd-text); box-shadow: none; }
.ride-actions .share-btn { border-color: var(--wd-red); background: var(--wd-red); color: #fff; }
.ride-actions .share-btn:hover { background: var(--wd-red-hot); border-color: var(--wd-red-hot); box-shadow: none; color: #fff; }
.ride-actions .delete-btn { border-color: rgba(255, 59, 48, .6); background: transparent; color: var(--wd-red-hot); }
.ride-actions .delete-btn:hover { background: rgba(255, 59, 48, .1); box-shadow: none; }
.ride-actions .privacy-btn.public { border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .08); color: var(--wd-green); }

/* ---- stat bar ---- */
.ride-stats { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); margin: 0 0 1.5rem; padding: 1.25rem 0; border: 1px solid var(--wd-border); border-radius: var(--wd-radius); background: var(--wd-surface); }
.ride-stats .ride-stat { padding: .25rem 1.25rem; border-left: 1px solid var(--wd-border); }
.ride-stats .ride-stat:first-child { border-left: 0; }
.ride-stat__label { color: var(--wd-muted); font: 400 .625rem var(--wd-font-mono); letter-spacing: .1em; text-transform: uppercase; }
.ride-stat__value { display: flex; align-items: baseline; gap: .35rem; margin-top: .6rem; color: var(--wd-text); font: 500 1.75rem/1 var(--wd-font-mono); letter-spacing: -.02em; white-space: nowrap; }
.ride-stat__value small { color: var(--wd-muted); font: 400 .6875rem var(--wd-font-mono); letter-spacing: 0; }
.ride-stat--top .ride-stat__value { font-size: 2.125rem; font-weight: 700; }
.ride-stats .ride-stat.is-caution .ride-stat__value { color: var(--wd-caution); }
.ride-stats .ride-stat.is-danger .ride-stat__value { color: var(--wd-danger); }

/* ---- detail cards ---- */
.ride-card { padding: 1.25rem 1.5rem; border: 1px solid var(--wd-border); border-radius: var(--wd-radius); background: var(--wd-surface); }
.ride-card .v5-section-title { margin-bottom: .6rem; }
/* The bar keeps each panel's colour code: safety red (the default), performance steel, energy amber. */
.ride-card--performance .v5-section-title::before { background: var(--wd-steel); }
.ride-card--energy .v5-section-title::before { background: var(--wd-caution); }
.ride-card__rows { margin: 0; }
.ride-card__row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--wd-border); }
.ride-card__row:first-child { border-top: 0; }
.ride-card__row dt { color: var(--wd-text); font-size: .875rem; }
.ride-card__row dd { display: flex; align-items: baseline; gap: .3rem; margin: 0; color: var(--wd-text); font: 500 1.125rem var(--wd-font-mono); }
.ride-card__row dd small { color: var(--wd-muted); font: 400 .6875rem var(--wd-font-mono); }
.ride-card__row.is-caution dd { color: var(--wd-caution); }
.ride-card__row.is-danger dd { color: var(--wd-danger); }
.enhanced-stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; align-items: start; margin: 0 0 1.5rem; }

/* ---- data-quality strip ---- */
.data-quality-panel { display: flex; align-items: center; gap: 1.5rem 2rem; margin: 0 0 1.5rem; padding: 1rem 1.5rem; border: 1px solid var(--wd-border); border-radius: var(--wd-radius); background: var(--wd-surface); box-shadow: none; }
.data-quality-header { flex: none; display: block; margin: 0; }
.data-quality-title { color: var(--wd-muted); font: 400 .625rem var(--wd-font-mono); letter-spacing: .15em; }
.data-quality-score { margin-top: .35rem; color: var(--wd-green); font: 500 .75rem var(--wd-font-mono); letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.data-quality-grid { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; }
.quality-item { min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; }
.quality-label { margin-bottom: .3rem; color: var(--wd-muted); font: 400 .625rem var(--wd-font-mono); letter-spacing: .1em; }
.quality-value { color: var(--wd-text); font-size: .875rem; font-weight: 500; }
.quality-detail { margin-top: .2rem; color: var(--wd-muted); font-size: .75rem; }

@media (max-width: 1180px) {
    .ride-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 1.25rem; }
    .ride-stats .ride-stat:nth-child(5) { border-left: 0; }
    .enhanced-stats-grid { grid-template-columns: 1fr; }
    .data-quality-panel { flex-direction: column; align-items: stretch; }
}
@media (max-width: 760px) {
    .ride-head__row { flex-direction: column; gap: 1rem; }
    .ride-actions { justify-content: flex-start; }
    .ride-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ride-stats .ride-stat:nth-child(odd) { border-left: 0; }
    .data-quality-grid { grid-template-columns: 1fr 1fr; }
}
.data-quality-panel { align-items: flex-start; }
.data-quality-header { width: 12rem; }
.debug-toggle { border: 1px solid var(--wd-border-control); border-radius: var(--wd-radius-pill); background: var(--wd-surface-raised); color: var(--wd-muted); font: 500 .8125rem var(--wd-font); }
.debug-toggle:hover { border-color: rgba(239, 68, 68, .5); color: var(--wd-text); }

/* app-ui.css restyles .share-btn on the "sessions" page key, which the owner view uses. */
body[data-wd-page] .ride-actions .share-btn { border-color: var(--wd-red); border-radius: var(--wd-radius-pill); background: var(--wd-red); color: #fff; min-width: 0; min-height: 40px; padding: .5rem 1.1rem; font-size: .875rem; }
body[data-wd-page] .ride-actions .share-btn:hover { border-color: var(--wd-red-hot); background: var(--wd-red-hot); color: #fff; }
.zone-create-btn { border: 1px solid var(--wd-border-control); border-radius: var(--wd-radius-pill); background: var(--wd-surface-raised); color: var(--wd-text); font: 500 .8125rem var(--wd-font); box-shadow: none; }
.zone-create-btn:hover { border-color: rgba(239, 68, 68, .5); background: var(--wd-surface-raised); color: var(--wd-text); box-shadow: none; }
.zone-create-btn.active { border-color: var(--wd-red); background: var(--wd-red); color: #fff; }
@media (max-width: 760px) {
    .wdv-toolbar .wd-seg, .wdv-toolbar-right .wd-seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
    .wdv-toolbar-right { max-width: 100%; }
}
/* The page sets display:block on the panel from script, so lay the strip out with a float
   rather than relying on the panel's own display. */
.data-quality-panel::after { content: ''; display: block; clear: both; }
.data-quality-header { float: left; width: 12rem; }
.data-quality-grid { margin-left: 14rem; }
@media (max-width: 1180px) { .data-quality-header { float: none; width: auto; margin-bottom: 1rem; } .data-quality-grid { margin-left: 0; } }

.ride-actions .discover-btn { min-height: 40px; padding: .5rem 1.1rem; border: 1px solid var(--wd-border-control); border-radius: var(--wd-radius-pill); background: var(--wd-surface-raised); color: var(--wd-text); font: 500 .875rem/1 var(--wd-font); cursor: pointer; }
.ride-actions .discover-btn:hover { border-color: rgba(239, 68, 68, .5); }
.ride-actions .discover-btn[hidden] { display: none; }
.ride-actions .discover-btn .btn-text { font-size: .875rem; line-height: 1; }
/* Where a new privacy zone is being placed on the map. */
.temp-zone-marker span { display: block; width: 14px; height: 14px; margin: 3px; border: 2px solid var(--wd-text); border-radius: 50%; background: var(--wd-red); box-shadow: 0 0 0 4px rgba(239, 68, 68, .25); }
/* Privacy zones on the ride map: popup and legend, in the map chrome's style. */
.zone-popup { text-align: center; }
.zone-popup__note { color: var(--wd-muted); }
.privacy-legend { padding: .5rem .75rem; border: 1px solid var(--wd-border); border-radius: var(--wd-radius-control); background: rgba(14, 19, 26, .92); color: var(--wd-text); font-size: .75rem; }
.privacy-legend__title { display: flex; align-items: center; gap: .4rem; margin-bottom: .2rem; }
.privacy-legend__swatch { flex: none; width: 14px; height: 14px; border: 2px dashed var(--wd-red); background: rgba(239, 68, 68, .3); }
.privacy-legend small { color: var(--wd-muted); }

/* Visibility panel (board v5, owner only): the three states as radio cards, then the public
   description and the button that makes the change. */
.visibility-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem 2rem; margin-top: 1.25rem; padding: 1.5rem; border: 1px solid var(--wd-border); border-radius: var(--wd-radius); background: var(--wd-surface); }
.visibility-panel[hidden] { display: none; }
.visibility-panel .v5-label { display: block; margin-bottom: .8rem; }
.visibility-panel__side { display: flex; flex-direction: column; }
.visibility-panel textarea { flex: 1; min-height: 7rem; padding: .8rem .9rem; resize: vertical; }
.visibility-panel textarea:disabled { opacity: .7; }
.visibility-panel__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .9rem; }
.visibility-panel__foot small { color: var(--wd-muted); font-size: .8125rem; }
@media (max-width: 860px) { .visibility-panel { grid-template-columns: 1fr; } }
