/* ── Chat Widget ───────────────────────────────────────── */
#chat-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #E8714A;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(232,113,74,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 22px rgba(232,113,74,0.55);
}
#chat-toggle svg { display: block; }

/* Panel */
#chat-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 9001;
  width: 360px;
  max-height: 520px;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  font-family: 'DM Sans', sans-serif;
  background: #faf8f4;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
#chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
#chat-header {
  background: #3d4a2e;
  color: #faf8f4;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
#chat-header-title {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
#chat-header-sub {
  font-size: 11px;
  opacity: 0.65;
  margin-top: 1px;
}
#chat-close {
  background: none;
  border: none;
  color: #faf8f4;
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
  line-height: 1;
  font-size: 18px;
  transition: opacity 0.15s;
}
#chat-close:hover { opacity: 1; }

/* Messages */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-track { background: transparent; }
#chat-messages::-webkit-scrollbar-thumb { background: #d6cfc4; border-radius: 4px; }

.chat-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}
.chat-bubble.user {
  background: #E8714A;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
  background: #fff;
  color: #2c2c2c;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

/* Loading dots */
.chat-bubble.loading {
  background: #fff;
  align-self: flex-start;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  padding: 12px 16px;
}
.chat-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}
.chat-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a09880;
  animation: chat-dot-bounce 1.1s infinite ease-in-out;
}
.chat-dots span:nth-child(2) { animation-delay: 0.18s; }
.chat-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes chat-dot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%            { transform: translateY(-5px); opacity: 1; }
}

/* Input area */
#chat-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e8e2d8;
  background: #faf8f4;
  flex-shrink: 0;
}
#chat-input {
  flex: 1;
  border: 1px solid #d6cfc4;
  border-radius: 20px;
  padding: 8px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  background: #fff;
  color: #2c2c2c;
  outline: none;
  resize: none;
  transition: border-color 0.15s;
}
#chat-input:focus { border-color: #E8714A; }
#chat-input::placeholder { color: #b0a898; }

#chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #E8714A;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
}
#chat-send:hover { background: #d45f38; transform: scale(1.05); }
#chat-send:disabled { background: #c8bfb4; cursor: default; transform: none; }
#chat-send svg { display: block; }

/* Mobile */
@media (max-width: 480px) {
  #chat-panel {
    width: 100vw;
    right: 0;
    bottom: 0;
    border-radius: 16px 16px 0 0;
    max-height: 70vh;
  }
  #chat-toggle {
    bottom: 20px;
    right: 20px;
  }
}
