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

:root {
  --bg: #0A0A0A;
  --bg-chat: #0D0D0D;
  --bg-card: #111111;
  --bg-elevated: #1A1A1A;
  --bg-input: #141414;
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --text: #F5F0EB;
  --text-secondary: #A1A1AA;
  --text-muted: #71717A;
  --accent: #25D366;
  --accent-dim: rgba(37, 211, 102, 0.12);
  --accent-glow: rgba(37, 211, 102, 0.08);
  --blue: #3B82F6;
  --amber: #F59E0B;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  --mono: 'DM Mono', monospace;
  --radius: 12px;
}

html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── LAYOUT ─── */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* ─── TOPBAR ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
.logo span { color: var(--accent); }
.topbar-badge {
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.topbar-right a {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.15s;
}
.topbar-right a:hover { color: var(--text); }

/* ─── CHAT AREA ─── */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px;
  scroll-behavior: smooth;
}
.chat-area::-webkit-scrollbar { width: 4px; }
.chat-area::-webkit-scrollbar-track { background: transparent; }
.chat-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

.chat-container {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─── WELCOME STATE ─── */
.welcome {
  text-align: center;
  padding: 60px 20px 40px;
}
.welcome-icon {
  width: 56px;
  height: 56px;
  background: var(--accent-dim);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 1.6rem;
}
.welcome h1 {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  line-height: 1.2;
}
.welcome h1 em { font-style: italic; color: var(--accent); }
.welcome p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 460px;
  margin: 0 auto 32px;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 520px;
  margin: 0 auto;
}
.suggestion {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 10px 18px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--sans);
}
.suggestion:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ─── MESSAGES ─── */
.message {
  display: flex;
  gap: 12px;
  max-width: 100%;
  animation: msg-in 0.3s ease;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.message.user { justify-content: flex-end; }
.message.user .msg-content {
  background: var(--accent);
  color: #000;
  border-radius: 18px 18px 4px 18px;
  max-width: 75%;
}
.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.msg-avatar.agent {
  background: var(--accent-dim);
  color: var(--accent);
}
.msg-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px 18px 18px 4px;
  padding: 14px 18px;
  font-size: 0.88rem;
  line-height: 1.6;
  max-width: 85%;
}
.msg-content p { margin-bottom: 8px; }
.msg-content p:last-child { margin-bottom: 0; }

/* ─── TYPING INDICATOR ─── */
.typing {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: msg-in 0.3s ease;
}
.typing-dots {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px 18px 18px 4px;
  padding: 16px 20px;
  display: flex;
  gap: 5px;
}
.typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ─── PRODUCT CARDS ─── */
.product-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.product-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  gap: 14px;
  transition: border-color 0.2s;
  cursor: pointer;
}
.product-card:hover { border-color: var(--accent); }
.product-img {
  width: 64px;
  height: 64px;
  background: var(--bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  overflow: hidden;
}
.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}
.product-info { flex: 1; min-width: 0; }
.product-name {
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-source {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.product-price {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
}
.product-add {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  white-space: nowrap;
  align-self: center;
  transition: opacity 0.15s;
}
.product-add:hover { opacity: 0.85; }
.product-add.added {
  background: var(--bg);
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* ─── CART SUMMARY ─── */
.cart-summary {
  background: linear-gradient(135deg, var(--bg-card), var(--accent-glow));
  border: 1px solid rgba(37, 211, 102, 0.15);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 12px;
}
.cart-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.cart-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-name { flex: 1; }
.cart-item-price {
  font-family: var(--mono);
  color: var(--text);
  font-weight: 500;
}
.cart-total {
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
}
.cart-total .cart-item-price { color: var(--accent); font-size: 1rem; }
.cart-pay {
  width: 100%;
  background: var(--accent);
  color: #000;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 14px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  margin-top: 14px;
  transition: opacity 0.15s;
}
.cart-pay:hover { opacity: 0.9; }

/* ─── INPUT BAR ─── */
.input-bar {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.input-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.input-wrap {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px;
  display: flex;
  align-items: flex-end;
  transition: border-color 0.2s;
}
.input-wrap:focus-within { border-color: rgba(37, 211, 102, 0.3); }
.input-field {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text);
  font-family: var(--sans);
  outline: none;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
}
.input-field::placeholder { color: var(--text-muted); }
.send-btn {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}
.send-btn:hover { opacity: 0.9; transform: scale(1.03); }
.send-btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.send-btn svg { width: 18px; height: 18px; }

/* ─── MIC BUTTON ─── */
.mic-btn {
  width: 40px;
  height: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  position: relative;
}
.mic-btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
}
.mic-btn svg { width: 18px; height: 18px; }
.mic-btn.recording {
  background: var(--accent);
  border-color: var(--accent);
  animation: mic-pulse 1.5s ease-in-out infinite;
}
.mic-btn.recording svg path { fill: #000; stroke: #000; }
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(37, 211, 102, 0); }
}
.mic-status {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.72rem;
  color: var(--accent);
  white-space: nowrap;
  display: none;
  animation: msg-in 0.2s ease;
}
.mic-btn.recording .mic-status { display: block; }
.mic-unavailable {
  opacity: 0.3;
  cursor: not-allowed;
}

.input-hint {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 8px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 600px) {
  .welcome { padding: 40px 16px 24px; }
  .welcome h1 { font-size: 1.5rem; }
  .suggestions { gap: 6px; }
  .suggestion { padding: 8px 14px; font-size: 0.78rem; }
  .msg-content { max-width: 90%; padding: 12px 14px; }
  .product-card { padding: 12px; }
  .product-img { width: 50px; height: 50px; }
}
