/* TRUNKO V25 — customer booking alignment only.
   Loaded after site.css/customer-booking.css. No API, JS, form IDs, or business logic changes.
   Scope deliberately excludes administration and Flutter applications. */

/* Consistent content width and predictable box sizing across booking, tracking and quotes. */
.tw-booking,
.tw-booking *,
.tw-booking *::before,
.tw-booking *::after { box-sizing: border-box; }
.tw-booking {
  width: min(1180px, calc(100% - 48px));
  max-width: 100%;
  padding-block: clamp(24px, 3vw, 44px) 72px;
  margin-inline: auto;
}
.tw-booking :is(h1,h2,h3,p) { max-width: 100%; overflow-wrap: break-word; }
.tw-booking .form-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: clamp(20px, 3vw, 38px);
  border-radius: 20px;
  margin-block: 0 24px;
}
.tw-booking .form-card > h2,
.tw-booking #tw-parcel-fields > h2 { margin: 0 0 22px; line-height: 1.28; }
.tw-booking .form-card > .tw-muted { margin: 0 0 22px; line-height: 1.6; }
.tw-booking [hidden] { display: none !important; }

/* The service/trip selectors need a clear gap before the route heading.
   The previous selector row and heading visually collided. */
.tw-booking #tw-route-fields > .field-row:first-child { margin-bottom: 30px; }
.tw-booking #tw-route-fields > h2 {
  margin: 0 0 12px;
  line-height: 1.28;
  clear: both;
}
.tw-booking #tw-route-fields > h2 + p { margin: 0 0 24px; line-height: 1.6; }
.tw-booking .field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 18px 24px;
  margin-bottom: 24px;
}
.tw-booking .field-row > :is(label,section) { min-width: 0; max-width: 100%; }
.tw-booking .field-row > label,
.tw-booking #tw-parcel-fields .field-row > label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.4;
}
.tw-booking .field-row > label > :is(input,select,textarea),
.tw-booking #tw-parcel-fields .field-row > label > :is(input,select,textarea) {
  display: block;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  min-height: 54px;
  border-radius: 10px;
  background: #fff;
  padding: 12px 16px;
  line-height: 1.4;
}
.tw-booking .field-row textarea { min-height: 82px !important; }
.tw-booking .field-row small,
.tw-booking #tw-notes-field small { font-size: 12px; line-height: 1.3; }

/* Paired pickup and destination controls stay aligned at each breakpoint. */
.tw-booking .tw-route-locations { margin: 0 0 22px; gap: 24px; }
.tw-booking .tw-route-locations > .tw-location-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
  margin: 0;
}
.tw-booking .tw-location-field > label { margin: 0; font-size: 13px; line-height: 1.4; }
.tw-booking .tw-location-search,
.tw-booking .tw-location-input-wrap,
.tw-booking .tw-manual-location,
.tw-booking .tw-address-status { min-width: 0; width: 100%; max-width: 100%; margin: 0; }
.tw-booking .tw-location-field .tw-manual-location { margin: 0; }
.tw-booking .tw-location-field .tw-address-status {
  min-height: 46px;
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
  padding: 10px 13px;
}
.tw-booking .tw-location-field > .btn,
.tw-booking .tw-location-field .tw-save-location { width: 100%; min-height: 50px; margin: 0; }
.tw-booking .tw-location-input-wrap input[type="search"] { min-height: 52px; }
.tw-booking .tw-map-help { margin: 8px 0 12px; line-height: 1.55; }
.tw-booking #tw-map-note { margin: 0 0 12px; }
.tw-booking .tw-map { width: 100%; max-width: 100%; min-width: 0; margin: 0 0 28px; border-radius: 16px; }

/* Align Travel pickup date and passenger count in the same desktop row.
   The original markup keeps independent wrappers; CSS grid aligns them without
   moving fields or touching their JavaScript selectors. */
@media (min-width: 681px) {
  .tw-booking #tw-route-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
  }
  .tw-booking #tw-route-fields > * { grid-column: 1 / -1; min-width: 0; }
  .tw-booking #tw-route-fields > .field-row[data-schedule] {
    grid-column: 1;
    grid-template-columns: minmax(0, 1fr);
  }
  .tw-booking #tw-route-fields > .field-row[data-outstation-travel]:not([hidden]) {
    grid-column: 2;
    grid-template-columns: minmax(0, 1fr);
  }
  .tw-booking #tw-route-fields:not(:has(> .field-row[data-outstation-travel]:not([hidden])))
    > .field-row[data-schedule] { grid-column: 1 / -1; }
}

/* Travel and parcel details: avoid isolated labels and accidental spacing collapses. */
.tw-booking #tw-parcel-fields { min-width: 0; }
.tw-booking #tw-edit-route { margin: 0 0 22px; max-width: 100%; }
.tw-booking #tw-parcel-fields > .field-row { margin-bottom: 20px; }
.tw-booking .tw-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 14px 0;
  line-height: 1.5;
  font-size: 14px;
}
.tw-booking .tw-checkbox input[type="checkbox"] { flex: 0 0 20px; width: 20px; height: 20px; margin: 2px 0 0; }
.tw-booking #tw-notes-field {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 100%;
  max-width: 100%;
  margin: 24px 0 0;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.4;
}
.tw-booking #tw-notes { min-width: 0; width: 100%; min-height: 80px; border-radius: 10px; margin: 0; }
.tw-booking #tw-get-quotes { display: inline-flex; max-width: 100%; min-height: 52px; margin-top: 16px; white-space: normal; text-align: center; }

/* Quotation cards, review step and payment actions. */
.tw-booking .tw-quote-grid { grid-template-columns: repeat(auto-fit,minmax(min(100%,250px),1fr)); gap: 18px; }
.tw-booking #tw-summary { min-width: 0; margin: 4px 0 22px; }
.tw-booking .tw-summary-row { padding: 15px 0; margin: 0; line-height: 1.55; border-bottom: 1px solid #e7ebef; }
.tw-booking #tw-summary details { padding: 15px 0; border-bottom: 1px solid #e7ebef; }
.tw-booking #tw-summary summary { cursor: pointer; }
.tw-booking .tw-advance-panel { margin: 20px 0; padding: clamp(18px,2.4vw,26px); }
.tw-booking .tw-advance-panel h3 { line-height: 1.3; }
.tw-booking .tw-review-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
.tw-booking .tw-review-actions > .btn { margin: 0; min-height: 52px; max-width: 100%; white-space: normal; text-align: center; }

/* Tracking and chat use the same card rhythm, without changing live map or messages. */
.tw-booking .tw-tracking-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 22px; align-items: stretch; }
.tw-booking .tw-tracking-grid > .form-card { min-width: 0; margin-bottom: 24px; }
.tw-booking .tw-tracking-grid .tw-map { margin: 0 0 16px; }
.tw-booking .tw-controls > .btn,
.tw-booking .tw-quick-replies > .btn { margin: 0; }

/* Shared overflow guardrails on other customer-facing pages (not platform admin). */
:is(.tc-main,.tc-dashboard,.tk-cancellations,.tr-status) :is(input,select,textarea) {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 900px) {
  .tw-booking { width: calc(100% - 40px); padding-top: 24px; }
  .tw-booking .field-row { gap: 16px; }
  .tw-booking .tw-tracking-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .tw-booking { width: calc(100% - 24px); padding-block: 18px 48px; }
  .tw-booking .form-card { padding: 20px 16px; border-radius: 16px; }
  .tw-booking .field-row,
  .tw-booking .tw-route-locations { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .tw-booking #tw-route-fields > .field-row:first-child { margin-bottom: 26px; }
  .tw-booking #tw-route-fields > h2 { font-size: clamp(22px,5.2vw,27px); }
  .tw-booking .tw-map { height: 260px; }
  .tw-booking .tw-review-actions > .btn { flex: 1 1 180px; }
  .tw-booking #tw-get-quotes { width: 100%; }
  .tw-booking .tw-steps { gap: 10px; }
  .tw-booking .tw-steps li { font-size: 12px; }
  .tw-booking .tw-route-locations > .tw-location-field { gap: 9px; }
}
@media (max-width: 360px) {
  .tw-booking .form-card { padding-inline: 13px; }
  .tw-booking .tw-review-actions > .btn { flex-basis: 100%; }
  .tw-booking .tw-service-tabs button { font-size: 14px; }
}
