/* RideUS Web -- per-page layout rules that build on base.css + components.css */

/* --- Home hero --- */
.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--space-xl);
  align-items: center;
  /* Sept 2026 audit fix: was `padding: var(--space-xl) 0 var(--space-xxl)` --
     that 3-value shorthand explicitly zeroes left/right padding, which wins
     over .container's `padding: 0 var(--space-lg)` (same specificity, later
     in the cascade) and left every phone-width visitor with hero text
     flush against the screen edge. Using top/bottom longhands only means
     this rule never touches horizontal padding at all. */
  padding-top: var(--space-xl); padding-bottom: var(--space-xxl);
}
.hero-media {
  border-radius: var(--radius-xl); overflow: hidden; aspect-ratio: 4/3;
  background: linear-gradient(135deg, rgba(var(--color-primary-rgb),.35), rgba(var(--color-secondary-rgb),.35)), var(--color-surface-raised);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-primary);
}
.hero-media svg { width: 96px; height: 96px; }
@media (max-width: 860px) { .hero-media svg { width: 76px; height: 76px; } }
/* Home hero photo slideshow -- replaces the placeholder car icon with a
   crossfading rotation of real carpool photos. Sits on the same
   .hero-media box (gradient background shows through briefly during the
   very first crossfade, and as a fallback if an image fails to load) so
   none of .hero-media's sizing/radius/responsive rules above need to
   change. position:relative here is what lets the slides stack via
   position:absolute below instead of flowing in flex layout. */
.hero-slideshow { position: relative; }
.hero-slide {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity 1.2s ease;
}
.hero-slide.is-active { opacity: 1; }
/* Respect a visitor's reduced-motion preference by just showing the first
   photo, no crossfade -- same "don't animate at someone who asked not to
   be animated at" reasoning as any other transition on this site. */
@media (prefers-reduced-motion: reduce) {
  .hero-slide { transition: none; }
}
.hero h1 { font-size: 44px; line-height: 1.1; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-media { order: -1; aspect-ratio: 16/9; }
  .hero h1 { font-size: 32px; }
}

/* Blue ring around the home page's hero search bar -- it's the single
   most important control on the page (every other CTA on the homepage
   ultimately routes through it), so it gets a permanent ring rather than
   only a plain :focus-within one, to draw the eye there on first paint
   instead of waiting for interaction. (Sept 2026 follow-up: dropped the
   pulsing blur glow this originally had -- just the flat ring now.) */
#home-search-form {
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), .55);
}

/* Same blue ring, applied to the Find a Ride and Bus & Rail page search
   bars -- these are each page's single primary control (same reasoning as
   the home hero ring above), so they get the identical permanent ring
   rather than introducing a different treatment. */
#search-form,
#bus-search-form {
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), .55);
}

/* Sticks the home search bar directly under .site-header (72px tall, see
   components.css) once the hero scrolls past it, same behavior as
   BlaBlaCar's homepage search bar. z-index sits below the header's (40) so
   the header always stays on top, and above ordinary page content. The
   solid background + bottom border keep it looking like a fixed bar rather
   than a floating pill with page content showing through around it.

   Sticky is desktop/tablet only (>860px), matching the breakpoint where
   .searchbar itself switches from a horizontal pill to a stacked column
   (see the .searchbar media query above). Below that width the stacked bar
   is ~330px tall, and a sticky element that tall can't stay pinned near the
   bottom of a long page -- position:sticky is bounded by its containing
   block (<main>), so once <main>'s remaining height gets shorter than the
   bar itself, the browser pushes the bar up and off-screen instead of
   holding it in place. Simplest correct fix: only stick it where it's
   short enough to actually work, and let it scroll normally on mobile. */
.search-sticky-bar {
  background: var(--color-bg);
  padding: var(--space-md) 0;
  margin-bottom: var(--space-xxl);
  border-bottom: 1px solid var(--color-border);
}
@media (min-width: 861px) {
  .search-sticky-bar {
    /* 73px, not 72px -- .site-header's own height is 72px content-box plus
       its 1px border-bottom, so 73px is where the header's box actually ends. */
    position: sticky; top: 73px; z-index: 30;
  }
}

/* --- Popular routes (home page, above the footer) --- */
/* Sept 2026 audit fix: same shorthand-zeroes-horizontal-padding bug as
   .hero above -- this is also combined directly with .container on one
   element (`<section class="container routes-section">`), so it was
   wiping out .container's side padding here too. */
.routes-section { padding-top: var(--space-xl); padding-bottom: var(--space-xxl); border-top: 1px solid var(--color-border); }
.routes-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-xl); margin-top: var(--space-lg); }
.routes-col h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--color-text-secondary); margin-bottom: var(--space-md);
}
.routes-col a {
  display: flex; align-items: center; gap: 8px;
  color: var(--color-text-secondary); padding: 7px 0; font-size: 14px;
}
.routes-col a:hover { color: var(--color-text-primary); }
.routes-col a .arrow { color: var(--color-text-tertiary); }
.routes-col a.more-link { color: var(--color-primary); font-weight: 600; margin-top: 4px; }
@media (max-width: 860px) { .routes-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); } }
@media (max-width: 480px) { .routes-grid { grid-template-columns: 1fr; } }

.value-props { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.value-prop-icon {
  width: 48px; height: 48px; border-radius: var(--radius-md);
  /* Tinted-primary treatment, matching .travel-tile-icon's language, so the
     whole page reads as one consistent icon system instead of a plain gray
     box (previously just held a raw emoji glyph). */
  background: rgba(var(--color-primary-rgb), .14); color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--space-sm);
}
@media (max-width: 700px) { .value-props { grid-template-columns: 1fr; } }

.travel-band { background: var(--color-surface); border-radius: var(--radius-xl); padding: var(--space-xl); }

/* --- Auth pages (sign up / log in) --- */
.auth-shell { min-height: calc(100vh - 72px); display: flex; align-items: center; justify-content: center; padding: var(--space-xl) var(--space-md); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 26px; }
.otp-inputs { display: flex; gap: 10px; justify-content: center; margin: var(--space-md) 0; }
.otp-inputs input {
  width: 44px; height: 52px; text-align: center; font-size: 22px; font-weight: 700;
  background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  color: var(--color-text-primary);
}
.otp-inputs input:focus { outline: none; border-color: var(--color-primary); }
.phone-field { display: flex; gap: 8px; }
.phone-field select { flex: 0 0 110px; }
.phone-field input { flex: 1; }
#recaptcha-container { display: flex; justify-content: center; margin: var(--space-sm) 0; }
.auth-switch { text-align: center; margin-top: var(--space-md); color: var(--color-text-secondary); font-size: 14px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--color-text-secondary); }
.checkbox-row input { margin-top: 3px; }

/* --- Search results / listing cards --- */
.filters-bar { display: flex; gap: var(--space-sm); flex-wrap: wrap; margin-bottom: var(--space-lg); }
.trip-card { display: flex; gap: var(--space-lg); padding: var(--space-lg); }
.trip-route { flex: 1; }
.trip-route .stop { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.trip-route .stop-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); flex-shrink: 0; }
.trip-route .stop-line { width: 8px; display: flex; justify-content: center; }
.trip-route .stop-line span { width: 2px; height: 22px; background: var(--color-border); }
.trip-meta { display: flex; align-items: center; gap: var(--space-md); flex-wrap: wrap; margin-top: 8px; }
.trip-price { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 120px; }
.trip-price .amount { font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--color-primary); }
@media (max-width: 640px) { .trip-card { flex-direction: column; } .trip-price { align-items: flex-start; flex-direction: row; justify-content: space-between; width: 100%; } }

/* --- Trip details / booking --- */
.trip-detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--space-xl); align-items: start; }
@media (max-width: 900px) { .trip-detail-grid { grid-template-columns: 1fr; } }
.driver-card { display: flex; gap: var(--space-md); align-items: center; }
.driver-card .avatar { width: 56px; height: 56px; font-size: 20px; }
.booking-summary { position: sticky; top: 88px; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--color-border); background: var(--color-surface-raised); font-size: 18px; cursor: pointer; }

/* --- Offer a ride form --- */
.offer-form { max-width: 640px; margin: 0 auto; }
.offer-section { margin-bottom: var(--space-xl); }
.chip-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius-full); border: 1px solid var(--color-border); cursor: pointer; }
.chip-toggle input { accent-color: var(--color-primary); }

/* --- Account dashboard --- */
/* Sept 2026 audit fix: a bare `1fr` grid track still sizes to its content's
   min-content width, not the track's available space -- the tabbar's row of
   six buttons (via .tabbar below) doesn't wrap, so its min-content is wider
   than a 360px phone screen, which forced this whole track (and the page)
   to overflow horizontally instead of letting .tabbar's own
   `overflow-x: auto` take over. `minmax(0, 1fr)` is the standard fix: it
   caps the track at the *available* space, so content wider than that has
   to scroll within the track instead of stretching it. */
.account-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--space-xl); align-items: start; }
@media (max-width: 800px) { .account-grid { grid-template-columns: minmax(0, 1fr); } }
.account-side .avatar { width: 72px; height: 72px; font-size: 24px; margin-bottom: var(--space-sm); }
/* Sept 2026 audit fix: added flex-wrap -- a label span and a trailing
   action/badge span (Accept/Decline, Make default/Remove, a status badge +
   timestamp, ...) could together exceed a narrow phone's width with no way
   to shrink, forcing the whole row (and the page) to scroll sideways. Same
   bug class as trip.js's badges row / the .bus-card .row fix below --
   wrapping just drops the trailing group to its own line instead. */
.list-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-sm); padding: var(--space-md) 0; border-bottom: 1px solid var(--color-border); }
.list-row:last-child { border-bottom: none; }

/* --- Messages --- */
.messages-grid { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 72px - 1px); }
@media (max-width: 780px) { .messages-grid { grid-template-columns: 1fr; height: auto; } }
.conv-list { border-right: 1px solid var(--color-border); overflow-y: auto; }
.conv-item { display: flex; gap: 10px; padding: 14px var(--space-md); border-bottom: 1px solid var(--color-border); cursor: pointer; }
.conv-item:hover, .conv-item.active { background: var(--color-surface-raised); }
.conv-item .preview { color: var(--color-text-secondary); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-pane { display: flex; flex-direction: column; height: 100%; }
.thread-pane[hidden] { display: none; }
.thread-messages { flex: 1; overflow-y: auto; padding: var(--space-lg); display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 70%; padding: 10px 14px; border-radius: var(--radius-lg); font-size: 14px; }
.bubble-mine { align-self: flex-end; background: var(--color-primary); color: #fff; border-bottom-right-radius: 4px; }
.bubble-theirs { align-self: flex-start; background: var(--color-surface-raised); border: 1px solid var(--color-border); border-bottom-left-radius: 4px; }
.thread-composer { display: flex; gap: 8px; padding: var(--space-md); border-top: 1px solid var(--color-border); }

/* --- Bus/rail --- */
.bus-card { display: flex; align-items: center; gap: var(--space-lg); padding: var(--space-lg); }
.vendor-badge { width: 48px; height: 48px; border-radius: var(--radius-md); background: var(--color-surface-raised); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; color: var(--color-primary); flex-shrink: 0; }
/* Sept 2026 audit fix: unlike .trip-card, .bus-card never had a mobile
   breakpoint -- the badge, the route/time/seats row (itself a non-wrapping
   .row), and the price+button column were all forced onto one line, which
   overflows a phone-width screen. Below 640px (matching .trip-card's own
   breakpoint), stack the card vertically, let the inner row wrap, and let
   the price/button column lay out full-width like .trip-price does. */
@media (max-width: 640px) {
  .bus-card { flex-direction: column; align-items: stretch; }
  .bus-card .row { flex-wrap: wrap; }
  .bus-card .stack { flex-direction: row; align-items: center; justify-content: space-between; width: 100%; }
}

/* --- About / community --- */
.testimonial { padding: var(--space-lg); }
.testimonial .stars { color: var(--color-secondary); letter-spacing: 2px; }
