/* =============================================================================
   Reset & base
   ============================================================================= */

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

html,
body {
  margin: 0;
  padding: 0;
  background: #ececec;
  color: #0d0d0d;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* =============================================================================
   App shell — fills the viewport on every breakpoint.
   Chat content inside is constrained to a readable column.
   ============================================================================= */

html,
body {
  background: #ffffff;
}

.app {
  --header-h: 52px;
  --composer-h: 112px;
  --content-max: 760px; /* max width of message column on desktop */
  background: #fff;
  color: #0d0d0d;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
}

/* =============================================================================
   Header
   ============================================================================= */

.chat-header {
  height: var(--header-h);
  padding: 0 12px;
  padding-top: env(safe-area-inset-top);
  height: calc(var(--header-h) + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #eee;
  background: #fff;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.chat-title {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 17px;
  font-weight: 600;
  color: #0d0d0d;
  padding: 6px 8px;
  border-radius: 10px;
}
.chat-title:hover {
  background: #f4f4f4;
}
.chat-title .chevron {
  width: 18px;
  height: 18px;
  color: #8e8e8e;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #e5e5e5;
  font-size: 13px;
  font-weight: 500;
  color: #0d0d0d;
}
.share-btn:hover {
  background: #f8f8f8;
}
.share-btn svg {
  width: 16px;
  height: 16px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ff7a3d;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* =============================================================================
   Scrollable chat body
   ============================================================================= */

.chat-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 16px 24px;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* =============================================================================
   Message bubbles
   ============================================================================= */

.msg {
  display: flex;
  width: 100%;
}

.msg-user {
  justify-content: flex-end;
}

.user-bubble {
  max-width: 85%;
  background: #f4f4f4;
  color: #0d0d0d;
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.msg-assistant {
  gap: 10px;
  align-items: flex-start;
}

.assistant-avatar {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e5e5e5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.assistant-avatar svg {
  width: 18px;
  height: 18px;
}
.avatar-slot {
  visibility: hidden;
}

.msg-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: #0d0d0d;
}

/* Typing indicator */
.msg-typing .msg-body {
  padding-top: 4px;
}
.typing-dots {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b4b4b4;
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

/* Animated dots appended inline to "Processing…" text */
.dots span {
  display: inline-block;
  animation: ellipsis 1.3s infinite;
  opacity: 0;
}
.dots span:nth-child(1) {
  animation-delay: 0s;
}
.dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes ellipsis {
  0%,
  20% {
    opacity: 0;
  }
  50%,
  100% {
    opacity: 1;
  }
}

/* Enter animation */
.msg {
  animation: msg-in 0.28s ease-out both;
}
@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =============================================================================
   Ticket card
   ============================================================================= */

.ticket-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.ticket-hero {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
  background: #ddd;
}
.ticket-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ticket-title {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 600;
  color: #0d0d0d;
}
.ticket-line {
  margin: 0;
  font-size: 13px;
  color: #0d0d0d;
  line-height: 1.45;
}
.ticket-muted {
  color: #6b6b6b;
}
.ticket-pay-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
}
.ticket-qty {
  display: flex;
  flex-direction: column;
}
.ticket-qty-count {
  font-size: 12px;
  color: #6b6b6b;
  line-height: 1.2;
}
.ticket-qty-price {
  font-size: 16px;
  font-weight: 600;
  color: #0d0d0d;
  line-height: 1.25;
}

/* PayPal button */
.paypal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  background: #ffc439;
  color: #111;
  font-size: 13px;
  font-weight: 600;
  transition:
    background 0.15s ease,
    transform 0.05s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.paypal-btn:hover {
  background: #ffb90f;
}
.paypal-btn:active {
  transform: translateY(1px);
}
.paypal-btn:disabled {
  cursor: default;
  opacity: 0.75;
}
.paypal-btn .paypal-mark {
  height: 16px;
  width: auto;
  display: block;
}
.paypal-btn .paypal-btn-label {
  font-weight: 500;
}

/* =============================================================================
   Confirmation card
   ============================================================================= */

.confirm-card {
  background: #fff;
  border: 1px solid #b7e3c6;
  border-radius: 12px;
  padding: 12px 14px;
}
.confirm-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}
.confirm-check {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.confirm-check svg {
  width: 100%;
  height: 100%;
  display: block;
}
.confirm-text {
  min-width: 0;
}
.confirm-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #0a7f37;
  line-height: 1.3;
}
.confirm-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: #0d0d0d;
  line-height: 1.4;
}
.confirm-link {
  font-size: 12px;
  font-weight: 500;
  color: #6b6b6b;
  text-decoration: underline;
  white-space: nowrap;
}
.confirm-link:hover {
  color: #0d0d0d;
}

@media (max-width: 420px) {
  .confirm-row {
    grid-template-columns: auto 1fr;
  }
  .confirm-link {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

/* =============================================================================
   Perks carousel (inline, horizontal scroll on mobile, 3-up on desktop)
   ============================================================================= */

.perks {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
  animation: msg-in 0.35s ease-out both;
}

.perks-head {
  margin-bottom: 10px;
}
.perks-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #0d0d0d;
}
.perks-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: #6b6b6b;
}

.perks-track-wrap {
  position: relative;
}

.perks-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 47%;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 4px;
  /* hide scrollbars */
  scrollbar-width: none;
}
.perks-track::-webkit-scrollbar {
  display: none;
}

/* Right-edge fade + arrow hint that more offers are off-screen. Shown only
   when .is-scrollable (set via JS) and .is-at-end is not set. */
.perks-track-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 4px;
  width: 36px;
  pointer-events: none;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), #fff 85%);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.perks-track-wrap.is-scrollable:not(.is-at-end)::after {
  opacity: 1;
}

.perks-scroll-hint {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0d0d0d;
  opacity: 0;
  transform: translate(4px, -50%);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  pointer-events: auto;
  cursor: pointer;
  animation: hint-nudge 1.6s ease-in-out infinite;
  z-index: 2;
}
.perks-track-wrap.is-scrollable:not(.is-at-end) .perks-scroll-hint {
  opacity: 1;
  transform: translate(0, -50%);
}
.perks-scroll-hint svg {
  width: 14px;
  height: 14px;
}
@keyframes hint-nudge {
  0%,
  100% {
    margin-right: 0;
  }
  50% {
    margin-right: -3px;
  }
}

@media (min-width: 620px) {
  .perks-track {
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    overflow-x: visible;
  }
  .perks-track-wrap::after,
  .perks-scroll-hint {
    display: none;
  }
}

.offer-card {
  scroll-snap-align: start;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.offer-hero-wrap {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #f4f4f4;
  overflow: hidden;
}
.offer-hero {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.offer-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.offer-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #0d0d0d;
  line-height: 1.3;
}
.offer-desc {
  margin: 0;
  font-size: 12px;
  color: #6b6b6b;
  line-height: 1.4;
  flex: 1;
}

.offer-chip {
  --chip-bg: #feedea;
  --chip-fg: #8e0200;
  display: block;
  background: var(--chip-bg);
  color: var(--chip-fg);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  text-align: center;
  margin-top: 4px;
}

.offer-cta {
  --cta-accent: #e30d00;
  margin-top: 4px;
  height: 34px;
  border-radius: 8px;
  border: 1.5px solid var(--cta-accent);
  color: var(--cta-accent);
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  transition:
    background 0.15s ease,
    color 0.15s ease;
  width: 100%;
}
.offer-cta:hover {
  background: var(--cta-accent);
  color: #fff;
}

/* Per-offer accents (sampled from the mockup) */
.accent-dining .offer-chip {
  --chip-bg: #feedea;
  --chip-fg: #8e0200;
}
.accent-dining .offer-cta {
  --cta-accent: #e30d00;
}

.accent-parking .offer-chip {
  --chip-bg: #ecf2fb;
  --chip-fg: #06196c;
}
.accent-parking .offer-cta {
  --cta-accent: #023abb;
}

.accent-merch .offer-chip {
  --chip-bg: #feeff0;
  --chip-fg: #900103;
}
.accent-merch .offer-cta {
  --cta-accent: #da0400;
}

/* Perks footer */
.perks-foot {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.perks-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #0d0d0d;
  padding: 8px 16px;
  border: 1px solid #d5d5d5;
  border-radius: 999px;
  background: #fff;
  transition: background 0.15s ease;
}
.perks-more:hover {
  background: #f4f4f4;
}
.perks-more svg {
  width: 15px;
  height: 15px;
}
.perks-skip {
  font-size: 13px;
  color: #6b6b6b;
  padding: 6px 2px;
}
.perks-skip:hover {
  color: #0d0d0d;
}

.perks-caption {
  margin: 10px 0 0;
  font-size: 11px;
  color: #9a9a9a;
  text-align: center;
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.perks-caption svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.perks-caption strong {
  color: #6b6b6b;
  font-weight: 600;
}
.perks-caption a {
  color: #2e6bff;
  text-decoration: none;
}
.perks-caption a:hover {
  text-decoration: underline;
}

.perks.is-hidden {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

/* =============================================================================
   Composer (fixed to bottom of phone frame)
   ============================================================================= */

.composer {
  background: #fff;
  border-top: 1px solid #eee;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 36px 1fr 36px 36px;
  align-items: end;
  gap: 8px;
  flex-shrink: 0;
}

.composer-plus,
.composer-mic,
.composer-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0d0d0d;
  transition: background 0.15s ease;
}
.composer-plus,
.composer-mic {
  border: 1px solid #e5e5e5;
}
.composer-plus:hover,
.composer-mic:hover {
  background: #f4f4f4;
}
.composer-plus svg,
.composer-mic svg {
  width: 18px;
  height: 18px;
}

.composer-send {
  background: #0d0d0d;
  color: #fff;
}
.composer-send:disabled {
  background: #e5e5e5;
  color: #9a9a9a;
  cursor: default;
}
.composer-send svg {
  width: 18px;
  height: 18px;
}

.composer-input-wrap {
  border: 1px solid #e5e5e5;
  border-radius: 20px;
  padding: 8px 12px 8px;
  background: #fff;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}
.composer-input {
  font-size: 15px;
  color: #0d0d0d;
  min-height: 20px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
  outline: none;
}
.composer-input.is-empty::before {
  content: "Ask anything";
  color: #9a9a9a;
}
.composer-input .caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  background: #0d0d0d;
  margin-left: 1px;
  vertical-align: -0.15em;
  animation: caret-blink 1s steps(2) infinite;
}
@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

.composer-meta {
  display: flex;
  gap: 6px;
  padding-top: 2px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #6b6b6b;
  padding: 2px 8px 2px 4px;
  border-radius: 999px;
}
.chip svg {
  width: 14px;
  height: 14px;
}

.disclaimer {
  display: none;
  margin: 0;
  text-align: center;
  font-size: 11px;
  color: #9a9a9a;
  padding: 6px 16px 10px;
}

/* =============================================================================
   Desktop (>= 768px)

   The shell spans the full viewport width (real web-app feel, not a phone
   frame). Inner chat content is centered within a readable column, while the
   header and composer backgrounds stay edge-to-edge.
   ============================================================================= */

@media (min-width: 768px) {
  html,
  body {
    background: #fff;
  }

  /* Header — full-width bar, content centered */
  .chat-header {
    padding: 0 max(24px, calc((100vw - var(--content-max)) / 2));
    height: 60px;
  }

  /* Messages — centered readable column */
  .chat-scroll {
    align-items: stretch;
    padding: 24px max(24px, calc((100vw - var(--content-max)) / 2)) 32px;
    gap: 18px;
  }

  /* Ticket card: cap width so it doesn't stretch hero absurdly */
  .ticket-card {
    max-width: 520px;
  }
  .ticket-hero {
    height: 160px;
  }

  /* Ticket hero on desktop should breathe more */
  .msg-text {
    font-size: 15.5px;
  }

  /* Perks track: 3-up grid on desktop (mockup shows 3 visible) */
  .perks-track {
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    overflow-x: visible;
    scroll-snap-type: none;
  }
  .perks-track-wrap::after,
  .perks-scroll-hint {
    display: none;
  }

  .offer-hero-wrap {
    aspect-ratio: 16 / 10;
  }

  /* Composer — full-width bar, content centered */
  .composer {
    padding: 14px max(24px, calc((100vw - var(--content-max)) / 2));
    grid-template-columns: 40px minmax(0, 1fr) 40px 40px;
    gap: 10px;
  }
  .composer-plus,
  .composer-mic,
  .composer-send {
    width: 40px;
    height: 40px;
  }
  .composer-input-wrap {
    min-height: 56px;
    padding: 10px 16px;
  }
  .composer-input {
    font-size: 16px;
  }

  /* Small footnote under composer on desktop */
  .disclaimer {
    display: block;
    padding: 6px 16px 14px;
  }

  /* Confirmation card: let it span wider */
  .confirm-card {
    padding: 14px 16px;
  }
}

/* At very wide viewports, content column stays readable, background neutral */
@media (min-width: 1400px) {
  .app {
    --content-max: 820px;
  }
}
