/* ================================================================
   chat.css — Chat layout, messages, composer, rich content
   ================================================================ */

/* ---- Chat Layout ---- */
.chat-layout { display: flex; height: calc(100vh - 74px); flex-direction: column; }
.chat-scroll { flex: 1; overflow: auto; padding: 30px max(24px, calc((100% - 700px) / 2)); }
.welcome { padding: 5vh 0 26px; text-align: center; }
.assistant-avatar { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 11px; }
.assistant-avatar.large { width: 68px; height: 68px; margin: 0 auto 18px; color: #fff0e7; background: linear-gradient(145deg, #23231f, #070706); border: 7px solid #e9e5da; border-radius: 22px; box-shadow: var(--shadow); }
.assistant-avatar.large svg { width: 30px; height: 30px; }
.welcome h1, .page-title h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(30px, 4vw, 46px); font-weight: 500; letter-spacing: -.055em; }
.welcome > p:not(.eyebrow) { max-width: 480px; margin: 12px auto 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

/* ---- Suggestions ---- */
.suggestions { display: grid; max-width: 530px; gap: 8px; margin: 27px auto 0; }
.suggestions button { display: flex; min-height: 45px; align-items: center; justify-content: space-between; padding: 0 15px; color: #56544d; background: rgba(255, 253, 248, .7); border: 1px solid var(--line); border-radius: 12px; font-size: 10px; font-weight: 800; text-align: left; }
.suggestions button:hover { color: var(--accent-dark); background: var(--surface); border-color: #efb9a8; transform: translateY(-1px); }
.suggestions span { color: var(--accent); font-size: 16px; }

/* ---- Messages ---- */
.messages { display: grid; gap: 19px; }
.message { display: flex; gap: 10px; align-items: flex-start; animation: rise .24s ease both; }
.message.user { justify-content: flex-end; }
.message-body { display: flex; flex-direction: column; gap: 8px; max-width: min(86%, 600px); }
.message.user .message-body { align-items: flex-end; }
.message.assistant .message-body { align-items: flex-start; }
.message-bubble { max-width: 100%; padding: 11px 14px; color: #47463f; background: var(--surface); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; font-size: 11px; line-height: 1.6; box-shadow: 0 7px 22px rgba(54, 44, 30, .045); }
.message.user .message-bubble { color: white; background: var(--ink); border: 0; border-radius: 14px 4px 14px 14px; }
.message.loading .message-bubble { display: flex; gap: 4px; padding: 15px; }
.message.loading i { width: 5px; height: 5px; background: #aaa69b; border-radius: 99px; animation: pulse 1s infinite; }
.message.loading i:nth-child(2) { animation-delay: .15s; }
.message.loading i:nth-child(3) { animation-delay: .3s; }
.message-bubble strong { font-weight: 800; color: var(--ink); }
.message.user .message-bubble strong { color: white; }

/* ---- Cart loading state ---- */
.cart-count-loading::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 4px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: cartSpin .7s linear infinite;
  vertical-align: -1px;
}
.cart-panel-loading { position: relative; pointer-events: none; }
.cart-panel-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255,255,255,.45);
  backdrop-filter: blur(1px);
}
.cart-panel-loading::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid var(--accent);
  border-right-color: transparent;
  border-radius: 50%;
  animation: cartSpin .7s linear infinite;
}

/* ---- Voice cart strip (in chat) ---- */
.voice-cart-strip {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: min(100%, 420px);
  margin: 14px auto 0;
  padding: 10px 12px;
  color: white;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  transition: transform .25s ease, background .25s ease;
}
.voice-cart-strip.hidden { display: none !important; }
.voice-cart-strip.updated { transform: scale(1.02); background: rgba(255,255,255,.16); }
.voice-cart-strip-lines { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.voice-cart-strip-item { padding: 4px 8px; font-size: 10px; font-weight: 700; background: rgba(255,255,255,.12); border-radius: 999px; white-space: nowrap; }
.voice-cart-strip-total { font-size: 12px; white-space: nowrap; }

/* ---- Composer ---- */
.composer-wrap { padding: 10px max(24px, calc((100% - 700px) / 2)) 15px; background: linear-gradient(transparent, var(--paper) 18%); }
.voice-waves { display: flex; width: 30px; height: 30px; align-items: center; justify-content: center; gap: 2px; color: white; background: var(--accent); border-radius: 10px; }
.voice-waves i { width: 2px; height: 8px; background: currentColor; border-radius: 99px; animation: wave 1s ease-in-out infinite alternate; }
.voice-waves i:nth-child(2) { height: 14px; animation-delay: .2s; }
.voice-waves i:nth-child(3) { height: 10px; animation-delay: .4s; }
.voice-waves i:nth-child(4) { height: 5px; animation-delay: .6s; }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) auto 38px 38px; gap: 5px; padding: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 12px 32px rgba(54, 44, 30, .07); }
.composer:focus-within { border-color: #e5ac9a; box-shadow: 0 0 0 4px rgba(239, 90, 47, .08); }
.composer textarea { min-height: 38px; max-height: 110px; padding: 10px 8px; resize: none; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 11px; line-height: 1.5; }
.mic-button, .send-button { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px; }
.live-voice-button { display: inline-flex; gap: 6px; align-items: center; height: 38px; padding: 0 12px; color: white; background: var(--ink); border-radius: 11px; font-size: 9px; font-weight: 800; }
.live-voice-button .live-voice-label { white-space: nowrap; }
.mic-button { color: #6d6a62; background: #f0ede5; }
.mic-button.listening { color: white; background: var(--accent); animation: softPulse 1s infinite; }
.send-button { color: white; background: var(--accent); }
.mic-button svg, .send-button svg { width: 16px; }
.composer-note { margin: 7px 0 0; color: #aaa69b; font-size: 7px; text-align: center; }

/* ---- Chat Rich Formatting ---- */
.message-bubble .price-tag { color: var(--accent); font-weight: 800; }
.message-bubble ul.chat-list { margin: 8px 0; padding-left: 16px; font-size: 11px; }
.message-bubble ul.chat-list li { margin-bottom: 4px; }
.message-bubble .product-mention { color: var(--accent-dark); font-weight: 700; cursor: pointer; }

/* ---- Chat Product Cards ---- */
.chat-product-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  margin-top: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(54,44,30,.06);
  animation: rise .25s ease both;
}
.chat-product-img {
  width: 64px; height: 64px;
  background-size: cover; background-position: center;
  border-radius: 11px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 25%, #ffa27d, #ef5a2f 58%, #9e3218);
}
.chat-product-img .chat-product-art {
  font-family: Georgia, serif; font-size: 22px; font-weight: 700; color: white;
}
.chat-product-info { min-width: 0; }
.chat-product-info strong { display: block; font-size: 11px; }
.chat-product-info span { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.chat-product-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.chat-product-price { font-size: 11px; font-weight: 800; }
.chat-product-add {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  color: white; background: var(--accent);
  border-radius: 8px; font-size: 16px; font-weight: 700;
}
.chat-product-add:disabled { background: #bbb; cursor: not-allowed; }

/* ---- Suggestion Chips ---- */
.message-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}
.suggestion-chip {
  min-height: 34px;
  padding: 0 12px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid #f0c4b4;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 800;
  transition: transform .15s ease, background .15s ease;
}
.suggestion-chip:hover {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.suggestion-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Image Strip ---- */
.chat-image-strip {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.chat-image-strip::-webkit-scrollbar { display: none; }
.chat-image-card {
  flex: 0 0 auto;
  width: 88px;
  margin: 0;
  cursor: pointer;
  transition: transform .15s ease;
}
.chat-image-card:hover { transform: translateY(-2px); }
.chat-image-thumb {
  width: 88px;
  height: 72px;
  background-size: cover;
  background-position: center;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.chat-image-card figcaption {
  margin-top: 4px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

/* ---- Menu Highlights Carousel ---- */
.chat-carousel {
  margin-top: 12px;
  margin-left: -4px;
  margin-right: -4px;
}
.chat-carousel-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 4px 4px 8px;
}
.chat-carousel-track::-webkit-scrollbar { display: none; }
.chat-highlight-card {
  flex: 0 0 132px;
  scroll-snap-align: start;
  overflow: hidden;
  background: #faf8f2;
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.chat-highlight-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(54, 44, 30, .1);
}
.chat-highlight-img {
  height: 78px;
  background-size: cover;
  background-position: center;
  display: grid;
  place-items: center;
  background-color: #ef5a2f;
}
.chat-highlight-img .chat-highlight-art {
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  color: rgba(255,255,255,.85);
  text-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.chat-highlight-body { padding: 8px 9px 10px; }
.chat-highlight-body strong { display: block; font-size: 9px; line-height: 1.35; }
.chat-highlight-price { display: block; margin-top: 3px; color: var(--accent); font-size: 9px; font-weight: 800; }
.chat-highlight-add {
  width: 100%;
  min-height: 28px;
  margin-top: 7px;
  color: white;
  background: var(--accent);
  border-radius: 8px;
  font-size: 8px;
  font-weight: 900;
}
.chat-highlight-add:hover { background: var(--accent-dark); }

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .voice-cart-strip { display: flex; }
  .voice-cart-strip.hidden { display: none !important; }
}
@media (max-width: 620px) {
  .chat-scroll { padding: 18px 13px; }
  .welcome { padding-top: 3vh; }
  .welcome h1 { font-size: 32px; }
  .welcome > p:not(.eyebrow) { font-size: 10px; }
  .suggestions { margin-top: 20px; }
  .composer-wrap { padding: 8px 10px 10px; }
  .composer-note { display: none; }
  .message-bubble { max-width: 100%; }
  .message-body { max-width: 92%; }
  .chat-highlight-card { flex-basis: 120px; }
}
