/* TripStack design system — redBus/MakeMyTrip-style travel marketplace.
   One source of truth for the look; every page links this file. Class names are
   STABLE across v1/v2 (v2's locator-resilience comes from structural changes,
   not class renames). */

:root {
  --brand: #d84e55;          /* redBus red header */
  --brand-2: #c0392f;
  --primary: #d84e55;        /* brand red (links / primary actions) */
  --primary-d: #b83a41;
  --cta: #e63946;            /* bold red call-to-action (Book / Continue) */
  --cta-d: #c92c39;
  --bus: #d84e55;            /* buses ARE the brand */
  --bus-d: #b83a41;
  --flight: #2b5cff;         /* flights get a small blue accent for contrast */
  --amber: #f6a609; --rating: #0e9f6e;  /* redBus green rating pill */
  --ok: #0e9f6e; --warn: #f6a609; --danger: #e02424; --danger-bg: #fdecec;
  --ink: #1a1f36; --muted: #6b7280; --faint: #9aa1ad;
  --bg: #f4f5fb; --surface: #ffffff; --surface-2: #f7f8fc;
  --border: #e6e8f2; --border-2: #d7dae8;
  --radius: 12px; --radius-sm: 8px; --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(24,28,54,.06), 0 6px 20px rgba(24,28,54,.06);
  --shadow-lg: 0 10px 40px rgba(24,28,54,.14);
  --maxw: 1080px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
  font-size: 15.5px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 4px; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 1rem; font-weight: 700; margin: 0 0 8px; }
img { max-width: 100%; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.page { padding: 24px 0 56px; }
.muted { color: var(--muted); }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1 1 auto; }

/* ---- Header / nav ---------------------------------------------------------*/
.site-header {
  background: linear-gradient(100deg, var(--brand), var(--brand-2));
  color: #fff; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 14px rgba(20,16,60,.28);
}
.site-header .container { display: flex; align-items: center; gap: 22px; height: 60px; }
.brand { font-size: 1.35rem; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand .mark { color: #ff8f8f; }
.nav { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.nav a { color: #ffe1e1; padding: 7px 12px; border-radius: 999px; font-weight: 600; font-size: .93rem; }
.nav a:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.16); color: #fff; }
.nav .pill-login { background: #fff; color: var(--brand); }
.nav .pill-login:hover { background: #ffecec; }

/* ---- Footer ---------------------------------------------------------------*/
.site-footer { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); }
.site-footer .container { padding: 22px 20px; display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; font-size: .86rem; }

/* ---- Buttons --------------------------------------------------------------*/
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; cursor: pointer; border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 11px 20px; background: #eceefb; color: var(--ink); }
.btn:hover { text-decoration: none; filter: brightness(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-cta { background: var(--cta); color: #fff; }
.btn-cta:hover { background: var(--cta-d); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-bus { background: var(--bus); color: #fff; }
.btn-bus:hover { background: var(--bus-d); }
.btn-outline { background: #fff; border-color: var(--border-2); color: var(--ink); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger-outline { background: #fff; border-color: #f2c2c2; color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger-bg); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 26px; font-size: 1.02rem; }

/* ---- Cards / panels -------------------------------------------------------*/
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 700; margin: 0 0 8px; }

/* ---- Badges / chips -------------------------------------------------------*/
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; padding: 3px 9px; border-radius: 999px;
  background: #eef0fb; color: var(--brand-2); }
.badge-ok { background: #e5f6ee; color: var(--ok); }
.badge-warn { background: #fdf1d8; color: #a8730a; }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-bus { background: #e3f5ee; color: var(--bus-d); }

/* ---- Forms ----------------------------------------------------------------*/
.field { margin-bottom: 14px; }
.field > label, label.field-label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: #33405c; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=date], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  padding: 11px 12px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(216,78,85,.18); }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row > * { flex: 1 1 200px; }
.form-error, .alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f3c9c9;
  border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; font-weight: 600; }
.form-note { color: var(--muted); font-size: .85rem; }

/* ---- Tables ---------------------------------------------------------------*/
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.table tbody tr:hover { background: var(--surface-2); }

/* ---- Search / hero --------------------------------------------------------*/
.hero { background: linear-gradient(120deg, var(--brand), var(--brand-2) 75%, #8f2630);
  color: #fff; padding: 40px 0 96px; }
.hero h1 { color: #fff; font-size: 2rem; }
.hero p { color: #ffdede; margin: 4px 0 0; }
.search-card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 20px; margin-top: -64px; }
.tabs { display: inline-flex; gap: 6px; background: rgba(255,255,255,.14); padding: 5px; border-radius: 999px; }
.tabs a { color: #ffe1e1; padding: 7px 18px; border-radius: 999px; font-weight: 700; }
.tabs a.active { background: #fff; color: var(--brand); }
.tabs a:hover { text-decoration: none; }

/* ---- Result cards (flight/bus) -------------------------------------------*/
.result-list { display: flex; flex-direction: column; gap: 14px; }
.result { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; }
.result:hover { border-color: var(--border-2); box-shadow: var(--shadow-lg); }
.result .title { font-weight: 800; font-size: 1.05rem; }
.result .meta { color: var(--muted); font-size: .9rem; }
.result .times { font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; }
.result .times .arrow { color: var(--faint); margin: 0 8px; }
.result .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.fare { font-size: 1.35rem; font-weight: 800; color: var(--ink); }
.fare .cur { font-size: .95rem; font-weight: 700; color: var(--muted); }
.result-count { color: var(--muted); margin: 0 0 16px; }
.empty { text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border-2);
  border-radius: var(--radius); padding: 44px 20px; }

/* ---- Stepper --------------------------------------------------------------*/
.steps { display: flex; gap: 8px; align-items: center; list-style: none; padding: 0; margin: 0 0 20px; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 8px; color: var(--faint); font-weight: 600; font-size: .88rem; }
.steps li .dot { width: 22px; height: 22px; border-radius: 999px; background: #e5e7f2; color: var(--faint);
  display: grid; place-items: center; font-size: .78rem; font-weight: 800; }
.steps li.done { color: var(--ok); } .steps li.done .dot { background: var(--ok); color: #fff; }
.steps li.active { color: var(--primary); } .steps li.active .dot { background: var(--primary); color: #fff; }
.steps li + li::before { content: ""; width: 26px; height: 2px; background: #e0e3f0; display: inline-block; }

/* ---- Booking layout (main + summary rail) --------------------------------*/
.booking-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.summary-rail { position: sticky; top: 80px; }
.price-row { display: flex; justify-content: space-between; padding: 5px 0; color: var(--muted); font-size: .92rem; }
.price-row.total { border-top: 1px dashed var(--border-2); margin-top: 6px; padding-top: 10px;
  color: var(--ink); font-weight: 800; font-size: 1.1rem; }
.pnr { font-size: 1.7rem; font-weight: 800; letter-spacing: .04em; color: var(--brand); }
.ticket { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ticket .ticket-head { background: linear-gradient(100deg, var(--ok), #10b981); color: #fff; padding: 18px 20px; }
.ticket .ticket-body { padding: 20px; }

/* ---- Seat maps (cabin grid + bus deck) -----------------------------------*/
.seat-legend { display: flex; gap: 16px; flex-wrap: wrap; list-style: none; margin: 0 0 16px; padding: 0; font-size: .8rem; color: var(--muted); }
.seat-legend li { display: flex; align-items: center; gap: 7px; }
.swatch { width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--border-2); display: inline-block; }
.swatch.available { background: #eaf6ee; border-color: #a9dcbd; }
.swatch.selected { background: var(--primary); border-color: var(--primary); }
.swatch.occupied, .swatch.booked { background: #d8dbe0; border-color: #c2c6cd; }
.swatch.ladies { background: #fbe0ee; border-color: #e79cc4; }

.seat { display: flex; align-items: center; justify-content: center; min-height: 42px;
  border: 1.5px solid #a9dcbd; background: #eaf6ee; color: #17663b; border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 700; cursor: pointer; user-select: none; transition: transform .05s; }
.seat:hover { transform: translateY(-1px); }
.seat.is-occupied, .seat.is-booked { background: #d8dbe0; border-color: #c2c6cd; color: #9aa; cursor: not-allowed; }
.seat.is-ladies { background: #fbe0ee; border-color: #e79cc4; color: #a23a75; }
.seat.is-selected { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 10px rgba(216,78,85,.35); }
.seat.is-exit { box-shadow: inset 0 0 0 2px var(--warn); }

.cabin-grid { display: grid; gap: 7px; }               /* flight: columns set inline per layout */
.deck { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; background: var(--surface); }
.deck-title { font-weight: 800; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 9px; }
.seat.sleeper { border-radius: 7px 7px 13px 13px; min-height: 52px; }

/* ---- Utilities ------------------------------------------------------------*/
.selbar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -6px 20px rgba(24,28,54,.08); padding: 14px 0; margin-top: 20px; }
.selbar .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.center-narrow { max-width: 460px; margin: 40px auto; }

@media (max-width: 860px) {
  .booking-grid { grid-template-columns: 1fr; }
  .summary-rail { position: static; }
  .result { grid-template-columns: 1fr; }
  .result .right { align-items: flex-start; text-align: left; }
  .search-card { margin-top: -40px; }
}

/* ============================================================================
   redBus-realism components (rich cards, filters, seat layout, boarding)
   ========================================================================== */
.ico { width: 1em; height: 1em; display: inline-block; vertical-align: -.125em; }
.btn-bus { background: var(--bus); color: #fff; }
.btn-bus:hover { background: var(--bus-d); }
.badge-bus { background: #fdeaea; color: var(--brand-2); }

/* rating pill (redBus green) */
.rating-pill { display: inline-flex; align-items: center; gap: 4px; background: var(--rating);
  color: #fff; font-weight: 800; font-size: .8rem; padding: 2px 8px; border-radius: 6px; }
.rating-pill .ico { width: .8em; height: .8em; }
.rating-count { color: var(--muted); font-size: .8rem; }

/* operator / airline avatar */
.avatar { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); flex: 0 0 auto; font-size: .95rem; }
.avatar.flight { background: linear-gradient(135deg, #2b5cff, #1c3fb0); }

/* amenities row */
.amenities { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .82rem; align-items: center; }
.amenities .am { display: inline-flex; align-items: center; gap: 5px; }
.amenities .am .ico { color: var(--bus-d); width: 1.05em; height: 1.05em; }

/* results layout: filter sidebar + list */
.results-layout { display: grid; grid-template-columns: 248px 1fr; gap: 20px; align-items: start; }
.filters { position: sticky; top: 80px; }
.filter-group { border-bottom: 1px solid var(--border); padding: 14px 0; }
.filter-group:last-child { border-bottom: 0; }
.filter-group h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin: 0 0 10px; }
.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: .9rem; cursor: pointer; }
.check input { width: auto; }
.sort-tabs { display: flex; gap: 4px; background: #eef0f5; padding: 4px; border-radius: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.sort-tabs button { border: 0; background: transparent; font: inherit; font-weight: 700; font-size: .86rem; color: var(--muted);
  padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.sort-tabs button.active { background: #fff; color: var(--brand); box-shadow: var(--shadow); }

/* richer result card */
.trip-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.trip-card:hover { box-shadow: var(--shadow-lg); border-color: var(--border-2); }
.trip-card .op-name { font-weight: 800; font-size: 1.05rem; }
.trip-card .op-type { color: var(--muted); font-size: .85rem; }
.trip-timeline { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 6px 0; }
.trip-timeline .dur { color: var(--muted); font-weight: 600; font-size: .82rem; display: flex; flex-direction: column; align-items: center; }
.trip-timeline .line { flex: 1; height: 1px; background: var(--border-2); min-width: 30px; position: relative; }
.seats-avail { color: var(--ok); font-weight: 700; font-size: .85rem; }
.seats-avail.low { color: var(--warn); }
.tag-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 2px 7px; border-radius: 5px; background: #eef0f5; color: var(--muted); }
.tag.primo { background: #efe7fb; color: #6b3fb0; }
.tag.track { background: #e5f6ee; color: var(--ok); }

/* ---- Realistic bus seat layout -------------------------------------------*/
.deck-tabs { display: inline-flex; gap: 4px; background: #eef0f5; padding: 4px; border-radius: 10px; margin-bottom: 14px; }
.deck-tabs button { border: 0; background: transparent; font: inherit; font-weight: 700; padding: 7px 16px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.deck-tabs button.active { background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.bus-frame { border: 2px solid var(--border-2); border-radius: 16px 16px 40px 40px; padding: 16px 16px 22px; background: #fbfcfe; max-width: 440px; }
.bus-frame .driver { display: flex; justify-content: flex-end; color: var(--faint); margin-bottom: 10px; }
.bus-frame .driver .ico { width: 26px; height: 26px; }
.deck-pane { display: none; } .deck-pane.active { display: block; }
.deck-label { font-weight: 700; color: var(--muted); font-size: .82rem; margin: 4px 0 10px; }
/* seat grid: seaters are square, sleepers are horizontal berths; aisle gap after col 2 */
.seat-rows { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.seat-rows.sleeper-grid { grid-template-columns: repeat(3, 1fr); }
.berth { min-height: 30px; border-radius: 6px 14px 14px 6px; }        /* sleeper berth shape */
.seat.window::after { content: ""; position: absolute; }
.aisle-gap { grid-column: 1 / -1; height: 4px; }

/* boarding / dropping point selector */
.point-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow: auto; }
.point { display: flex; justify-content: space-between; gap: 10px; border: 1px solid var(--border-2); border-radius: 8px;
  padding: 10px 12px; cursor: pointer; font-size: .9rem; }
.point:hover { border-color: var(--primary); }
.point input { width: auto; }
.point .t { color: var(--muted); font-weight: 700; }

/* offers strip + trust badges + popular routes */
.offer-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 8px; }
.offer { flex: 0 0 auto; border: 1px dashed var(--primary); color: var(--brand-2); background: #fdeef0;
  border-radius: 8px; padding: 8px 12px; font-size: .82rem; font-weight: 700; }
.trust { display: flex; gap: 22px; flex-wrap: wrap; color: #ffdede; }
.trust .t { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; }
.trust .t .ico { width: 22px; height: 22px; color: #ffd0d0; }
.routes-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.routes-chips a { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px;
  font-size: .86rem; font-weight: 600; color: var(--ink); }
.routes-chips a:hover { border-color: var(--primary); color: var(--brand); text-decoration: none; }

/* search widget with swap */
.search-widget { display: grid; grid-template-columns: 1fr auto 1fr 1fr auto; gap: 10px; align-items: end; }
.swap-btn { border: 1px solid var(--border-2); background: #fff; width: 40px; height: 42px; border-radius: 999px;
  cursor: pointer; color: var(--primary); display: grid; place-items: center; margin-bottom: 1px; }
.swap-btn:hover { border-color: var(--primary); }

@media (max-width: 860px) {
  .results-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .trip-card { grid-template-columns: 1fr; }
  .search-widget { grid-template-columns: 1fr; }
}
