:root {
  --primary: #0b74de;
  --bg: #f4f7fb;
  --bot-bg: #e9f1fb;
  --user-bg: var(--primary);
  --text-dark: #222;
  --text-light: #fff;
}
* { box-sizing: border-box; }
body {
  font-family: "Poppins", system-ui, Arial;
  background: var(--bg);
  margin: 0;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}
.chat-container {
  width: 100%;
  max-width: 430px;
  height: min(90vh, 760px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chat-header {
  background: linear-gradient(135deg, #0b74de, #1c8ef7);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  position: relative;
}
.chat-header img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  object-fit: cover;
}
.header-text h3 { margin:0; font-size:18px; font-weight:600;}
.header-text .small { font-size:13px; opacity:0.9; display:flex; align-items:center; gap:6px;}
.online-dot { width:8px; height:8px; border-radius:50%; background:#00e676; box-shadow:0 0 6px #00e676; }

.header-buttons {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.header-buttons a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding:6px 10px;
  border-radius:8px;
  background: rgba(255,255,255,0.2);
  color: #fff;
  text-decoration: none;
  font-size:14px;
  gap:4px;
}
.header-buttons a:hover {
  background: rgba(255,255,255,0.35);
}
.header-buttons svg { width:16px; height:16px; fill:#fff; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8faff;
  min-height: 440px;
  scroll-behavior: smooth;
}
.messages::-webkit-scrollbar { width:6px;}
.messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius:10px;}
.msg { max-width:80%; padding:12px 16px; border-radius:18px; line-height:1.5; font-size:15px; word-wrap: break-word; box-shadow:0 2px 10px rgba(0,0,0,0.05);}
.msg.user { align-self:flex-end; background:var(--user-bg); color:var(--text-light); border-bottom-right-radius:6px;}
.msg.bot { align-self:flex-start; background:var(--bot-bg); color:var(--text-dark); border-bottom-left-radius:6px;}
.msg img.inline-thumb { width:100%; max-width:220px; border-radius:12px; margin-bottom:6px; display:block; }

.msg.typing { display:flex; align-items:center; gap:8px; padding:10px 14px; width:auto; max-width:60%;}
.typing-bubble { background: rgba(11,116,222,0.08); padding:8px 10px; border-radius:12px; display:flex; align-items:center; gap:6px;}
.typing-dot { width:8px; height:8px; border-radius:50%; background:#0b74de; opacity:0.25; transform: translateY(0); }
@keyframes bounceDots {
  0% { opacity:0.25; transform: translateY(0); }
  50% { opacity:1; transform: translateY(-6px); }
  100% { opacity:0.25; transform: translateY(0); }
}
.typing-dot:nth-child(1) { animation: bounceDots 1s infinite; animation-delay: 0s; }
.typing-dot:nth-child(2) { animation: bounceDots 1s infinite; animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation: bounceDots 1s infinite; animation-delay: 0.3s; }

.input-row { display:flex; gap:8px; padding:12px; border-top:1px solid #eef3fb; background:#fafcff;}
.input-row input { flex:1; padding:10px 14px; border-radius:10px; border:1px solid #d7e3f5; outline:none; font-size:15px;}
.input-row input:focus { border-color: var(--primary); box-shadow:0 0 0 3px rgba(11,116,222,0.15);} 
.input-row button { padding:10px 16px; border-radius:10px; border:none; background:var(--primary); color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center;}
.input-row button:hover { background:#0966c2;}
a { text-decoration:none; font-weight:500;}

#question-picker {
  position: absolute;
  bottom: 70px;
  left: 20px;
  right: 20px;
  margin: 0 auto;
  width: 400px;
  max-width: 95%;
  background:#fff;
  border:1px solid #d7e3f5;
  border-radius:12px;
  box-shadow:0 4px 12px rgba(0,0,0,0.1);
  display:none;
  max-height:250px;
  overflow-y:auto;
  z-index:1000;
  padding:8px;
}
.question-item {
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px;
  cursor:pointer;
  border-radius:8px;
  transition:0.15s;
}
.question-item:hover { background:#eef3fb;}
.question-item img { width:40px; height:40px; object-fit:cover; border-radius:6px; }
.question-item span { flex:1; font-size:14px; }

#product-panel {
  position: absolute;
  bottom: 70px;
  left: 20px;
  right: 20px;
  margin: 0 auto;
  width: 420px;
  max-width: 95%;
  background:#fff;
  border:1px solid #d7e3f5;
  border-radius:12px;
  box-shadow:0 8px 24px rgba(0,0,0,0.12);
  display:none;
  max-height:360px;
  overflow-y:auto;
  z-index:1100;
  padding:10px;
}
.product-header { display:flex; align-items:center; justify-content:space-between; gap:8px; padding-bottom:8px; border-bottom:1px solid #eef3fb; margin-bottom:8px;}
.product-list { display:grid; grid-template-columns: 1fr; gap:8px; padding:4px; }
.product-item {
  display:flex; gap:8px; align-items:center; padding:8px; border-radius:10px; cursor: pointer;
  border:1px solid #f1f6fb; transition:0.12s;
}
.product-item:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(11,116,222,0.06); }
.product-thumb { width:76px; height:64px; flex:0 0 76px; border-radius:8px; object-fit:cover; background:#eee; }
.product-meta { display:flex; flex-direction:column; gap:6px; }
.product-name { font-weight:600; font-size:14px; color:var(--text-dark); }
.product-price { font-size:13px; color:#0b74de; font-weight:700; }
.product-cta { margin-left:auto; font-size:13px; padding:6px 8px; background:#f1f8ff; border-radius:8px; color:var(--primary); border:1px solid rgba(11,116,222,0.06); }

.picker-header { display:flex; gap:8px; align-items:center; padding:6px 8px; }
.picker-search { flex:1; padding:8px; border-radius:8px; border:1px solid #e6eef9; outline:none; }
.picker-empty { padding:12px; text-align:center; color:#666; font-size:14px; }

.bot-welcome-actions { margin-top:8px; display:flex; gap:8px; align-items:center; }
.welcome-btn {
  padding:8px 12px;
  background:#fff;
  border:1px solid #d7e3f5;
  border-radius:10px;
  cursor:pointer;
  font-weight:600;
  color:var(--primary);
}
.welcome-btn:hover { background:#f3f8ff; transform: translateY(-1px); }

@media (max-width:480px) {
  .chat-container { border-radius:12px; padding:0; }
  #product-panel, #question-picker { left: 12px; right: 12px; bottom: 72px; }
}
