/*
 * Trips (Phase 5): styles shared by the trip, stay, transport, note and checklist sheets, and by pieces the trip pages
 * reuse across components. Component-specific styles live in each component's .razor.css.
 */

.tl-trip-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tl-trip-form__hint {
  margin: -8px 0 0;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

.tl-trip-form__error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--tl-danger-border);
  border-radius: var(--tl-radius-control);
  background: var(--tl-danger-soft);
  color: var(--tl-danger);
  font-size: 14px;
}

.tl-trip-form__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: 12px;
  align-items: start;
}

@media (max-width: 639.98px) {
  .tl-trip-form__row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.tl-trip-form__textarea {
  height: auto;
  min-height: 88px;
  padding: 10px 12px;
  line-height: 1.45;
  resize: vertical;
}

.tl-trip-form__group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--tl-border);
  border-radius: 12px;
  background: var(--tl-surface);
  min-width: 0;
}

.tl-trip-form__group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font: 600 14px/20px var(--tl-font);
  color: var(--tl-text);
}

/* v1.7.0: a flight's airline, number and date, with Look up flight. */
.tl-trip-form__row.tl-trip-form__row--pair {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

@media (max-width: 639.98px) {
  .tl-trip-form__row.tl-trip-form__row--pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

.tl-trip-form__lookup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.tl-trip-form__lookup-line,
.tl-trip-form__lookup-credit {
  margin: 0;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

.tl-trip-form__lookup-line a,
.tl-trip-form__lookup-credit a {
  color: var(--tl-primary);
  text-decoration: underline;
}

.tl-trip-form__lookup-credit {
  font-size: 12px;
  line-height: 16px;
}

.tl-trip-form__lookup-differs,
.tl-trip-form__lookup-choice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--tl-surface-muted);
}

.tl-trip-form__lookup-differs .tl-trip-form__lookup-line,
.tl-trip-form__lookup-choice .tl-trip-form__lookup-line {
  color: var(--tl-text);
}

.tl-trip-form__lookup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.tl-trip-form__point {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

.tl-trip-form__restore {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: var(--tl-radius-control);
  background: var(--tl-planned-soft);
  border: 1px solid var(--tl-planned-border);
  font-size: 14px;
  color: var(--tl-text);
}

.tl-trip-form__restore p {
  flex: 1 1 200px;
  margin: 0;
}

.tl-trip-sheet__loading {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Date fields: native inputs on phones, Mud pickers from 640px (UI spec §5.4). */
.tl-dtfield--native {
  display: none;
}

@media (max-width: 639.98px) {
  .tl-dtfield--native {
    display: block;
  }

  .tl-dtfield--picker {
    display: none;
  }
}

.tl-form-grid.tl-dtfield__pair {
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 12px;
}

.tl-zonefield__line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: -6px 0 0;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

.tl-peoplepicker {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.tl-peoplepicker__legend {
  padding: 0;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--tl-text);
}

.tl-peoplepicker__row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tl-peoplepicker__error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  color: var(--tl-danger);
  font-size: 13px;
}

.tl-more {
  border-top: 1px solid var(--tl-border);
}

.tl-more__toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--tl-text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.tl-more__toggle:focus-visible {
  outline: none;
  box-shadow: var(--tl-focus-shadow);
  border-radius: var(--tl-radius-control);
}

.tl-more__title {
  font-size: 15px;
  font-weight: 600;
}

.tl-more__meta {
  flex: 1;
  min-width: 0;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.tl-more__chevron {
  flex: none;
  color: var(--tl-text-muted);
  transition: transform var(--tl-fast) var(--tl-ease);
}

.tl-more.is-open .tl-more__chevron {
  transform: rotate(180deg);
}

.tl-more__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0 8px;
}

.tl-pricefield {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 12px;
  align-items: start;
}

/* Place search for stays and transport ends. */
.tl-placesearch {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tl-placesearch__box {
  position: relative;
}

.tl-placesearch__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tl-text-muted);
  display: inline-flex;
  pointer-events: none;
}

.tl-input.tl-placesearch__input {
  padding-left: 36px;
}

.tl-placesearch__spinner {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 999px;
  border: 2px solid var(--tl-border-strong);
  border-top-color: var(--tl-primary);
  animation: tl-trip-spin 0.8s linear infinite;
}

@keyframes tl-trip-spin {
  to {
    transform: rotate(360deg);
  }
}

.tl-placesearch__results {
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--tl-border);
  border-radius: 12px;
  background: var(--tl-surface);
}

.tl-placesearch__result {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* MudBlazor centres every button's content */
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--tl-text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.tl-placesearch__result:hover,
.tl-placesearch__result:focus-visible {
  outline: none;
  background: var(--tl-surface-muted);
  box-shadow: var(--tl-focus-inset);
}

.tl-placesearch__result > svg {
  flex: none;
  color: var(--tl-text-muted);
}

.tl-placesearch__texts {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tl-placesearch__name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-placesearch__detail {
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* v1.7.0: the airline picker (the place search's look) and its code inside the box. */
.tl-placesearch__result.is-active {
  background: var(--tl-surface-muted);
}

/* In the airline list the pointer moves the active row (one highlight, never two): hover adds nothing of its own. */
.tl-airline__results .tl-placesearch__result:hover {
  box-shadow: none;
}

.tl-airline__results .tl-placesearch__result:hover:not(.is-active) {
  background: transparent;
}

.tl-input.tl-airline__input {
  padding-right: 52px;
}

.tl-airline__code {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 8px;
  border-radius: var(--tl-radius-pill);
  background: var(--tl-surface-muted);
  color: var(--tl-text-muted);
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.tl-placesearch__message {
  margin: 0;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

/* Item-type icon tiles (UI spec §2.1). */
.tl-kind-tile {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tl-tint-neutral-bg);
  color: var(--tl-tint-neutral-fg);
}

.tl-kind-tile--violet {
  background: var(--tl-tint-violet-bg);
  color: var(--tl-tint-violet-fg);
}

/* The activity sheet's Delete (Phase 7): a quiet text action in the danger colour, apart from Cancel and Save. */
.tl-sheet .tl-btn.tl-activity-sheet__delete {
  color: var(--tl-danger);
  margin-right: auto;
}

/* Activities (Phase 7): the primary teal, softly. */
.tl-kind-tile--teal {
  background: var(--tl-primary-soft);
  color: var(--tl-primary);
}

.tl-kind-tile--lg {
  width: 40px;
  height: 40px;
}

/* A trip's status chip (Folder, Upcoming, In progress, Completed, Archived): neutral, with an icon. */
.tl-trip-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--tl-radius-pill);
  background: var(--tl-surface-muted);
  color: var(--tl-text-subtle);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.tl-trip-status--inprogress {
  background: var(--tl-primary-soft);
  color: var(--tl-primary);
}

.tl-trip-status--upcoming {
  background: var(--tl-planned-soft);
  color: var(--tl-planned);
}

/* Full-screen sheets on phones (stay, transport, note and checklist forms). */
@media (max-width: 639.98px) {
  .mud-dialog.tl-sheet.tl-sheet--full {
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .mud-dialog.tl-sheet.tl-sheet--full .tl-sheet__handle {
    display: none;
  }
}

/* A list of choices inside a sheet ("Add to Sunday", "Move to day…", "Add to trip"). */
.tl-choice-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tl-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--tl-text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.tl-choice:hover {
  background: var(--tl-surface-muted);
}

.tl-choice:focus-visible {
  outline: none;
  border-color: var(--tl-primary);
  box-shadow: var(--tl-focus-shadow);
}

.tl-choice[aria-current="true"],
.tl-choice:disabled {
  color: var(--tl-text-muted);
  cursor: default;
  background: transparent;
}

.tl-choice__texts {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.tl-choice__title {
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-choice__meta {
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-choice__trailing {
  flex: none;
  color: var(--tl-text-muted);
  font: var(--tl-text-meta);
}

/* Transport ends: name plus a short code column, side by side even on phones. */
.tl-trip-form__row.tl-trip-form__row--code {
  grid-template-columns: minmax(0, 1fr) 104px;
}

/* Checklist editing in its sheet. */
.tl-checklist-edit {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tl-checklist-edit__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tl-checklist-edit__row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 6px;
}

.tl-checklist-edit__add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding-left: 34px;
}

/* Existing-place picker and Add to trip. */
.tl-placepicker,
.tl-addtotrip {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tl-placepicker__empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--tl-border-strong);
  border-radius: 12px;
  color: var(--tl-text-muted);
  font-size: 14px;
}

.tl-addtotrip__new-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

/* Map legend swatches for the trip map and the Transport routes layer. */
.tl-map-swatch--stay::after {
  width: 12px;
  height: 12px;
  background: var(--tl-map-stay);
  box-shadow: 0 0 0 2px var(--tl-map-ring);
}

.tl-map-swatch--route::after {
  width: 18px;
  height: 0;
  border-radius: 0;
  border-top: 3px solid var(--tl-map-route);
}

/* Activity tracks (Phase 7): the primary teal, as map.js draws them. */
.tl-map-swatch--track::after {
  width: 18px;
  height: 0;
  border-radius: 0;
  border-top: 3px solid var(--tl-primary);
}

/* The event sheet's venue (Phase 6b): the picked place as a row with Change. */
.tl-venue {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tl-venue__chosen {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 12px;
  border: 1px solid var(--tl-border);
  border-radius: var(--tl-radius-control);
  background: var(--tl-surface);
}

.tl-venue__texts {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tl-venue__name {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-venue__detail {
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-venue__error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font: var(--tl-text-meta);
  color: var(--tl-danger);
}

.tl-pricefield__per {
  margin-top: -6px;
}

.tl-event-delete {
  align-self: flex-start;
  min-height: 44px;
  font-size: 14px;
}

/* Phase 6c: a transport end's title with the "Home" choice beside it. */
.tl-trip-form__group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tl-chip-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--tl-border-strong);
  border-radius: var(--tl-radius-pill);
  background: var(--tl-surface);
  color: var(--tl-text);
  font: 500 13px/18px var(--tl-font);
  cursor: pointer;
}

.tl-chip-button:hover {
  border-color: var(--tl-text-muted);
}

.tl-chip-button:focus-visible {
  outline: none;
  border-color: var(--tl-primary);
  box-shadow: var(--tl-focus-shadow);
}

.tl-chip-button[aria-pressed="true"] {
  border-color: var(--tl-primary);
  background: color-mix(in srgb, var(--tl-primary) 10%, var(--tl-surface));
}

@media (max-width: 639.98px) {
  .tl-chip-button {
    min-height: 44px;
  }
}

/* Phase 6c review: Add to day's "set your home" line, when no home is set. */
.tl-choice-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0 0;
  font: 400 14px/20px var(--tl-font);
  color: var(--tl-text-muted);
}

.tl-choice-hint svg {
  flex: none;
  margin-top: 2px;
}

.tl-choice-hint a {
  color: var(--tl-primary);
  font-weight: 500;
}

/* A trip in the Trips page's list view (TripRow, v0.8.3): thumb, name, dates and counts, then status and people.
   On phones the status and people move under the text, so the name keeps the row's width. */
.tl-row.tl-trip-row .tl-row__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tl-trip-row__dates,
.tl-trip-row__counts {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-trip-row__status {
  display: flex;
  min-width: 112px;
}

.tl-trip-row__people {
  display: flex;
  justify-content: flex-end;
  min-width: 100px;
}

@media (max-width: 639.98px) {
  .tl-row.tl-trip-row .tl-row__main {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: start;
    column-gap: 12px;
    row-gap: 8px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .tl-row.tl-trip-row .tl-row__leading {
    grid-row: 1 / span 2;
  }

  .tl-row.tl-trip-row .tl-row__aside {
    grid-column: 2;
    justify-content: space-between;
    min-width: 0;
  }

  .tl-trip-row__status,
  .tl-trip-row__people {
    min-width: 0;
  }
}

/* v1.8.0: Info (item sheets) and Trip info: quiet label/value rows, muted meta text, no chrome. */
.tl-iteminfo {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}

.tl-iteminfo__row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
}

.tl-iteminfo dt {
  font: var(--tl-text-meta);
  font-weight: 500;
  color: var(--tl-text-muted);
}

.tl-iteminfo dd {
  margin: 0;
  min-width: 0;
  font: var(--tl-text-meta);
  color: var(--tl-text);
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.tl-iteminfo__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tl-iteminfo__link {
  margin-left: 8px;
  color: var(--tl-primary);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.tl-iteminfo__link:hover {
  text-decoration: underline;
}

.tl-iteminfo__link:focus-visible {
  outline: none;
  border-radius: 4px;
  box-shadow: var(--tl-focus-shadow);
}

.tl-iteminfo--sheet dd {
  font-size: 15px;
  line-height: 23px;
}

@media (max-width: 639px) {
  .tl-iteminfo__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .tl-iteminfo__link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-left: 0;
  }

  .tl-iteminfo dd > span {
    display: block;
  }
}
