
/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --font:      'DM Sans', sans-serif;
  --serif:     'DM Serif Display', serif;
  --bg:        #f5f4f0;
  --surface:   #ffffff;
  --border:    rgba(0,0,0,0.09);
  --border-md: rgba(0,0,0,0.14);
  --text-1:    #1a1814;
  --text-2:    #6b6760;
  --text-3:    #a8a5a0;
  --accent:    #2a7d6e;
  --accent-lt: #e1f5ee;
  --accent-dk: #085041;
  --lia:       #534ab7;
  --lia-lt:    #eeedfe;
  --err:       #a32d2d;
  --err-lt:    #fcebeb;
  --radius:    14px;
  --radius-sm: 9px;
  --header-h:  56px;
  --toolbar-h: 48px;
}

html, body {
  height: 100%; width: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  font-size: 15px;
  overflow: hidden;   /* app shell handles its own scroll */
}

/* ── APP SHELL: two-column on desktop, stacked on mobile ── */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;

  margin: 0 auto;
}

/* ── TOP HEADER ── */
.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 100;
}
.header-brand {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--text-1);
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.header-brand span { color: var(--accent); }
.header-spacer { flex: 1; }

/* Language picker */
.lang-select {
  font-family: var(--font);
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-1);
  cursor: pointer;
  outline: none;
  max-width: 160px;
}
.lang-select:focus { border-color: var(--accent); }

/* Header icon buttons */
.hdr-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-md);
  background: var(--bg);
  color: var(--text-2);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  position: relative;
}
.hdr-btn:hover { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); }
.hdr-btn.danger:hover { background: var(--err-lt); border-color: var(--err); color: var(--err); }

/* Share dropdown */
.share-wrap { position: relative; }
.share-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
  min-width: 170px;
  z-index: 999;
  overflow: hidden;
}
.share-dropdown.open { display: block; }
.share-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-1);
  cursor: pointer;
  transition: background 0.12s;
}
.share-item:hover { background: var(--bg); }
.share-item i { font-size: 15px; color: var(--text-2); width: 16px; }

/* ── PROMPT BAR ── */
.prompt-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.prompt-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-1);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.prompt-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42,125,110,0.12);
  background: #fff;
}
.prompt-input::placeholder { color: var(--text-3); }
.send-btn {
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.send-btn:hover { background: var(--accent-dk); }
.send-btn:active { transform: scale(0.97); }
.send-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ── MAIN BODY: two columns ── */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── LEFT PANE (itinerary + Lia) ── */
.left-pane {
  width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.left-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scroll-behavior: smooth;
}
.left-scroll::-webkit-scrollbar { width: 4px; }
.left-scroll::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 4px; }

/* ── ITINERARY CONTENT ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  gap: 12px;
  color: var(--text-3);
  min-height: 200px;
}
.empty-icon {
  font-size: 40px;
  opacity: 0.4;
}
.empty-title { font-size: 15px; font-weight: 500; color: var(--text-2); }
.empty-sub   { font-size: 13px; line-height: 1.5; max-width: 240px; }
.empty-examples { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.example-chip {
  padding: 7px 14px;
  border-radius: 99px;
  border: 1px solid var(--border-md);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
  text-align: left;
}
.example-chip:hover {
  background: var(--accent-lt);
  border-color: var(--accent);
  color: var(--accent);
}

/* Spinner */
.spinner-wrap {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 16px;
  color: var(--text-2);
  font-size: 14px;
}
.spinner-wrap.visible { display: flex; }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-md);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Itinerary day blocks */
.day-block {
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.day-header {
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.day-activities { padding: 8px 0; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 14px;
  font-size: 13.5px;
  color: var(--text-1);
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.activity-item:last-child { border-bottom: none; }
.activity-item.clickable { cursor: pointer; }
.activity-item.clickable:hover { background: var(--accent-lt); }
.activity-item.clickable .activity-text { color: var(--accent); }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 5px;
  flex-shrink: 0;
}
.activity-item.clickable .activity-dot { background: var(--accent); }

/* Cultural notes block */
.notes-block {
  margin-bottom: 18px;
  background: #fdf9f0;
  border: 1px solid #f0d9a0;
  border-radius: var(--radius);
  overflow: hidden;
}
.notes-header {
  padding: 10px 14px;
  background: #f5c842;
  color: #3a2800;
  font-size: 13px;
  font-weight: 600;
}
.notes-list { padding: 8px 0; }
.note-item {
  display: flex;
  gap: 10px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-1);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  line-height: 1.45;
}
.note-item:last-child { border-bottom: none; }
.note-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #c8990a;
  margin-top: 6px;
  flex-shrink: 0;
}

/* ── LIA CHAT ── */
.lia-pane {
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: none;   /* shown after first itinerary */
}
.lia-pane.visible { display: flex; flex-direction: column; }
.lia-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--lia-lt);
  border-bottom: 1px solid rgba(83,74,183,0.15);
  font-size: 13px; font-weight: 500;
  color: var(--lia);
}
.lia-header i { font-size: 15px; }
.lia-messages {
  height: 160px;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
}
.lia-messages::-webkit-scrollbar { width: 3px; }
.lia-messages::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 3px; }
.lia-msg {
  max-width: 90%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
}
.lia-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.lia-msg.lia {
  align-self: flex-start;
  background: var(--lia-lt);
  color: var(--text-1);
  border-bottom-left-radius: 3px;
}
.lia-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.lia-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.lia-input:focus { border-color: var(--lia); }
.lia-send-btn {
  padding: 8px 14px;
  background: var(--lia);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.lia-send-btn:hover { background: var(--accent-dk); background: #3c3489; }
.lia-spinner {
  display: none;
  padding: 4px 14px;
  font-size: 12px;
  color: var(--text-3);
  display: none;
  align-items: center;
  gap: 6px;
}
.lia-spinner.visible { display: flex; }
.lia-spinner-dot {
  width: 14px; height: 14px;
  border: 1.5px solid var(--border-md);
  border-top-color: var(--lia);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

/* ── RIGHT PANE (map) ── */
.right-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
#map {
  flex: 1;
  width: 100%;
  z-index: 1;
}

/* Map toolbar */
.map-toolbar {
  height: var(--toolbar-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.map-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-md);
  background: var(--bg);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12.5px;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.map-btn i { font-size: 14px; }
.map-btn:hover { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); }
.map-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.map-spacer { flex: 1; }
.map-info {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}
.activity-coords {
  font-size: 11px;
  color: var(--muted, #888);
  margin-top: 2px;
}
/* ── MOBILE: stacked layout ── */
@media (max-width: 700px) {
  html, body { overflow: auto; }
  .app { height: auto; overflow: visible; }
  .app-body { flex-direction: column; overflow: visible; }
  .left-pane { width: 100%; border-right: none; border-bottom: 1px solid var(--border); overflow: visible; }
  .left-scroll { overflow: visible; flex: none; }
  .right-pane { height: 360px; flex-shrink: 0; }
  .lang-select { max-width: 120px; font-size: 12px; }
  .header-brand { font-size: 16px; }
  .prompt-input { font-size: 13px; }
}
