/* ==========================================================================
   main.css — global layout & component styling on top of Bootstrap 5 +
   variables.css. Bootstrap handles the grid/utilities; this file carries
   the brand's actual personality.
   ========================================================================== */

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, .display-font {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--color-amber-600); }

.container-tms {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* --- Navbar --- */
.tms-navbar {
  background: var(--brand);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  z-index: 1030;
}
.tms-navbar .navbar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tms-navbar .navbar-brand-logo { height: 36px; width: auto; }

.tms-navbar { flex-wrap: wrap; }
@media (min-width: 1200px) {
  .tms-navbar > .container-tms.container-fluid { flex-wrap: nowrap; }
}
.tms-navbar #navSearchBar { flex-basis: 100%; width: 100%; }
.tms-navbar .nav-link {
  color: rgba(255,255,255,0.85) !important;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 1rem !important;
  white-space: nowrap;
}
.tms-navbar .nav-link:hover,
.tms-navbar .nav-link.active { color: var(--accent) !important; }
@media (min-width: 1200px) {
  /* Safety net: even at this width, never let the icon/Sign-In/Create-Account
     row wrap onto a second line — it should shrink its gaps before that. */
  .tms-mobile-actions { flex-wrap: nowrap; }
}

/* Mobile menu: every collapse item (nav links + actions) gets its own
   full-width row, and slides/fades in one after another as the menu opens. */
@media (max-width: 1199.98px) {
  #tmsNav .navbar-nav { width: 100%; }
  #tmsNav .navbar-nav .nav-item {
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  #tmsNav .navbar-nav .nav-item:last-child { border-bottom: none; }
  #tmsNav .navbar-nav .nav-link { display: block; padding: 0.85rem 0.25rem !important; }

  #tmsNav .tms-mobile-actions {
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
  }
  #tmsNav .tms-mobile-actions > form { display: block; width: 100%; }
  #tmsNav .tms-mobile-actions > .dropdown { width: 100%; }
  #tmsNav .tms-mobile-actions .btn:not(.tms-icon-btn),
  #tmsNav .tms-mobile-actions form button,
  #tmsNav .tms-mobile-actions .dropdown-toggle,
  #tmsNav .tms-mobile-actions .dropdown-menu { width: 100%; }

  #tmsNav.collapsing .navbar-nav .nav-item,
  #tmsNav.show .navbar-nav .nav-item,
  #tmsNav.collapsing .tms-mobile-actions > *,
  #tmsNav.show .tms-mobile-actions > * {
    animation: tms-nav-row-in 0.32s ease both;
  }
  #tmsNav .navbar-nav .nav-item:nth-child(1) { animation-delay: 0.03s; }
  #tmsNav .navbar-nav .nav-item:nth-child(2) { animation-delay: 0.08s; }
  #tmsNav .navbar-nav .nav-item:nth-child(3) { animation-delay: 0.13s; }
  #tmsNav .navbar-nav .nav-item:nth-child(4) { animation-delay: 0.18s; }
  #tmsNav .navbar-nav .nav-item:nth-child(5) { animation-delay: 0.23s; }
  #tmsNav .tms-mobile-actions > *:nth-child(1) { animation-delay: 0.28s; }
  #tmsNav .tms-mobile-actions > *:nth-child(2) { animation-delay: 0.32s; }
  #tmsNav .tms-mobile-actions > *:nth-child(3) { animation-delay: 0.36s; }
  #tmsNav .tms-mobile-actions > *:nth-child(4) { animation-delay: 0.40s; }
  #tmsNav .tms-mobile-actions > *:nth-child(5) { animation-delay: 0.44s; }
}

@keyframes tms-nav-row-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Modals ---
   Mobile browsers (esp. iOS Safari) resize the visual viewport as the address
   bar shows/hides, so a scrollable modal sized off `height: 100%` can end up
   taller than what's actually visible, and its body never registers as
   scrollable. Pin it to the dynamic viewport height and enable native
   momentum/contained touch scrolling so it always scrolls on mobile. */
.modal-dialog-scrollable .modal-body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
/* Every modal in this app wraps modal-header/body/footer in a <form>
   (for single-element submit scoping). That form is modal-content's only
   direct child, breaking the header/body/footer flex-column layout Bootstrap
   relies on to size and scroll modal-body — the form has no height limit of
   its own, so it grows to fit all its children and nothing ever shrinks or
   scrolls, silently clipping whatever doesn't fit. display:contents removes
   the form from the box tree (it still submits/validates normally) so its
   children become direct flex items of .modal-content again. */
.modal-content > form {
  display: contents;
}
/* Applied unconditionally (not just under a width breakpoint) so short
   viewports also get a capped, scrollable modal-content — e.g. a desktop
   window resized short, or a landscape phone that isn't narrow. */
.modal-dialog-scrollable {
  height: calc(100dvh - 1rem);
}
.modal-dialog-scrollable .modal-content {
  max-height: calc(100dvh - 1rem);
}
@media (min-width: 576px) {
  .modal-dialog-scrollable {
    height: calc(100dvh - 3.5rem);
  }
  .modal-dialog-scrollable .modal-content {
    max-height: calc(100dvh - 3.5rem);
  }
}

.btn-tms-accent {
  background: var(--accent);
  border: none;
  color: var(--color-navy-900);
  font-weight: 600;
  padding: 0.55rem 1.4rem;
  border-radius: var(--radius-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn-tms-accent:hover {
  background: var(--color-amber-600);
  color: var(--color-navy-900);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}
.btn-tms-outline {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.35);
  color: #fff;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  font-weight: 500;
  padding: 0.5rem 1.3rem;
  border-radius: var(--radius-sm);
}
.btn-tms-outline:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* Icon toggle buttons (theme / language) */
.tms-icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.tms-icon-btn:hover { background: rgba(255,255,255,0.18); }

/* --- Notification bell --- */
.tms-notification-bell { position: relative; }
.tms-notif-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 18px; height: 18px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem; font-weight: 700; line-height: 1;
  border: 2px solid var(--brand);
}
.tms-notification-bell .dropdown-menu {
  width: 340px; max-width: calc(100vw - 2rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  overflow: hidden;
}
.tms-notif-dropdown-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  color: var(--text);
}
.tms-notif-header-actions { display: flex; align-items: center; gap: 0.85rem; flex-shrink: 0; }
.tms-notif-mark-all {
  background: none; border: none; padding: 0;
  color: var(--accent); font-size: 0.8rem; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tms-notif-mark-all:hover { text-decoration: underline; }
.tms-notif-close-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  background: none; border: none; border-radius: 50%;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.tms-notif-close-btn:hover { background: var(--bg); color: var(--text); }
.tms-notif-list { max-height: 360px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tms-notif-item {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s ease;
}
.tms-notif-item:last-child { border-bottom: none; }
.tms-notif-item:hover { background: var(--bg); color: var(--text); }
.tms-notif-item-title {
  font-size: 0.88rem; font-weight: 500; margin-bottom: 0.15rem;
  overflow-wrap: anywhere; word-break: break-word;
}
.tms-notif-item.is-unread { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.tms-notif-item.is-unread .tms-notif-item-title { font-weight: 700; }
.tms-notif-item.is-unread::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); margin-right: 6px; vertical-align: middle;
}
.tms-notif-item-msg {
  font-size: 0.8rem; color: var(--text-muted); line-height: 1.4;
  overflow-wrap: anywhere; word-break: break-word;
}
.tms-notif-item-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.3rem; }
.tms-notif-empty { padding: 2rem 1rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* Phones: Popper's floating placement gets cramped next to a navbar icon on
   narrow screens (menu clipped at the viewport edge, or too close to the
   button to read comfortably). Pin it as a full-width sheet at the bottom
   of the screen instead — the !important pairs override Popper's own
   inline position/inset/transform it sets on this element for the default
   floating placement. */
@media (max-width: 575.98px) {
  .tms-notification-bell .dropdown-menu.show {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    transform: none !important;
    z-index: 1040 !important;
    margin: 0;
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.25);
  }
  .tms-notif-list { max-height: 60vh; }
}

/* --- Hero --- */
.tms-hero {
  background: radial-gradient(120% 140% at 10% 0%, var(--color-navy-700) 0%, var(--color-navy-900) 55%, #081a33 100%);
  color: #fff;
  padding: 5rem 0 6rem;
  position: relative;
  overflow: hidden;
}
.tms-hero h1 {
  font-size: clamp(2.1rem, 4vw, 3.4rem);
  line-height: 1.12;
}
.tms-hero p.lead { color: rgba(255,255,255,0.78); font-size: 1.15rem; }

/* Hero entrance: text block rises in first, the slider settles in from the
   right a beat later — a quiet bit of motion on the page's first impression. */
.tms-hero .col-lg-7 > * { animation: tms-fade-up 0.6s ease both; }
.tms-hero .col-lg-7 > *:nth-child(1) { animation-delay: 0.05s; }
.tms-hero .col-lg-7 > *:nth-child(2) { animation-delay: 0.12s; }
.tms-hero .col-lg-7 > *:nth-child(3) { animation-delay: 0.19s; }
.tms-hero .col-lg-7 > *:nth-child(4) { animation-delay: 0.26s; }
.tms-hero .col-lg-5 { animation: tms-fade-right 0.6s ease 0.15s both; }
@keyframes tms-fade-right {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Moving bus dot along the hero route line — the signature animated detail */
.hero-route-track {
  position: relative;
  height: 3px;
  margin: 2.5rem 0 0;
  background-image: repeating-linear-gradient(to right, var(--accent) 0 10px, transparent 10px 22px);
}
.hero-route-track .bus-dot {
  position: absolute;
  top: 50%;
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(242,169,59,0.25);
  transform: translate(-50%, -50%);
  animation: travel 6s linear infinite;
}
@keyframes travel {
  0%   { inset-inline-start: 0%; }
  100% { inset-inline-start: 100%; }
}

/* --- Search widget card --- */
.search-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  padding: 1.75rem;
  margin-top: -3.5rem;
  position: relative;
  z-index: 2;
  color: var(--text);
  animation: tms-fade-up 0.6s ease 0.3s both;
}
.search-card .form-label { font-weight: 600; font-size: 0.85rem; color: var(--text-muted); }
.search-card .form-control,
.search-card .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  padding: 0.65rem 0.9rem;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* --- City autocomplete dropdown (homepage search) --- */
.city-suggestions {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  margin-top: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-elevated);
  max-height: 220px;
  overflow-y: auto;
}
.city-suggestions.is-open { display: block; }
.city-suggestions .city-suggestion-item {
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  color: var(--text);
  font-size: 0.9rem;
}
.city-suggestions .city-suggestion-item:hover,
.city-suggestions .city-suggestion-item.is-active {
  background: var(--bg);
}
.city-suggestions .city-suggestion-empty {
  padding: 0.55rem 0.9rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --- Route cards --- */
.route-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  height: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.route-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card); }
.route-card .cities { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.route-card .fare { font-family: var(--font-mono); color: var(--success); font-weight: 700; font-size: 1.25rem; }
.route-card .operator-badge {
  font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* --- Section headings --- */
.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

/* --- Logged-in home page side panel (non-passenger roles) --- */
.user-side-panel {
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-elevated);
}
.user-avatar {
  flex: 0 0 auto;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--brand);
  font-family: var(--font-display);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* --- Transport cards (homepage "Available Transports") --- */
.transport-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.transport-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card); }
.transport-thumb {
  flex: 0 0 auto;
  width: 100%;
  max-width: 192px;
  height: 128px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(11,37,69,0.07), rgba(242,169,59,0.14));
  display: flex; align-items: center; justify-content: center;
}
.transport-thumb i { font-size: 2.75rem; color: var(--brand); opacity: 0.55; }
.transport-thumb-sm {
  width: 72px;
  max-width: 72px;
  height: 72px;
}
.transport-thumb-sm i { font-size: 1.75rem; }
.transport-row-top { margin-bottom: 1rem; }
.transport-row-bottom {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.min-w-0 { min-width: 0; }
.badge-verified {
  font-size: 0.7rem; font-weight: 600; color: var(--success);
  background: rgba(46,125,91,0.1);
  padding: 0.15rem 0.55rem; border-radius: 4px;
}
.badge-new {
  font-size: 0.7rem; font-weight: 600; color: var(--text-muted);
  background: var(--bg); border: 1px solid var(--border);
  padding: 0.15rem 0.55rem; border-radius: 4px;
}
.rating-text { font-size: 0.78rem; color: var(--text-muted); }
.transport-price { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--brand); }
[data-theme="dark"] .transport-price,
[data-theme="auto"] .transport-price { color: var(--accent); }
.price-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.transport-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
@media (min-width: 576px) { .transport-info-grid { grid-template-columns: repeat(4, 1fr); } }
.info-label { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.15rem; }
.info-value { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 0; }
.transport-amenities span { font-size: 0.78rem; color: var(--text-muted); margin-inline-end: 1rem; }
/* --- Compact transport cards (4-up grid on laptop, 2-up on mobile) --- */
.transport-card.is-compact {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.transport-card.is-compact .compact-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  flex: 0 0 auto;
  background: linear-gradient(135deg, rgba(11,37,69,0.07), rgba(242,169,59,0.14));
  display: flex; align-items: center; justify-content: center;
}
.transport-card.is-compact .compact-thumb img { width: 100%; height: 100%; object-fit: cover; }
.transport-card.is-compact .compact-thumb i { font-size: 1.9rem; color: var(--brand); opacity: 0.55; }
.transport-card.is-compact .compact-body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
.transport-card.is-compact .compact-badges { margin-bottom: 0.3rem; }
.transport-card.is-compact .compact-title {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.transport-card.is-compact .compact-title:hover { color: var(--accent); }
.transport-card.is-compact .compact-route {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.transport-card.is-compact .compact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}
.transport-card.is-compact .compact-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}
.transport-card.is-compact .transport-price { font-size: 0.95rem; }
.transport-card.is-compact .price-label { font-size: 0.58rem; }
.transport-card.is-compact .badge-verified,
.transport-card.is-compact .badge-new,
.transport-card.is-compact .rating-text { font-size: 0.6rem; padding: 0.1rem 0.4rem; }
.transport-card.is-compact .btn-sm { padding: 0.35rem 0.7rem; font-size: 0.75rem; }
.transport-card.is-compact .compact-more-btn {
  color: var(--brand);
  border-color: var(--border);
}
.transport-card.is-compact .compact-more-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
[data-theme="dark"] .transport-card.is-compact .compact-more-btn,
[data-theme="auto"] .transport-card.is-compact .compact-more-btn { color: var(--text); }

/* Below the 2-up breakpoint, cards go one-per-row. Keep the same
   image-on-top layout as every other screen size (deliberately NOT
   switching to a horizontal image-left/right layout here) — a single
   consistent card design in both LTR and RTL (Urdu) is the point; a
   row layout flips side under RTL and looked inconsistent with desktop. */
@media (max-width: 575.98px) {
  .transport-card.is-compact .compact-thumb i { font-size: 2.2rem; }
  .transport-card.is-compact .compact-body { padding: 1rem 1.1rem; }
  .transport-card.is-compact .compact-title { font-size: 1rem; }
  .transport-card.is-compact .compact-route { font-size: 0.82rem; margin-bottom: 0.7rem; }
  .transport-card.is-compact .compact-meta { font-size: 0.72rem; margin-bottom: 0.85rem; }
  .transport-card.is-compact .transport-price { font-size: 1.15rem; }
  .transport-card.is-compact .price-label { font-size: 0.62rem; }
  .transport-card.is-compact .btn-sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
}

/* When the logged-in sidebar (col-lg-4) is showing, the homepage's card grid
   drops to 2-up (col-lg-6) instead of 4-up — same compact typography left
   the cards looking sparse in the wider column, so scale it up here. */
@media (min-width: 992px) {
  #transportList.has-sidebar .transport-card.is-compact .compact-thumb i { font-size: 2.2rem; }
  #transportList.has-sidebar .transport-card.is-compact .compact-body { padding: 1rem 1.15rem; }
  #transportList.has-sidebar .transport-card.is-compact .compact-title { font-size: 1.05rem; }
  #transportList.has-sidebar .transport-card.is-compact .compact-route { font-size: 0.85rem; margin-bottom: 0.7rem; }
  #transportList.has-sidebar .transport-card.is-compact .compact-meta { font-size: 0.75rem; margin-bottom: 0.85rem; }
  #transportList.has-sidebar .transport-card.is-compact .transport-price { font-size: 1.2rem; }
  #transportList.has-sidebar .transport-card.is-compact .price-label { font-size: 0.65rem; }
  #transportList.has-sidebar .transport-card.is-compact .badge-verified,
  #transportList.has-sidebar .transport-card.is-compact .badge-new,
  #transportList.has-sidebar .transport-card.is-compact .rating-text { font-size: 0.68rem; padding: 0.15rem 0.5rem; }
  #transportList.has-sidebar .transport-card.is-compact .btn-sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
}

/* Transporter profile page's services grid (row-cols-1 row-cols-md-2) is
   its own independent 2-up layout — same wider-card typography bump,
   starting at its own md breakpoint rather than the homepage's lg one. */
@media (min-width: 768px) {
  .services-grid .transport-card.is-compact .compact-thumb i { font-size: 2.2rem; }
  .services-grid .transport-card.is-compact .compact-body { padding: 1rem 1.15rem; }
  .services-grid .transport-card.is-compact .compact-title { font-size: 1.05rem; }
  .services-grid .transport-card.is-compact .compact-route { font-size: 0.85rem; margin-bottom: 0.7rem; }
  .services-grid .transport-card.is-compact .compact-meta { font-size: 0.75rem; margin-bottom: 0.85rem; }
  .services-grid .transport-card.is-compact .transport-price { font-size: 1.2rem; }
  .services-grid .transport-card.is-compact .price-label { font-size: 0.65rem; }
  .services-grid .transport-card.is-compact .badge-verified,
  .services-grid .transport-card.is-compact .badge-new,
  .services-grid .transport-card.is-compact .rating-text { font-size: 0.68rem; padding: 0.15rem 0.5rem; }
  .services-grid .transport-card.is-compact .btn-sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
}

/* Route names (this page's card title) are unpredictable in length, unlike
   the homepage's compact-title (a single company name) — let it wrap instead
   of ellipsis-truncating a city pair. */
.services-grid .transport-card.is-compact .compact-title {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

/* Scroll-triggered reveal for the popular-routes grid: each card slides in
   from alternating sides (left/right) as it enters the viewport — see the
   IntersectionObserver wiring in home/index.php. Respects reduced-motion. */
#transportList {
  /* Cards translateX() off-screen before revealing (below); clip that
     transient overflow here instead of on html/body, which would break
     position: sticky on the navbar. */
  overflow-x: hidden;
}
#transportList > div {
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
#transportList > div.reveal-from-left { transform: translateX(-48px); }
#transportList > div.reveal-from-right { transform: translateX(48px); }
#transportList > div.reveal-visible { opacity: 1; transform: translateX(0); }

@media (prefers-reduced-motion: reduce) {
  #transportList > div { opacity: 1; transform: none; transition: none; }
}

.sort-btn {
  font-size: 0.75rem; font-weight: 600;
  padding: 0.4rem 0.85rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.sort-btn:hover, .sort-btn.active { border-color: var(--accent); color: var(--accent); }

/* --- "My Active Tickets" panel --- */
.ticket-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}
.ticket-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}
.ticket-card.is-upcoming { border-color: rgba(242,169,59,0.4); background: rgba(242,169,59,0.06); }
.ticket-card.is-past { opacity: 0.6; filter: grayscale(1); transition: opacity 0.15s ease, filter 0.15s ease; }
.ticket-card.is-past:hover { opacity: 1; filter: grayscale(0); }
.ticket-status {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem; border-radius: 4px;
}
.ticket-status.upcoming { background: rgba(242,169,59,0.18); color: var(--color-amber-600); }
.ticket-status.completed { background: var(--bg); color: var(--text-muted); }
.ticket-status.cancelled, .ticket-status.no_show { background: rgba(192,57,43,0.1); color: var(--danger); }
.ticket-ref { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); }
.btn-view-all {
  display: block; width: 100%; text-align: center;
  padding-top: 1rem; margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem; font-weight: 700; color: var(--brand);
}
.btn-view-all:hover { color: var(--accent); }

/* Keeps the logged-in sidebar pinned near the top as the (usually much
   taller) route list is scrolled, instead of stretching to match the row
   height and leaving a tall empty gap below its short content. */
@media (min-width: 992px) {
  .account-sidebar {
    align-self: flex-start;
    position: sticky;
    top: 96px;
  }
}

/* --- Sidebar "need help" card --- */
.help-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.help-card-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  background: rgba(242,169,59,0.12);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 0.85rem;
}
[data-theme="dark"] .help-card-icon,
[data-theme="auto"] .help-card-icon { background: rgba(242,169,59,0.16); }

/* --- Homepage promo card --- */
.offer-card {
  background: linear-gradient(135deg, var(--brand), var(--color-navy-700));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.offer-card-icon {
  position: absolute;
  inset-inline-end: -1rem; bottom: -1.25rem;
  font-size: 6.5rem;
  color: rgba(255,255,255,0.08);
  transform: rotate(12deg);
}

/* --- Homepage feature highlight cards --- */
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.85rem 1.35rem;
  height: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
  border-color: var(--accent);
}
.feature-card-icon {
  width: 56px; height: 56px;
  margin: 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(242,169,59,0.18), rgba(11,37,69,0.08));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  color: var(--accent);
}

/* --- Footer --- */
.tms-footer {
  background: var(--color-navy-900);
  color: rgba(255,255,255,0.75);
  padding: 3.5rem 0 1.5rem;
  margin-top: 4rem;
}
.tms-footer h6 { color: #fff; font-family: var(--font-display); }
.tms-footer .footer-brand-logo { height: 32px; width: auto; }
.tms-footer a { color: rgba(255,255,255,0.7); }
.tms-footer a:hover { color: var(--accent); }
.tms-footer .footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
}

/* --- Forms (auth pages) --- */
.auth-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2.5rem;
  max-width: 460px;
  margin: 3rem auto;
}
.otp-inputs { display: flex; gap: 0.6rem; justify-content: center; }
.otp-inputs input {
  width: 48px; height: 56px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.otp-inputs input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(242,169,59,0.25);
}

/* --- Login identifier switch (Phone / Email) --- */
.login-mode-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.login-mode-switch button {
  flex: 1;
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.login-mode-switch button + button { border-inline-start: 1px solid var(--border); }
.login-mode-switch button.active { background: var(--accent); color: #fff; }

/* --- Password show/hide toggle (auto-applied to every password input) --- */
.tms-password-wrap { position: relative; }
.tms-password-wrap input { padding-inline-end: 2.75rem; }
.tms-password-toggle {
  position: absolute;
  top: 50%;
  inset-inline-end: 0.5rem;
  transform: translateY(-50%);
  border: none;
  background: none;
  padding: 0.25rem 0.4rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}
.tms-password-toggle:hover,
.tms-password-toggle:focus-visible { color: var(--accent); }

/* Focus visibility for keyboard users (accessibility floor) */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- RTL (Urdu) directional icons ---
   Bootstrap Icons used as "forward/next" cues (route arrows, "View All",
   carousel controls, back/forward chevrons) point in the LTR reading
   direction by default. Mirror them under dir="rtl" so they still read
   as "forward" instead of visually pointing backward. */
[dir="rtl"] .bi-arrow-right,
[dir="rtl"] .bi-chevron-right,
[dir="rtl"] .bi-arrow-left,
[dir="rtl"] .bi-chevron-left {
  display: inline-block;
  transform: scaleX(-1);
}

@media (max-width: 576px) {
  .search-card { margin-top: -2rem; padding: 1.25rem; }
  .tms-hero { padding: 3rem 0 4.5rem; }
  .tms-hero h1 { font-size: clamp(1.4rem, 6.2vw, 1.85rem); line-height: 1.18; }
  .tms-hero p.lead { font-size: 0.9rem; }
  .tms-hero .section-eyebrow { font-size: 0.7rem; }
}

/* --- Transporter profile page --- */
.profile-cover {
  height: 280px;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--brand), var(--color-navy-700));
}
.profile-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-cover::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(11,37,69,0.55), transparent);
}
.profile-header-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  margin-top: -5rem;
  position: relative;
  z-index: 2;
  padding: 1.5rem;
}
.profile-avatar-box {
  width: 128px; height: 128px;
  flex: 0 0 auto;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: 0.4rem;
  margin-top: -4.5rem;
}
.profile-avatar-box img,
.profile-avatar-box .profile-avatar-fallback {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-md) - 4px);
}
.profile-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  color: var(--brand);
  font-size: 2.5rem;
}
@media (max-width: 767px) {
  .profile-avatar-box { margin-top: -6rem; }
}
@media (max-width: 575.98px) {
  .profile-cover { height: 170px; width: 100vw; margin-left: calc(50% - 50vw); }
  .profile-header-card { margin-top: -2.5rem; padding: 1.1rem; }
  .profile-avatar-box { width: 84px; height: 84px; margin-top: -3.25rem; padding: 0.3rem; }
  .profile-avatar-fallback { font-size: 1.9rem; }
  .transport-card .transport-thumb {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
  }
  .transport-card .transport-thumb i { font-size: 2.2rem; }
}

.profile-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}
.profile-stat .stat-value { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--brand); margin-bottom: 0.15rem; }
[data-theme="dark"] .profile-stat .stat-value,
[data-theme="auto"] .profile-stat .stat-value { color: var(--accent); }
.profile-stat .stat-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }

.profile-gallery-item {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}
.profile-gallery-item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s ease;
}
.profile-gallery-item:hover img { transform: scale(1.08); }

.contact-icon-box {
  width: 42px; height: 42px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  background: rgba(242,169,59,0.12);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
}
[data-theme="dark"] .contact-icon-box,
[data-theme="auto"] .contact-icon-box { background: rgba(242,169,59,0.16); }
.contact-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.1rem; }
.contact-value { font-size: 0.9rem; font-weight: 700; color: var(--text); }

.social-icon-circle {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.social-icon-circle:hover { background: var(--accent); color: var(--color-navy-900); border-color: var(--accent); }

/* --- Homepage hero slider (promo slides, managed by Main Admin) --- */
.hero-slider { max-width: 420px; }
.hero-slide-card {
  height: 320px;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  box-shadow: 0 18px 40px -12px rgba(8,26,51,0.55), 0 0 0 1px rgba(255,255,255,0.08) inset;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.hero-slider:hover .hero-slide-card { transform: translateY(-3px); box-shadow: 0 22px 48px -14px rgba(8,26,51,0.65), 0 0 0 1px rgba(255,255,255,0.12) inset; }
/* Background lives on its own layer so it can zoom (Ken Burns) without
   dragging the overlay text along with it. */
.hero-slide-bg {
  position: absolute; inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1);
}
.carousel-item.active .hero-slide-bg { animation: heroKenBurns 7s ease-in-out infinite alternate; }
@keyframes heroKenBurns {
  from { transform: scale(1); }
  to   { transform: scale(1.12); }
}
.hero-slide-card::before {
  content: '';
  position: absolute; inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(8,26,51,0.15) 0%, rgba(8,26,51,0.55) 55%, rgba(8,26,51,0.92) 100%);
}
.hero-slide-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  z-index: 2;
  padding: 1.25rem;
  color: #fff;
}
/* Each slide's text rises in on its own beat when it becomes active,
   instead of just appearing with Bootstrap's opacity fade. */
.carousel-item.active .hero-slide-overlay > * { animation: heroContentRise 0.55s ease both; }
.carousel-item.active .hero-slide-overlay > *:nth-child(1) { animation-delay: 0.05s; }
.carousel-item.active .hero-slide-overlay > *:nth-child(2) { animation-delay: 0.11s; }
.carousel-item.active .hero-slide-overlay > *:nth-child(3) { animation-delay: 0.17s; }
.carousel-item.active .hero-slide-overlay > *:nth-child(4) { animation-delay: 0.23s; }
@keyframes heroContentRise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .carousel-item.active .hero-slide-bg { animation: none; }
  .carousel-item.active .hero-slide-overlay > * { animation: none; }
}
.hero-slide-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), #ffcf7a);
  color: var(--color-navy-900);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
  box-shadow: 0 4px 14px -2px rgba(242,169,59,0.55);
}
.hero-slide-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.25rem; line-height: 1.25; text-shadow: 0 2px 10px rgba(0,0,0,0.35); }
.hero-slide-transport { font-size: 0.85rem; font-weight: 600; opacity: 0.9; margin-bottom: 0.15rem; }
.hero-slide-route { font-size: 0.8rem; opacity: 0.8; margin-bottom: 0; }
.hero-slide-overlay .btn-sm { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.hero-slide-overlay .btn-sm:hover { transform: translateY(-2px); box-shadow: 0 8px 18px -6px rgba(0,0,0,0.45); }
.hero-slider .carousel-indicators { margin-bottom: 0.6rem; }
.hero-slider .carousel-indicators [data-bs-target] {
  background-color: rgba(255,255,255,0.5);
  width: 8px; height: 8px;
  border-radius: 50%;
  transition: width 0.25s ease, background-color 0.25s ease;
}
.hero-slider .carousel-indicators [data-bs-target].active {
  background-color: var(--accent);
  width: 22px;
  border-radius: 999px;
}
/* Touch-friendly circular arrows instead of Bootstrap's faint full-height
   click zones — a clearer, more modern affordance on a tappable slider. */
.hero-slider .carousel-control-prev,
.hero-slider .carousel-control-next {
  top: 50%;
  bottom: auto;
  width: 40px; height: 40px;
  transform: translateY(-50%);
  background: rgba(8,26,51,0.4);
  border-radius: 50%;
  opacity: 0.85;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}
.hero-slider .carousel-control-prev { left: 0.75rem; }
.hero-slider .carousel-control-next { right: 0.75rem; }
.hero-slider .carousel-control-prev:hover,
.hero-slider .carousel-control-next:hover { background: rgba(8,26,51,0.6); opacity: 1; }
.hero-slider .carousel-control-prev-icon,
.hero-slider .carousel-control-next-icon { width: 1.1rem; height: 1.1rem; }
.hero-fallback-icon { font-size: 11rem; color: rgba(242,169,59,0.18); }

/* Below desktop the slider drops out of the 5-column hero split and stacks
   full-width under the headline — let it fill that width edge-to-edge
   instead of floating as a small centered box, so it reads as a proper
   hero visual rather than an afterthought. */
@media (max-width: 991px) {
  .hero-slider { max-width: 100%; }
  .hero-slide-card { height: 260px; }
  .hero-fallback-icon { font-size: 6rem; }
}
@media (max-width: 575.98px) {
  .hero-slide-card { height: 220px; }
  .hero-slide-overlay { padding: 1rem; text-align: center; }
  .hero-slide-overlay .d-flex { justify-content: center; }
  .hero-slide-badge { font-size: 0.62rem; padding: 0.15rem 0.5rem; margin-bottom: 0.35rem; }
  .hero-slide-title { font-size: 0.95rem; margin-bottom: 0.15rem; }
  .hero-slide-transport, .hero-slide-route { font-size: 0.72rem; }
  .hero-slide-overlay .btn-sm { padding: 0.3rem 0.65rem; font-size: 0.72rem; }
  .hero-slider .carousel-control-prev,
  .hero-slider .carousel-control-next { width: 34px; height: 34px; }
  .hero-fallback-icon { font-size: 4rem; }
  .hero-slider .carousel-indicators { display: none; }
}

/* --- Global image lightbox (see app.js) --- */
.tms-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(8,26,51,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.tms-lightbox.is-open { opacity: 1; visibility: visible; }
.tms-lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.tms-lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.14);
  color: #fff;
  font-size: 1.15rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.tms-lightbox-close:hover { background: rgba(255,255,255,0.24); transform: scale(1.06); }
@media (max-width: 575.98px) {
  .tms-lightbox { padding: 1rem; }
  .tms-lightbox-close { top: 0.85rem; right: 0.85rem; width: 38px; height: 38px; font-size: 1rem; }
}
