/* RubiX traveler UI
   Brand tokens: blue #074ad6 · beige #fff5dd · orange #fe5e32 · Fraunces + Manrope.
   Language: flat warm paper, hairline rules, editorial type, tabular figures. */

:root {
  --blue: #074ad6;
  --blue-deep: #0536a8;
  --beige: #fff5dd;
  --paper: #fffdf6;
  --orange: #fe5e32;
  --orange-deep: #d9441c;
  --green-deep: #6f8320;
  --green-tint: rgba(184, 206, 82, 0.18);

  --ink: #0a1b4a;
  --mute: #5c6478;
  --foam: #ffffff;
  --line: #e9ddc0;
  --sand: #f0e2c0;

  --radius: 12px;
  --radius-lg: 16px;
  --ring: rgba(7, 74, 214, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--beige);
  color: var(--ink);
  font-family: Manrope, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

body {
  min-height: 100vh;
}

::selection {
  background: rgba(7, 74, 214, 0.16);
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.75rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.brand {
  font-family: Fraunces, Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  color: var(--blue);
  text-decoration: none;
}

.brand::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 5px;
  border-radius: 2px;
  background: var(--orange);
}

.brand:hover {
  color: var(--blue-deep);
}

.context {
  color: var(--mute);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  margin: 0;
  text-align: right;
}

.ghost-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--foam);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    color 150ms ease;
}

.ghost-btn:hover {
  border-color: var(--blue);
  color: var(--blue-deep);
}

/* ---------- Layout shell ---------- */

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 1.25rem;
  padding: 1.25rem 1.75rem 1.75rem;
  min-height: calc(100vh - 4rem);
}

.chat-pane,
.trip-pane {
  background: var(--foam);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(10, 27, 74, 0.04);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.chat-pane {
  min-height: 72vh;
}

.chat-scroll {
  flex: 1;
  overflow: auto;
  padding: 1.75rem 1.75rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--sand) transparent;
}

/* ---------- Empty state ---------- */

.empty {
  max-width: 36rem;
  padding: 2.75rem 0.5rem 1rem;
}

.empty-brand {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 0.6rem;
}

.empty h1 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 500;
  font-size: clamp(1.9rem, 3.2vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 0.85rem;
}

.empty p {
  margin: 0;
  color: var(--mute);
  font-size: 1rem;
  max-width: 30rem;
}

.place-picks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.place-card {
  appearance: none;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 0.75rem;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--foam);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.95rem 1.1rem;
  cursor: pointer;
  color: inherit;
  transition:
    border-color 150ms ease,
    transform 150ms ease;
}

.place-card:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
}

.place-card[aria-pressed='true'] {
  border-color: var(--blue);
  background: rgba(7, 74, 214, 0.05);
}

.place-card-name {
  font-family: Fraunces, Georgia, serif;
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.place-card-meta {
  grid-column: 1;
  color: var(--mute);
  font-size: 0.8rem;
}

.place-card-arrow {
  grid-column: 2;
  grid-row: 1 / span 2;
  color: var(--blue);
  font-size: 1.05rem;
}

/* ---------- Composer ---------- */

.composer {
  border-top: 1px solid var(--line);
  padding: 0.85rem 1.1rem 1.05rem;
  background: var(--paper);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.place-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.place-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
  margin-right: 0.15rem;
}

.place-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.place-tag {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--foam);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.32rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease;
}

.place-tag:hover {
  border-color: var(--blue);
  color: var(--blue-deep);
}

.place-tag[aria-pressed='true'] {
  border-color: var(--blue);
  background: rgba(7, 74, 214, 0.07);
  color: var(--blue-deep);
}

.prefs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.pref {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--mute);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.28rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    color 150ms ease,
    background 150ms ease;
}

.pref:hover {
  border-color: var(--blue);
  color: var(--blue-deep);
}

.pref[aria-pressed='true'] {
  border-color: var(--blue);
  background: rgba(7, 74, 214, 0.07);
  color: var(--blue-deep);
}

.composer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: end;
}

textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 0.95rem;
  font: inherit;
  color: var(--ink);
  background: var(--foam);
  min-height: 3rem;
  max-height: 8rem;
  field-sizing: content;
}

textarea:focus {
  outline: 2px solid var(--ring);
  border-color: var(--blue);
}

textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--sand);
}

.send {
  appearance: none;
  border: 0;
  background: var(--orange);
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    background 150ms ease,
    transform 150ms ease;
}

.send:hover {
  background: var(--orange-deep);
}

.send:active {
  transform: scale(0.96);
}

.send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Messages ---------- */

.messages {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.msg {
  max-width: 38rem;
  animation: rise 180ms ease-out;
}

.msg.user {
  align-self: flex-end;
  background: rgba(7, 74, 214, 0.09);
  color: var(--ink);
  padding: 0.7rem 0.95rem;
  border-radius: 14px 14px 4px 14px;
}

.msg.assistant {
  align-self: stretch;
}

.msg.assistant .bubble {
  color: var(--ink);
  font-size: 0.98rem;
}

.msg.assistant .bubble p {
  margin: 0 0 0.7rem;
}

.msg.assistant .bubble p:last-child {
  margin-bottom: 0;
}

.msg.assistant .bubble .bubble-list {
  margin: 0 0 0.7rem;
  padding-left: 1.15rem;
}

.msg.assistant .bubble .bubble-list:last-child {
  margin-bottom: 0;
}

.msg.assistant .bubble .bubble-list li {
  margin: 0.25rem 0;
}

.msg.assistant.loading .loading-bubble {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.8rem 1rem;
  background: var(--beige);
  border-radius: 14px 14px 14px 4px;
}

.loading-bubble .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mute);
  opacity: 0.45;
  animation: pulseDot 1.1s ease-in-out infinite;
}

.loading-bubble .dot:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-bubble .dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pulseDot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}


/* ---------- Experience cards ---------- */

.ranked {
  margin-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.rank-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.3rem 0.8rem;
  align-items: start;
  width: 100%;
  padding: 0.8rem 0.9rem;
  background: var(--foam);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.rank-row:hover {
  border-color: rgba(7, 74, 214, 0.45);
}

.rank-row:focus-within {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.rank-row.selected,
.rank-row.pending {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
  background: rgba(7, 74, 214, 0.03);
}

.rank-row.pending-remove {
  border-color: var(--orange);
  background: rgba(254, 94, 50, 0.05);
}

.rank-check {
  appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  border: 1.5px solid var(--mute);
  border-radius: 5px;
  background: var(--foam);
  flex-shrink: 0;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rank-check::after {
  content: '';
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
  opacity: 0;
}

.rank-row.selected .rank-check,
.rank-row.pending .rank-check,
.rank-row.on-trip .rank-check {
  border-color: var(--blue);
  background: var(--blue);
}

.rank-row.selected .rank-check::after,
.rank-row.pending .rank-check::after,
.rank-row.on-trip .rank-check::after {
  opacity: 1;
}

.rank-row.pending-remove .rank-check {
  border-color: var(--orange);
  background: transparent;
}

.rank-row.pending-remove .rank-check::after {
  opacity: 0;
}

.rank-body {
  min-width: 0;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.rank-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.rank-meta {
  color: var(--mute);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  margin-top: 0.1rem;
}

.rank-avail {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue-deep);
  font-variant-numeric: tabular-nums;
}

.rank-reason {
  grid-column: 1 / -1;
  color: var(--mute);
  font-size: 0.82rem;
}

.rank-side {
  text-align: right;
}

.rank-price {
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rank-status {
  margin-top: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
}

.rank-row.selected .rank-status,
.rank-row.pending .rank-status,
.rank-row.on-trip .rank-status {
  color: var(--blue-deep);
}

.rank-row.pending-remove .rank-status {
  color: var(--orange-deep);
}

.rank-detail {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--line);
  font-size: 0.88rem;
  line-height: 1.5;
}

.rank-detail p {
  margin: 0 0 0.4rem;
}

.rank-detail p:last-child {
  margin-bottom: 0;
}

.rank-detail-meta,
.rank-incs,
.rank-reqs {
  color: var(--mute);
  font-size: 0.8rem;
}

.rank-hint {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--mute);
}

.swap-tips {
  margin-top: 0.8rem;
  padding: 0.65rem 0.85rem;
  border-left: 3px solid var(--green-deep);
  background: var(--green-tint);
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.swap-tips p {
  margin: 0 0 0.4rem;
}

.swap-tips p:last-child {
  margin-bottom: 0;
}

.pending-badge {
  margin: 0 0 0.65rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--blue-deep);
  background: rgba(7, 74, 214, 0.07);
  border-radius: 8px;
}


/* ---------- Itinerary pane ---------- */

.trip-pane {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  align-self: start;
}

.trip-head {
  padding: 1.2rem 1.35rem 0.65rem;
}

.trip-head h2 {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
}

.trip-sub {
  margin: 0.3rem 0 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.trip-body {
  flex: 1;
  overflow: auto;
  padding: 0.75rem 1.35rem 1.1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--sand) transparent;
}

.ghost-day {
  margin-bottom: 1.3rem;
}

.ghost-day span {
  display: block;
  color: var(--mute);
  font-size: 0.85rem;
  margin-bottom: 0.45rem;
}

.ghost-line {
  height: 1px;
  background: var(--sand);
}

.day-block {
  margin-bottom: 1.4rem;
  animation: slideIn 220ms ease-out both;
}

.day-block:nth-child(2) {
  animation-delay: 40ms;
}

.day-block:nth-child(3) {
  animation-delay: 80ms;
}

.day-label {
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.65rem;
  font-variant-numeric: tabular-nums;
}

.timeline {
  position: relative;
  margin-left: 0.3rem;
  padding-left: 1rem;
  border-left: 1px solid var(--sand);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    'time time'
    'title price'
    'reason reason';
  column-gap: 0.75rem;
}

.tl-item::before {
  content: '';
  position: absolute;
  left: -1.2rem;
  top: 0.28rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
}

.tl-time {
  grid-area: time;
  font-size: 0.78rem;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}

.tl-title {
  grid-area: title;
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 0.15rem;
}

.tl-price {
  grid-area: price;
  font-weight: 700;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  margin-top: 0.15rem;
}

.tl-reason {
  grid-area: reason;
  font-size: 0.8rem;
  color: var(--mute);
  margin-top: 0.15rem;
}

.tl-item.tl-free::before {
  background: transparent;
  border: 1.5px dashed var(--mute);
}

.tl-item.tl-free .tl-title {
  font-weight: 500;
  color: var(--mute);
}

.day-subtotal {
  margin-top: 0.2rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--line);
  font-size: 0.8rem;
  color: var(--mute);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.notes {
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: var(--mute);
}

.trip-foot {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 1rem 1.35rem 1.2rem;
}

.total-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
}

.total-main {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 0.2rem;
  transition: opacity 160ms ease;
}

.total-main.tick {
  opacity: 0.45;
}

.total-sub {
  color: var(--mute);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  margin-top: 0.1rem;
}

.checkout-btn {
  appearance: none;
  border: 0;
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: var(--orange);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms ease;
}

.checkout-btn:hover {
  background: var(--orange-deep);
}

.checkout-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.checkout-btn.is-done {
  background: var(--green-deep);
  color: #fff;
}

.checkout-note {
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  color: var(--green-deep);
  line-height: 1.4;
}


/* ---------- Checkout dialog ---------- */

.checkout-dialog {
  border: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  max-width: 22rem;
  width: calc(100% - 2rem);
  background: var(--foam);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(10, 27, 74, 0.28);
}

.checkout-dialog::backdrop {
  background: rgba(10, 27, 74, 0.45);
}

.checkout-sheet {
  margin: 0;
  padding: 1.5rem 1.5rem 1.35rem;
}

.checkout-sheet h2 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.checkout-sheet p {
  margin: 0.65rem 0 0;
  line-height: 1.5;
  font-size: 0.95rem;
}

.checkout-demo-tag {
  color: var(--mute) !important;
  font-size: 0.8rem !important;
}

.checkout-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 1.2rem;
}

.checkout-cancel,
.checkout-confirm {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.checkout-cancel {
  background: var(--sand);
  color: var(--ink);
}

.checkout-confirm {
  background: var(--orange);
  color: #fff;
}

.checkout-confirm:hover {
  background: var(--orange-deep);
}

/* ---------- Misc ---------- */

.trip-fab {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .msg,
  .day-block,
  .total-main,
  .loading-bubble .dot {
    animation: none !important;
    transition: none !important;
  }

  .loading-bubble .dot {
    opacity: 0.7;
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 0.75rem 1rem 5rem;
  }

  .chat-scroll {
    padding: 1.25rem 1.1rem 1rem;
  }

  .empty {
    padding: 1.5rem 0.25rem 1rem;
  }

  .trip-pane {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 70vh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    transform: translateY(110%);
    transition: transform 220ms ease;
    z-index: 5;
    box-shadow: 0 -12px 40px rgba(10, 27, 74, 0.18);
  }

  .trip-pane.open {
    transform: translateY(0);
  }

  .trip-fab {
    display: inline-flex;
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 6;
    border: 0;
    background: var(--blue);
    color: #fff;
    font-weight: 600;
    padding: 0.85rem 1.2rem;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(10, 27, 74, 0.3);
  }

  .topbar {
    padding: 0.75rem 1rem;
  }

  .context {
    font-size: 0.8rem;
  }
}

