/* ============================================
   EUTECH AI CHAT WIDGET
   ============================================ */

.chat-fab {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: 1050;
}
.chat-fab-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e5631, #2FA4D7);
  border: none;
  color: #fff;
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(30, 86, 49, 0.4);
  transition: .25s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.chat-fab-btn:hover { transform: scale(1.08); box-shadow: 0 8px 30px rgba(30, 86, 49, 0.5); }
.chat-fab-btn .icon-chat,
.chat-fab-btn .icon-close { transition: opacity .2s, transform .2s; }
.chat-fab-btn .icon-close { position: absolute; opacity: 0; transform: rotate(-45deg); }
.chat-fab.open .chat-fab-btn .icon-chat { opacity: 0; transform: rotate(45deg); }
.chat-fab.open .chat-fab-btn .icon-close { opacity: 1; transform: rotate(0); }
.chat-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: #22c55e; position: absolute; top: 2px; right: 2px;
  border: 2px solid #fff; animation: pulse-dot 2s infinite;
}
.chat-fab.open .chat-dot { display: none; }
@keyframes pulse-dot { 0%,100%{transform:scale(1)} 50%{transform:scale(1.3)} }

.chat-bubble-hint {
  position: absolute;
  right: 68px;
  bottom: 12px;
  background: #fff;
  color: #1a1a2e;
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  font-size: 13px;
  white-space: nowrap;
  animation: hint-in .4s ease both, hint-out .4s ease 5s both;
}
@keyframes hint-in { from { opacity:0; transform: translateX(10px);} to {opacity:1; transform:translateX(0);} }
@keyframes hint-out { to { opacity:0; visibility:hidden; } }

.chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1049;
  opacity: 0;
  transform: translateY(20px) scale(.96);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-header {
  background: linear-gradient(135deg, #1e5631, #155724);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.chat-header .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem; flex-shrink: 0;
  position: relative;
}
.chat-header .avatar .status-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #22c55e;
  position: absolute; bottom: 0; right: 0; border: 2px solid #1e5631;
}
.chat-header .title { color: #fff; font-weight: 700; font-size: .95rem; margin: 0; line-height: 1.2; }
.chat-header .subtitle { color: rgba(255,255,255,.7); font-size: .72rem; margin: 0; }
.chat-header .chat-close-btn {
  margin-left: auto; background: none; border: none; color: rgba(255,255,255,.8);
  font-size: 1.1rem; cursor: pointer; padding: 4px;
}
.chat-header .chat-close-btn:hover { color: #fff; }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  background: #f8faf9;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-body::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-thumb { background: #cfdcd2; border-radius: 10px; }

.chat-msg { display: flex; gap: 8px; max-width: 90%; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg .bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: .85rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.chat-msg.bot .bubble { background: #fff; color: #1a1a2e; border: 1px solid #e8ede9; border-top-left-radius: 4px; }
.chat-msg.user .bubble { background: #1e5631; color: #fff; border-top-right-radius: 4px; }
.chat-msg .mini-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: .7rem;
}
.chat-msg.bot .mini-avatar { background: #1e5631; color: #fff; }
.chat-msg.user .mini-avatar { background: #2FA4D7; color: #fff; }

.chat-typing { display: flex; gap: 4px; padding: 12px 14px; background: #fff; border: 1px solid #e8ede9; border-radius: 14px; border-top-left-radius: 4px; width: fit-content; }
.chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: #9ab3a0; animation: typing-bounce 1.2s infinite; }
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce { 0%,60%,100%{transform:translateY(0);opacity:.5} 30%{transform:translateY(-5px);opacity:1} }

.chat-suggestions {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px;
  flex-shrink: 0;
}
.chat-suggestion-chip {
  font-size: .72rem;
  padding: 6px 12px;
  border-radius: 50px;
  border: 1px solid #d7e3da;
  background: #fff;
  color: #1e5631;
  cursor: pointer;
  transition: .2s;
  white-space: nowrap;
}
.chat-suggestion-chip:hover { background: #1e5631; color: #fff; border-color: #1e5631; }

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #eef1ee;
  background: #fff;
  flex-shrink: 0;
}
.chat-input-row textarea {
  flex: 1;
  resize: none;
  border: 1px solid #dee5e0;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: .85rem;
  font-family: inherit;
  max-height: 90px;
  outline: none;
  transition: .2s;
}
.chat-input-row textarea:focus { border-color: #1e5631; box-shadow: 0 0 0 3px rgba(30,86,49,.1); }
.chat-send-btn {
  width: 38px; height: 38px; border-radius: 10px; border: none; flex-shrink: 0;
  background: #1e5631; color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: .2s; font-size: .9rem;
}
.chat-send-btn:hover { background: #2FA4D7; }
.chat-send-btn:disabled { background: #c7d2cb; cursor: not-allowed; }

.chat-footer-note {
  text-align: center;
  font-size: .65rem;
  color: #9ba8a0;
  padding: 6px 0 10px;
  flex-shrink: 0;
}
.chat-footer-note a { color: #1e5631; text-decoration: none; }

@media (max-width: 480px) {
  .chat-panel {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 88px;
    height: calc(100vh - 160px);
  }
  .chat-fab { right: 16px; bottom: 16px; }
  .chat-bubble-hint { right: 64px; }
}
