/* trips.css — Chamaps Phase 4: trips strip in group chats, trip panel (days / people / fit check),
   kind:'trip' chat bubbles and the planner "Add to trip" arming notice.
   Reuses tokens and classes from style.css / community.css / routes.css (.trip .trip__h .trip__b .trip__dot …). */

/* ---------- Trips strip (under "Trip list" in a group chat) ---------- */
.trips .trip__b { gap: 4px; }
.trips__row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; width: 100%; padding: 6px 6px 6px 4px; border-radius: var(--r-sm); text-align: left; color: inherit; background: none; font: inherit; }
.trips__row:hover { background: rgba(255,255,255,.05); }
.trips__row:hover .trips__n { color: var(--accent); }
.trips__t { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.trips__n { font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .15s var(--ease); }
.trips__s { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trips__go { color: var(--muted); font-size: 16px; line-height: 1; padding-right: 2px; }
.trips__new { padding: 2px 0 4px; }
.trips-new { padding: 6px 2px 8px; }
.trips-new .cmty-form__row { grid-template-columns: 1fr 1fr; }

/* ---------- Trip panel ---------- */
.trips-panel { gap: 14px; }
.trips-panel > * { flex: none; } /* .panel is a flex column — never squash the day tabs or sections */
.trips-head { display: flex; flex-direction: column; gap: 8px; }
.trips-head .cmty-back { font-size: 12.5px; }
.trips-title { display: flex; flex-direction: column; gap: 6px; }
.trips-title .panel__title { font-size: 20px; line-height: 1.15; overflow-wrap: anywhere; }
.trips-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; color: var(--text-2); font-size: 12.5px; }
.trips-meta .cmty-pill .trip__dot { background: var(--c, var(--accent)); width: 7px; height: 7px; }
.trips-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trips-editpill { cursor: pointer; border: 0; font: inherit; font-size: 11px; font-weight: 600; transition: filter .15s var(--ease); }
.trips-editpill:hover { filter: brightness(1.15); }
.trips-avs { display: flex; margin-left: auto; }
.trips-av .cmty-av { box-shadow: 0 0 0 2px rgba(14,19,24,.95); }
.trips-av + .trips-av { margin-left: -8px; }
.trips-av.is-empty .cmty-av { opacity: .45; filter: grayscale(.6); }
.trips-del { width: 30px; height: 30px; color: var(--muted); }
.trips-del:hover { color: var(--danger); }
.trips-del svg { width: 15px; height: 15px; }
.trips-live { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); min-height: 18px; }
.trips-live[hidden] { display: none; }
.trips-live__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hz-low); box-shadow: 0 0 0 3px rgba(61,220,132,.2); flex: none; animation: tripsPulse 1.6s ease-in-out infinite; }
@keyframes tripsPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.trips-seg .seg__btn small { font-size: 10.5px; color: var(--muted); }
.trips-seg .seg__btn.is-active small { color: var(--accent); }

/* Day tabs */
.tdays { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; scrollbar-color: var(--bg-3) transparent; }
.tday { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 64px; padding: 7px 10px 6px; border-radius: var(--r-md); border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--text-2); text-align: left; position: relative; overflow: hidden; transition: border-color .15s var(--ease), background .15s var(--ease); }
.tday::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); opacity: .35; }
.tday.is-planned::before { opacity: 1; }
.tday b { font-size: 12.5px; font-weight: 600; color: var(--text); }
.tday small { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.tday:hover { border-color: var(--line-strong); background: rgba(255,255,255,.06); }
.tday.is-active { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.tday.is-active small { color: var(--text-2); }

/* Active day editor */
.trips-day { display: flex; flex-direction: column; gap: 12px; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--line); border-left: 3px solid var(--c); background: rgba(255,255,255,.025); }
.trips-day__h { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.trips-day__h b { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.trips-day__h .btn { margin-left: auto; }
.trips-day__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.trips-day__f { grid-template-columns: 1fr 120px; }
.trips-day .field input, .trips-day .field textarea { width: 100%; }
.trips-day .field textarea { min-height: 56px; }
.trips-day .field input[disabled], .trips-day .field textarea[disabled] { opacity: .7; cursor: not-allowed; }
.trips-route { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); border: 1px dashed var(--line-strong); font-size: 12.5px; color: var(--text-2); min-height: 38px; }
.trips-route.is-set { border-style: solid; border-color: color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 8%, transparent); }
.trips-route .trip__dot { background: var(--c); }
.trips-route__n { flex: 1; min-width: 0; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trips-route .btn--sm { height: 28px; padding: 0 10px; font-size: 12px; }
.trips-route .iconbtn { width: 28px; height: 28px; }
.trips-route .iconbtn svg { width: 14px; height: 14px; }
.trips-attach { flex-wrap: wrap; gap: 6px; }
.trips-attach .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trips-attach .btn.is-on { background: var(--bg-3); color: var(--text); }
.trips-mine { max-height: 200px; overflow-y: auto; scrollbar-width: thin; padding-right: 2px; }
.trips-stats { grid-template-columns: repeat(4, 1fr); }
.trips-stats .stat__l em { font-style: normal; color: var(--accent); font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em; margin-left: 3px; }
.trips-hours { display: flex; flex-direction: column; gap: 4px; }
.trips-hours__h { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 2px; }
.trips-hours__r { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--r-sm); font-size: 12.5px; }
.trips-hours__r:hover { background: rgba(255,255,255,.04); }
.trips-hours__r.is-over .trips-hours__v { color: #f5dc72; }
.trips-hours__n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trips-hours__v { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

.trips-noele { color: var(--hz-moderate); }

/* Flags */
.tflags { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tflag { display: flex; align-items: flex-start; gap: 8px; padding: 7px 10px; border-radius: var(--r-sm); font-size: 12.5px; line-height: 1.4; color: var(--text-2); background: rgba(255,255,255,.035); border-left: 3px solid var(--muted); }
.tflag b { color: var(--text); font-weight: 600; }
.tflag__s { flex: none; font-size: 10px; line-height: 17px; color: var(--muted); }
.tflag--warn { border-left-color: var(--hz-moderate); background: rgba(250,204,21,.08); }
.tflag--warn .tflag__s { color: var(--hz-moderate); }
.tflag--stop { border-left-color: var(--hz-high); background: rgba(255,71,71,.1); color: var(--text); }
.tflag--stop .tflag__s { color: var(--hz-high); }
.tflags__g { display: flex; flex-direction: column; gap: 6px; }
.tflags__h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.trips-fit, .trips-people { padding-top: 0; border-top: 0; }
.trips-disc { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* People */
.trips-person { display: flex; flex-direction: column; gap: 8px; }
.trips-person .cmty-row { align-items: flex-start; }
.trips-person .cmty-row__s { white-space: normal; line-height: 1.4; }
.trips-person.is-empty .cmty-row__s { color: var(--hz-moderate); }
.trips-person .cmty-row__a { flex-wrap: wrap; justify-content: flex-end; max-width: 46%; }
.trips-person.is-editing > .cmty-row { border-color: var(--line-strong); background: rgba(255,255,255,.05); }
.trips-profile { padding: 4px 4px 8px; }
.trips-form3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.trips-form3 .field__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trips-expl { margin-top: -6px; }
.trips-derive { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trips-derive .hint { flex: 1; min-width: 160px; }

/* ---------- Chat bubble (kind: 'trip') ---------- */
.msg--trip { max-width: 92%; }
.msg--trip .msg__b.trips-bubble { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 500; text-align: left; cursor: pointer; transition: background .15s var(--ease), border-color .15s var(--ease); }
.msg--trip .trips-bubble:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); border-color: var(--accent); }
.msg--trip .trips-bubble[disabled] { cursor: default; }
.trips-bubble__i { color: var(--accent); font-size: 14px; line-height: 1; }

/* ---------- Planner arming notice ---------- */
.trips-arm { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-md); border: 1px solid rgba(61,220,132,.4); background: rgba(61,220,132,.07); font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
.trips-arm b { color: var(--text); font-weight: 600; }
.trips-arm span:nth-child(2) { flex: 1; min-width: 0; }
#tripAddBtn { white-space: nowrap; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .trips-stats { grid-template-columns: repeat(2, 1fr); }
  .trips-day__f { grid-template-columns: 1fr; }
  .trips-form3 { grid-template-columns: 1fr 1fr; }
  .trips-person .cmty-row { flex-wrap: wrap; }
  .trips-person .cmty-row__a { max-width: 100%; width: 100%; justify-content: flex-start; padding-left: 40px; }
  .trips-title .panel__title { font-size: 18px; }
  .trips-avs { margin-left: 0; }
}
@media (max-width: 420px) {
  .trips-form3 { grid-template-columns: 1fr; }
  .trips-new .cmty-form__row { grid-template-columns: 1fr; }
}
/* Trip delete armed state — first tap arms, second tap deletes */
.trips-del.is-armed { color: #ff6b7a; background: rgba(255,107,122,.12); box-shadow: inset 0 0 0 1px rgba(255,107,122,.35); }
