/* Spotted Chatbot - CSS */
:root {
  --chat-primary: #2C5F3F;
  --chat-secondary: #4A9E6B;
  --chat-accent: #F5A623;
  --chat-bg: #FFFFFF;
  --chat-user-bg: #2C5F3F;
  --chat-bot-bg: #F4F7F5;
  --chat-shadow: 0 8px 32px rgba(44,95,63,0.18);
}

/* Widget flottante */
#spotted-chat-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99999;
  font-family: 'Georgia', serif;
}

/* Bottone apri */
#spotted-chat-toggle {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
  border: none;
  cursor: pointer;
  box-shadow: var(--chat-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
#spotted-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(44,95,63,0.28);
}
#spotted-chat-toggle svg {
  width: 28px;
  height: 28px;
  fill: white;
}
#spotted-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--chat-accent);
  color: white;
  font-size: 10px;
  font-weight: bold;
  border-radius: 10px;
  padding: 2px 6px;
  font-family: sans-serif;
  display: none;
}

/* Finestra chat */
#spotted-chat-window {
  display: none;
  flex-direction: column;
  position: absolute;
  bottom: 74px;
  right: 0;
  width: 360px;
  height: 520px;
  background: var(--chat-bg);
  border-radius: 16px;
  box-shadow: var(--chat-shadow);
  overflow: hidden;
  animation: chatSlideIn 0.25s ease;
}
#spotted-chat-window.open {
  display: flex;
}

@keyframes chatSlideIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
#spotted-chat-header {
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
  color: white;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
#spotted-chat-header .avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
#spotted-chat-header .info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
#spotted-chat-header .info span {
  font-size: 11px;
  opacity: 0.85;
  font-family: sans-serif;
}
#spotted-chat-close {
  margin-left: auto;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  opacity: 0.8;
  padding: 0;
}
#spotted-chat-close:hover { opacity: 1; }

/* Messaggi */
#spotted-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#spotted-chat-messages::-webkit-scrollbar { width: 4px; }
#spotted-chat-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
  animation: msgIn 0.2s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg.bot {
  background: var(--chat-bot-bg);
  color: #222;
  border-radius: 4px 14px 14px 14px;
  align-self: flex-start;
  white-space: pre-line;
}
.chat-msg.user {
  background: var(--chat-user-bg);
  color: white;
  border-radius: 14px 4px 14px 14px;
  align-self: flex-end;
  font-family: sans-serif;
}
.chat-msg a { color: var(--chat-secondary); text-decoration: underline; }
.chat-msg.user a { color: #aef; }
.chat-msg strong { font-weight: 700; }

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 10px 14px;
  background: var(--chat-bot-bg);
  border-radius: 4px 14px 14px 14px;
  align-self: flex-start;
  width: 58px;
}
.chat-typing span {
  width: 7px;
  height: 7px;
  background: #aaa;
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); background: #bbb; }
  40% { transform: translateY(-6px); background: var(--chat-secondary); }
}

/* Suggerimenti rapidi */
#spotted-chat-suggestions {
  padding: 6px 14px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.chat-suggestion {
  background: none;
  border: 1.5px solid var(--chat-primary);
  color: var(--chat-primary);
  border-radius: 20px;
  padding: 4px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: sans-serif;
}
.chat-suggestion:hover {
  background: var(--chat-primary);
  color: white;
}

/* Input */
#spotted-chat-input-area {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid #eee;
  gap: 8px;
  flex-shrink: 0;
}
#spotted-chat-input {
  flex: 1;
  border: 1.5px solid #e0e0e0;
  border-radius: 24px;
  padding: 9px 14px;
  font-size: 13.5px;
  outline: none;
  resize: none;
  font-family: sans-serif;
  line-height: 1.4;
  max-height: 80px;
  overflow-y: auto;
}
#spotted-chat-input:focus { border-color: var(--chat-secondary); }
#spotted-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--chat-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
#spotted-chat-send:hover { background: var(--chat-secondary); }
#spotted-chat-send svg { width: 17px; height: 17px; fill: white; }

/* Mobile */
@media (max-width: 480px) {
  #spotted-chat-window {
    width: calc(100vw - 32px);
    right: -14px;
    height: 70vh;
    bottom: 70px;
  }
}
