/* urbanXplorer itinerary state stabilization — mobile-first UAT */

.itinerary-strip.collapsed {
  top: var(--route-feedback-offset, 76px);
  left: -18px;
  right: auto;
  width: 58px;
  min-width: 58px;
  max-width: 58px;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  display: flex;
  align-items: stretch;
  border-radius: 0 24px 24px 0;
  overflow: visible;
}

.itinerary-strip.collapsed .itinerary-toggle {
  width: 58px;
  min-width: 58px;
  max-width: 58px;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  flex: 0 0 58px;
  border: 0;
  border-radius: 0 24px 24px 0;
  background: rgba(255,255,255,.96);
  box-shadow: 0 8px 20px rgba(15,23,42,.14), inset 0 1px 0 rgba(255,255,255,.9);
}

.itinerary-strip.collapsed .itinerary-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-size: 22px;
  line-height: 1;
  transform: translateX(8px);
}

.itinerary-strip.collapsed .itinerary-header,
.itinerary-strip.collapsed .itinerary-timeline-wrap,
.itinerary-strip.collapsed .itinerary-detail-panel {
  display: none !important;
}

.itinerary-strip:not(.collapsed) {
  top: var(--route-feedback-offset, 76px);
  bottom: auto;
  left: 12px;
  right: 12px;
  width: auto;
  height: auto;
  max-height: calc(100dvh - 88px);
  display: grid;
  grid-template-columns: 44px minmax(0,1fr);
  grid-template-areas:
    "toggle header"
    "timeline timeline"
    "detail detail";
  align-items: stretch;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 14px 40px rgba(15,23,42,.16);
}

.itinerary-strip:not(.collapsed) .itinerary-toggle {
  grid-area: toggle;
  width: 44px;
  min-width: 44px;
  height: 58px;
  flex: none;
  border: 0;
  border-right: 1px solid rgba(51,65,85,.08);
  border-radius: 24px 0 0 0;
  background: rgba(255,255,255,.68);
}

.itinerary-strip:not(.collapsed) .itinerary-header {
  grid-area: header;
  width: auto;
  min-width: 0;
  height: 58px;
  padding: 0 10px 0 14px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-right: 0;
  border-bottom: 1px solid rgba(51,65,85,.07);
}

.itinerary-strip:not(.collapsed) .itinerary-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 700;
  color: #1E293B;
  letter-spacing: -.01em;
}

.itinerary-strip:not(.collapsed) .itinerary-expand {
  position: static;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(51,65,85,.10);
  border-radius: 12px;
  background: rgba(255,255,255,.82);
  color: #0D9488;
  font-size: 18px;
  line-height: 1;
}

.itinerary-strip:not(.collapsed) .itinerary-timeline-wrap {
  grid-area: timeline;
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  border-bottom: 1px solid rgba(51,65,85,.07);
}

.itinerary-strip:not(.collapsed) .itinerary-timeline {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px 14px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.itinerary-event {
  flex: 0 0 min(76vw, 292px);
  min-width: 0;
  max-width: 292px;
  padding: 14px 15px;
  border-radius: 20px;
  border: 1px solid rgba(13,148,136,.16);
  background: rgba(255,255,255,.80);
  box-shadow: 0 8px 22px rgba(15,23,42,.07);
  font-family: var(--font-family);
}

.itinerary-event.selected,
.itinerary-event.active {
  border-color: rgba(13,148,136,.48);
  background: linear-gradient(145deg, rgba(240,253,250,.98), rgba(204,251,241,.68));
  box-shadow: 0 10px 26px rgba(13,148,136,.12), inset 0 3px 0 rgba(13,148,136,.78);
}

.itinerary-event-time {
  margin-bottom: 6px;
  color: #0F766E;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: .015em;
}

.itinerary-event-title {
  color: #0F172A;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -.015em;
}

.itinerary-event-content {
  margin-top: 7px;
  color: #64748B;
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.itinerary-event-tool-row {
  margin-top: 10px;
}

.itinerary-event-tool,
.itinerary-event-note,
.itinerary-event-attachment {
  font-family: var(--font-family);
}

.itinerary-detail-panel {
  grid-area: detail;
  min-width: 0;
  max-height: min(38dvh,330px);
  overflow-y: auto;
  background: rgba(248,250,252,.72);
}

.itinerary-detail-panel[hidden] { display: none !important; }

.itinerary-detail-inner {
  padding: 16px 18px 20px;
  font-family: var(--font-family);
}

.itinerary-detail-time {
  margin-bottom: 5px;
  color: #0F766E;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.itinerary-detail-title {
  margin: 0 0 7px;
  color: #0F172A;
  font-family: var(--font-family);
  font-size: clamp(19px,5.2vw,23px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.025em;
}

.itinerary-detail-location {
  color: #64748B;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.itinerary-detail-content {
  margin-top: 12px;
  color: #475569;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.itinerary-strip.fullscreen {
  top: max(12px, env(safe-area-inset-top));
  bottom: max(12px, env(safe-area-inset-bottom));
  max-height: none;
  height: auto;
}

.itinerary-strip.fullscreen .itinerary-timeline-wrap {
  min-height: 0;
  max-height: none;
}

.itinerary-strip.fullscreen .itinerary-timeline {
  flex-direction: row;
  overflow-x: auto;
  overflow-y: hidden;
}

.itinerary-strip.fullscreen .itinerary-detail-panel { max-height: none; }

@media (max-width:600px) {
  .itinerary-strip:not(.collapsed) {
    left: 12px;
    right: 12px;
    border-radius: 24px;
  }

  .itinerary-event { flex-basis: min(76vw,292px); }
  .itinerary-detail-inner { padding: 14px 16px 18px; }
}
