/* ===== Cosme Outlet — chatbot widget ("น้องคอสเม่") ===== */

#chatbot-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 500;
  font-family: 'Prompt', sans-serif;
}

#chatbot-toggle {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--pink), var(--pink-dark));
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(236, 0, 140, .38);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease;
  position: relative;
}
#chatbot-toggle:hover { transform: scale(1.06); }
#chatbot-toggle .chatbot-ping {
  position: absolute;
  top: -3px; right: -3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #2ecc71;
  border: 2px solid #fff;
}

#chatbot-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(140, 0, 80, .3);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
}
#chatbot-panel.open { display: flex; }

.chatbot-header {
  background: linear-gradient(120deg, var(--pink-darker), var(--pink));
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  flex: none;
}
.chatbot-header img {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.6);
  object-fit: cover;
}
.chatbot-header .chatbot-title { flex: 1; line-height: 1.3; }
.chatbot-header strong { display: block; font-size: .95rem; }
.chatbot-header span { font-size: .74rem; color: rgba(255,255,255,.85); }
#chatbot-close {
  background: rgba(255,255,255,.18);
  border: none;
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}
#chatbot-close:hover { background: rgba(255,255,255,.32); }

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--pink-lighter);
}

.chatbot-msg { display: flex; gap: 8px; max-width: 88%; }
.chatbot-msg.bot { align-self: flex-start; }
.chatbot-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.chatbot-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  flex: none;
  object-fit: cover;
  margin-top: 2px;
}

.chatbot-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: .88rem;
  line-height: 1.6;
  white-space: pre-line;
}
.chatbot-msg.bot .chatbot-bubble {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--ink);
  border-top-left-radius: 4px;
}
.chatbot-msg.user .chatbot-bubble {
  background: var(--pink);
  color: #fff;
  border-top-right-radius: 4px;
}

.chatbot-typing { display: flex; gap: 4px; padding: 4px 0; }
.chatbot-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--pink);
  opacity: .5;
  animation: chatbot-blink 1s infinite ease-in-out;
}
.chatbot-typing span:nth-child(2) { animation-delay: .15s; }
.chatbot-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chatbot-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: .9; } }

.chatbot-products {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.chatbot-product-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s ease, transform .15s ease;
}
.chatbot-product-card:hover { border-color: var(--pink); transform: translateY(-1px); }
.chatbot-product-card img {
  width: 42px; height: 42px;
  border-radius: 8px;
  object-fit: contain;
  background: var(--pink-lighter);
  padding: 3px;
  flex: none;
}
.chatbot-product-card .cpc-name { font-size: .8rem; font-weight: 500; line-height: 1.3; }
.chatbot-product-card .cpc-price { font-size: .82rem; font-weight: 700; color: var(--pink-dark); white-space: nowrap; }

.chatbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
  flex: none;
}
.chatbot-chip {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .78rem;
  color: var(--pink-dark);
  cursor: pointer;
  white-space: nowrap;
}
.chatbot-chip:hover { background: var(--pink-light); border-color: var(--pink); }

#chatbot-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  flex: none;
  background: #fff;
}
#chatbot-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: 'Prompt', sans-serif;
  font-size: .88rem;
}
#chatbot-input:focus { outline: none; border-color: var(--pink); }
#chatbot-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--pink);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
#chatbot-send:hover { background: var(--pink-dark); }

@media (max-width: 480px) {
  #chatbot-panel {
    width: calc(100vw - 24px);
    right: -10px;
    height: calc(100vh - 160px);
  }
  #chatbot-widget { right: 14px; bottom: 14px; }
}

/* ===== Homepage full hero chat ("แอดมินคอสเม่") ===== */

.chat-hero {
  background: linear-gradient(180deg, var(--pink-lighter) 0%, #fff 65%);
  padding: 64px 0 56px;
}

.chat-hero .container {
  max-width: 760px;
}

.chat-hero-intro {
  text-align: center;
  margin-bottom: 30px;
  transition: opacity .25s ease, max-height .25s ease, margin .25s ease;
}
.chat-hero-intro.collapsed {
  opacity: 0;
  max-height: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}

.chat-hero-intro .eyebrow { display: block; text-align: center; }

.chat-hero-intro h1 {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--pink-darker);
  margin-bottom: 14px;
}

.chat-hero-intro p {
  color: var(--ink-soft);
  font-size: .98rem;
  max-width: 560px;
  margin: 0 auto;
}

.chat-hero-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 46vh;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 18px;
  padding-right: 4px;
}
.chat-hero-thread:empty { display: none; }

.chat-hero-form {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 8px 8px 8px 24px;
  box-shadow: 0 14px 34px rgba(236, 0, 140, .12);
}
.chat-hero-form:focus-within { border-color: var(--pink); }

#chat-hero-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: 'Prompt', sans-serif;
  font-size: .98rem;
  color: var(--ink);
  background: transparent;
  padding: 10px 0;
}
#chat-hero-input::placeholder { color: #c9b8c4; }

#chat-hero-send {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--pink);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, transform .15s ease;
}
#chat-hero-send:hover { background: var(--pink-dark); transform: scale(1.05); }

.chat-hero-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  transition: opacity .25s ease, max-height .25s ease, margin .25s ease;
}
.chat-hero-suggestions.collapsed {
  opacity: 0;
  max-height: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}

.chat-hero-chip {
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: .86rem;
  color: var(--ink);
  cursor: pointer;
  transition: all .15s ease;
}
.chat-hero-chip:hover { border-color: var(--pink); background: var(--pink-light); color: var(--pink-dark); }

.chat-hero-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
  margin-top: 26px;
  font-size: .8rem;
  color: var(--ink-soft);
  transition: opacity .25s ease, max-height .25s ease, margin .25s ease;
}
.chat-hero-trust.collapsed {
  opacity: 0;
  max-height: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}

@media (max-width: 640px) {
  .chat-hero { padding: 44px 0 40px; }
  .chat-hero-thread { max-height: 52vh; }
}
