/* Lotus Bus — Student Interface CSS (Clean, natural, responsive across all screens) */

body {
  padding-bottom: 32px;
}

/* Sub-navigation tabs */
.subnav {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 53px;
  z-index: 60;
}

.subnav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.subnav-inner::-webkit-scrollbar {
  display: none;
}

.subnav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--mute);
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.subnav a:hover {
  color: var(--ink);
}

.subnav a.on {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.tbadge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--bad);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 800;
}

body.track .subnav {
  display: none;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--ink);
}

/* Student Home Layout: two balanced columns on desktop, clean stack on tablet/mobile */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 14px;
  align-items: start;
}

.home-grid > * {
  min-width: 0;
}

.map-card {
  padding: 12px;
}

.map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.map-head select {
  width: auto;
  min-width: 200px;
  max-width: 100%;
  flex: 0 1 300px;
  padding: 7px 10px;
  font-weight: 700;
}

.map-box {
  height: 340px;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin: 0;
}

/* Active Trip Card */
.tc-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.avatar {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 800;
  font-size: 17px;
  border: 1px solid #cce3d8;
}

.tc-driver {
  display: block;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 2px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--mute);
}

.plate {
  font-weight: 700;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 1px 8px;
  white-space: nowrap;
}

/* ETA Box */
.eta-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.eta-cell {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
}

.eta-cell .mute {
  font-size: 12.5px;
  display: block;
}

.eta-big {
  font-size: clamp(20px, 4vw, 25px);
  font-weight: 800;
  color: var(--brand);
  line-height: 1.25;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.eta-big small {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--mute);
  margin-inline-start: 6px;
}

/* Stepper */
.stepper {
  list-style: none;
  margin: 12px 0 8px;
  padding: 0;
  display: flex;
  gap: 6px;
}

.stepper li {
  flex: 1;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 6px;
  border-radius: 7px;
  background: var(--bg);
  color: var(--mute);
  border: 1px solid var(--line);
}

.stepper li.done {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: #b8e2cc;
}

.stepper li.cur {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  font-weight: 800;
}

.note {
  background: var(--warn-bg);
  color: #78350f;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  margin-top: 10px;
}

/* Action Buttons Grid (3 buttons: balanced 3-col on desktop, 1+2 on mobile) */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.act-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}

.act-btn:hover {
  background: var(--bg);
}

.act-btn.pri {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.act-btn.pri:hover {
  background: var(--brand-hover);
}

/* Ready Box */
.ready-box {
  background: var(--brand-soft);
  border: 1px solid #bddccf;
  border-radius: 10px;
  padding: 12px;
  margin-top: 12px;
}

.ready-box h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--brand);
}

/* Trip Rows */
.trip-row, .up-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.trip-row:last-child, .up-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.up-time {
  flex: none;
  min-width: 60px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  direction: ltr;
}

.link-row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.link-row input {
  flex: 1 1 200px;
  direction: ltr;
  font-size: 12.5px;
  padding: 7px 10px;
}

/* Chat View */
.chat-card-wrap {
  max-width: 720px;
  margin: 0 auto;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.chat-list {
  height: 340px;
  overflow-y: auto;
  padding: 12px;
  margin: 12px 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bub-row {
  display: flex;
  flex-direction: column;
  max-width: 84%;
}

.bub-row.me {
  align-self: flex-start;
}

.bub-row.drv {
  align-self: flex-end;
}

.bub {
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.bub-row.me .bub {
  background: var(--brand);
  color: #fff;
}

.bub-row.drv .bub {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.bub-ts {
  font-size: 11px;
  color: var(--mute);
  margin-top: 2px;
  padding: 0 4px;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.chip {
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink);
  border-radius: 6px;
  padding: 6px 11px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.chip:hover {
  background: var(--bg-subtle);
}

.chat-input-row {
  display: flex;
  gap: 8px;
}

/* Leaflet Bus Marker */
.bus-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-width: 60px;
  padding: 0 10px;
  border-radius: 6px;
  background: #1c2421;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Pickup point (Ready) on the map */
.pk-pin {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.pk-pin.live::after {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 2px solid var(--brand);
  animation: pkPulse 1.6s ease-out infinite;
}

@keyframes pkPulse {
  from { transform: scale(0.4); opacity: 0.9; }
  to { transform: scale(1.4); opacity: 0; }
}

.map-box.picking,
.map-box.picking .leaflet-grab,
.map-box.picking .leaflet-interactive {
  cursor: crosshair !important;
}

.me-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--info);
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Responsive adjustments */
@media (max-width: 860px) {
  .home-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .home-col {
    display: contents;
  }

  .home-grid .card {
    margin-bottom: 0;
  }

  .m-order-1 { order: 1; }
  .m-order-2 { order: 2; }
  .m-order-3 { order: 3; }
  .m-order-4 { order: 4; }
}

@media (max-width: 680px) {
  .subnav {
    top: 0;
  }

  .subnav-inner {
    padding: 0 8px;
    gap: 2px;
  }

  .subnav a {
    flex: 1;
    padding: 10px 8px;
    font-size: 13px;
  }

  .map-head select {
    width: 100%;
    flex: 1 1 100%;
    min-width: 0;
  }

  .route-tabs {
    width: 100%;
  }

  .route-tabs .btn {
    flex: 1;
  }

  .map-box {
    height: 260px;
  }

  .chat-list {
    height: 280px;
  }
}

@media (max-width: 540px) {
  .actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions-grid > :first-child {
    grid-column: 1 / -1;
  }

  .ready-box .row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .ready-box .btn {
    width: 100%;
  }

  .link-row input {
    flex: 1 1 100%;
  }

  .link-row .btn {
    flex: 1;
  }

  .stepper li {
    font-size: 11.5px;
    padding: 6px 4px;
  }
}

@media (max-width: 380px) {
  .eta-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .subnav a {
    font-size: 12px;
    padding: 9px 5px;
  }
}
