/**
 * Reisen planen — the trip builder.
 *
 * Mobile first: one column, nothing wider than the screen, no sideways scrolling, tap targets
 * at least 44px, and the bottom padding keeps the iPhone bar off the last row. The collected
 * values are cards, one per section, so the format stays readable on a phone.
 */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: fixed;
  inset: 0;
  font-family: 'Patrick Hand', cursive, Arial, sans-serif;
  background: #010156;
  color: #fff;
}

body {
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── the top bar ─────────────────────────────────────────────────────────── */
#bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  min-height: 54px;
}

#bar-title {
  flex: 1 1 auto;
  margin: 0;
  font-size: 21px;
  font-weight: normal;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#bar-actions { display: flex; gap: 6px; }

.bar-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 17px;
  text-decoration: none;
  cursor: pointer;
}

.bar-btn:active { background: rgba(255, 255, 255, 0.2); }
.bar-btn.danger { color: #ff8080; }

/* ── the tabs ────────────────────────────────────────────────────────────── */
#tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 0 12px 6px;
  max-width: 744px;
  width: 100%;
  margin: 0 auto;
}

.tab {
  flex: 1 1 0;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  cursor: pointer;
}

.tab.current {
  background: #00ff00;
  color: #010156;
}

/* ── a trip's own page ───────────────────────────────────────────────────── */
#detail .head { margin: 4px 0 10px; }
#detail .head h2 { margin: 0; font-size: 22px; font-weight: normal; }

/* ── the scrolling stage ─────────────────────────────────────────────────── */
#stage {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 4px 12px 12px;
}

.view { max-width: 720px; margin: 0 auto; }

.hint { opacity: 0.7; font-size: 15px; line-height: 1.45; }

/* ── a trip card ─────────────────────────────────────────────────────────── */
.trip {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 10px 0;
}

.trip h2 { margin: 0 0 4px; font-size: 19px; font-weight: normal; }
.trip .line { font-size: 15px; line-height: 1.5; opacity: 0.92; overflow-wrap: anywhere; }
.trip .badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 255, 0, 0.16);
  color: #9dff9d;
  font-size: 14px;
}

/* ── the conversation ────────────────────────────────────────────────────── */
.msg {
  max-width: 88%;
  margin: 10px 0;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 16px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.assistant { background: rgba(255, 255, 255, 0.1); border-bottom-left-radius: 4px;
  /* room in the top-right corner for the copy button */
  position: relative; padding-right: 2.9rem;
}

/* Copy button on every AI reply. Its own button (not a whole-bubble tap, which
   would fight with scrolling) with a finger-sized target. */
.copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(255, 255, 255, 0.16);
  border: 0;
  border-radius: 0.5rem;
  color: #eaeaea;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.copy-btn:active { background: rgba(255, 255, 255, 0.34); }
.copy-btn.copied { background: #9dff9d; color: #06301f; }
.msg.user { background: #011fb7; margin-left: auto; border-bottom-right-radius: 4px; }
.msg.error { background: rgba(255, 80, 80, 0.22); }

.typing { opacity: 0.6; font-style: italic; }

/* ── what was collected ──────────────────────────────────────────────────── */
#collected {
  flex: 0 0 auto;
  max-height: 46vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.25);
  padding: 8px 12px;
}

#collected-body { max-width: 720px; margin: 0 auto; }

.sec { margin: 8px 0; }
.sec > .sec-head { font-size: 15px; opacity: 0.85; margin-bottom: 4px; }
.sec .row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 15px;
  padding: 3px 0;
  overflow-wrap: anywhere;
}
.sec .row .val { opacity: 0.95; }

/* ── the composer ────────────────────────────────────────────────────────── */
#composer {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}

#input {
  flex: 1 1 auto;
  min-height: 46px;
  max-height: 132px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  resize: none;
}

#input::placeholder { color: rgba(255, 255, 255, 0.55); }

#btn-send {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border: 0;
  border-radius: 14px;
  background: #00ff00;
  color: #010156;
  font-size: 18px;
  cursor: pointer;
}

#btn-send[disabled] { opacity: 0.45; }

.primary {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 10px auto 4px;
  border: 0;
  border-radius: 14px;
  background: #00ff00;
  color: #010156;
  font-family: inherit;
  font-size: 17px;
  cursor: pointer;
}

/* ── a conversation row ──────────────────────────────────────────────────── */
.convo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 8px 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 16px;
}
.convo .grow { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo.current { outline: 2px solid #00ff00; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: 88vw;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.85);
  font-size: 15px;
  text-align: center;
  z-index: 50;
}

/* the detail view reuses the collected-card look, one section per card */
#detail .sec {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 10px 14px;
}

.warn {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 170, 0, 0.16);
  border: 1px solid rgba(255, 170, 0, 0.4);
  color: #ffd79a;
  font-size: 15px;
  line-height: 1.4;
}

/* ── search inside one trip ──────────────────────────────────────────────── */
#detail-search-wrap {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 10px;
  background: #010156;
}

#detail-search-wrap > i { opacity: 0.7; font-size: 15px; }

#detail-search {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

#detail-search::placeholder { color: rgba(255, 255, 255, 0.5); }
#detail-search::-webkit-search-cancel-button { display: none; }

#detail-search-clear {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}

.sec .row.hit { background: rgba(0, 255, 0, 0.12); border-radius: 8px; }
.sec .row.hit .val { font-weight: bold; }
#detail .no-hits { padding: 14px 4px; opacity: 0.8; }
#detail .hit-count { font-size: 14px; opacity: 0.75; margin: 0 0 6px; }

/* ── editing a value in place ─────────────────────────────────────────────── */
.val.editable {
  cursor: text;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.45);
  padding-bottom: 1px;
}
.val.editable::after {
  content: ' ✎';
  font-size: 12px;
  opacity: 0.55;
}
.row-edit {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 6px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 16px;      /* 16px keeps iOS from zooming the page when it is focused */
  color: #101010;
  background: #fdfcf7;
  border: 2px solid #2f6f4f;
  border-radius: 6px;
}

/* ── the empty columns live behind a tap ──────────────────────────────────── */
.more-fields {
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  padding-top: 10px;
}
.more-fields > summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 4px;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: #cfe9d8;
  font-size: 16px;
}
.more-fields > summary::-webkit-details-marker { display: none; }
.more-fields[open] > summary { color: #ffffff; }

/* a value the user changed by hand is marked as theirs */
.key.mine::after { content: ' ✎'; color: #9dff9d; }


/* ── the trip to-do list ─────────────────────────────────────────────────── */
/* The places the voice guide put on the list. Same glass cards as a trip, so the
   page looks like one thing. Long addresses wrap instead of pushing the page
   sideways - the map and settings pages must never scroll left to right. */
.todo-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 10px 12px;
  margin: 10px 0;
  overflow-wrap: anywhere;
}
.todo-card.done { opacity: 0.55; }
.todo-card.done .todo-name { text-decoration: line-through; }

.todo-head { display: flex; align-items: center; gap: 8px; }

.todo-tick,
.todo-del {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: inherit;
  font-size: 19px;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  opacity: 0.9;
}
.todo-tick { color: #9dff9d; }
.todo-del { opacity: 0.6; }
.todo-del:active { opacity: 1; }

.todo-name {
  flex: 1 1 auto;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-size: 17px;
  text-align: left;
  padding: 4px 0;
  cursor: pointer;
}

.todo-meta { margin: 4px 0 0; font-size: 13.5px; opacity: 0.75; }
.todo-addr, .todo-notes { margin: 4px 0 0; font-size: 14.5px; line-height: 1.45; opacity: 0.9; }
.todo-notes { font-style: italic; opacity: 0.8; }

.todo-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.todo-nav-btn {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 255, 0, 0.14);
  color: #9dff9d;
  font-size: 14px;
  text-decoration: none;
}
.todo-nav-btn:active { background: rgba(0, 255, 0, 0.26); }

/* mini icons on a to-do card, and the form behind the pencil */
.todo-icon {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: inherit;
  font-size: 15px;
  line-height: 1;
  padding: 6px 7px;
  cursor: pointer;
  opacity: 0.6;
}
.todo-icon:active { opacity: 1; }
.todo-del { color: #ff9d9d; }

.todo-card.editing { padding: 12px; }
.todo-edit { display: block; }
.todo-edit-row { display: block; margin: 0 0 9px; }
.todo-edit-row > span {
  display: block;
  font-size: 13px;
  opacity: 0.75;
  margin-bottom: 3px;
}
.todo-edit-row input,
.todo-edit-row select,
.todo-edit-row textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  color: inherit;
  font: inherit;
  font-size: 16px;
  padding: 9px 10px;
}
.todo-edit-row textarea { resize: vertical; }
.todo-edit-actions { display: flex; gap: 8px; margin-top: 4px; }
.todo-save, .todo-cancel {
  flex: 1 1 auto;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.todo-save { background: rgba(0, 255, 0, 0.18); border-color: rgba(0, 255, 0, 0.35); color: #9dff9d; }
.todo-save[disabled] { opacity: 0.5; }

/* one mini-icon and one small form for both card types (trips and to-do) */
.mini-icon {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: inherit;
  font-size: 15px;
  line-height: 1;
  padding: 6px 7px;
  cursor: pointer;
  opacity: 0.6;
}
.mini-icon:active { opacity: 1; }
.mini-del { color: #ff9d9d; }

.trip-top { display: flex; align-items: flex-start; gap: 6px; }
.trip-top h2 { flex: 1 1 auto; }

.form-body { display: block; }
.form-row { display: block; margin: 0 0 9px; }
.form-row > span { display: block; font-size: 13px; opacity: 0.75; margin-bottom: 3px; }
.form-row input,
.form-row textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  color: inherit;
  font: inherit;
  font-size: 16px;
  padding: 9px 10px;
}
.form-row textarea { resize: vertical; }
.form-actions { display: flex; gap: 8px; margin-top: 4px; }
.form-save, .form-cancel {
  flex: 1 1 auto;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.form-save { background: rgba(0, 255, 0, 0.18); border-color: rgba(0, 255, 0, 0.35); color: #9dff9d; }
.form-save[disabled] { opacity: 0.5; }
.trip.editing { cursor: default; }

/* coverage, the generate button and its progress bar */
.trip-cover { margin-top: 8px; font-size: 14px; opacity: 0.85; }
.cover-bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin: 4px 0 2px;
}
.cover-fill { height: 100%; background: rgba(0, 255, 0, 0.55); }

.trip-generate {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 255, 0, 0.35);
  background: rgba(0, 255, 0, 0.16);
  color: #9dff9d;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.trip-generate[disabled] { opacity: 0.6; }

.trip-progress { margin-top: 9px; }
.trip-progress-bar {
  height: 6px;
  width: 0;
  border-radius: 999px;
  background: #9dff9d;
  transition: width 0.4s ease;
}
.trip-progress-label { display: block; margin-top: 4px; font-size: 13.5px; opacity: 0.85; }

/* the manual form */
.hotel-result {
  margin: 6px 0 2px;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  opacity: 0.95;
}
.form-find {
  flex: 1 1 auto;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.form-chat {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: none;
  color: inherit;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

/* the way to a place, under its name - and no coordinates anywhere */
.nav-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.nav-link {
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(0, 255, 0, 0.35);
  background: rgba(0, 255, 0, 0.14);
  color: #9dff9d;
  font-size: 14px;
  text-decoration: none;
}
.nav-link:active { background: rgba(0, 255, 0, 0.26); }

/* the list of places that answer to what is being typed - a list, not a dropdown box */
.suggest {
  margin: -4px 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}
.suggest-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:active { background: rgba(0, 255, 0, 0.12); }
.suggest-name { display: block; font-size: 15px; }
.suggest-sub { display: block; font-size: 12.5px; opacity: 0.7; margin-top: 2px; }

/* the line that says a trip is selected for the voice guide */
.trip-selected {
  margin: 0 12px 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 255, 0, 0.3);
  background: rgba(0, 255, 0, 0.10);
  font-size: 14px;
  line-height: 1.5;
}
.trip-selected a { color: #9dff9d; }
.trip-unselect {
  margin-left: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.guide-pin-hotel span { font-size: 22px; line-height: 1; }

/* the way from a trip straight to the guide at its hotel */
.detail-map {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(0, 255, 0, 0.4);
  background: rgba(0, 255, 0, 0.14);
  color: #9dff9d;
  font-size: 18px;
  text-decoration: none;
  flex: 0 0 auto;
}
.detail-map:active { background: rgba(0, 255, 0, 0.28); }
#detail h2, #view-detail h2 { display: flex; align-items: center; gap: 10px; }

/* the whole row is the tap target for editing, with a real save button for fingers */
.row-editable { cursor: pointer; }
.row-editable .val { text-decoration: underline dotted rgba(255, 255, 255, 0.35); }
.row-ok {
  flex: 0 0 auto;
  margin-left: 6px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(0, 255, 0, 0.5);
  background: rgba(0, 255, 0, 0.2);
  color: #b6ffb6;
  font-size: 15px;
  cursor: pointer;
}
.row-edit { min-height: 34px; }

/* what the generate button really does: it starts over, it does not top up */
.trip-generate-note {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.35;
  opacity: 0.75;
}

/* what a placeholder cannot say - the code field above all */
.form-hint {
  margin: -2px 0 8px;
  font-size: 11.5px;
  line-height: 1.35;
  opacity: .72;
}
