/* Chatbot styles */
/* Chatbot — estils principals*/
#chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: 'DM Sans', sans-serif;
}

/* Chat window (modal flotant) */
/* Finestra del xat: contenidor, box-shadow i layout vertical */
#chat-window {
  width: 340px;
  max-height: 480px;
  background: #fff;
  border: 1px solid #d8d0c0;
  border-radius: 16px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(26, 26, 20, 0.13);
}

/* Header del xat */
/* Capçalera amb avatar i títol */
#chat-header {
  background: #1a1a14;
  color: #f5f0e8;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 16px 16px 0 0;
}

.ferreret-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #4a7c59;
  flex-shrink: 0;
  background: linear-gradient(135deg, #2d4a2a, #4a7c59);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

/* Header info i controls */
#chat-header-info { flex: 1; }
#chat-header-name  { font-size: 0.88rem; font-weight: 700; }
#chat-header-sub   { font-size: 0.72rem; opacity: 0.6; }

/* Botó de tancament */
#chat-close {
  background: none;
  border: none;
  color: #f5f0e8;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.7;
  padding: 2px 6px;
}

/* Contenidor de missatges */
/* Àrea amb scroll per missatges de bot i usuari */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f5f0e8;
  max-height: 300px;
}

.msg-bot,
.msg-user {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 0.83rem;
  line-height: 1.55;
}

.msg-bot {
  background: #fff;
  border: 1px solid #d8d0c0;
  color: #1a1a14;
  align-self: flex-start;
  border-radius: 4px 12px 12px 12px;
}

.msg-user {
  background: #2d4a2a;
  color: #f5f0e8;
  align-self: flex-end;
  border-radius: 12px 4px 12px 12px;
}

.msg-bot b { color: #2d4a2a; }

/* Suggeriments ràpids */
/* Botons de suggeriment que l'usuari pot prémer */
#chat-suggestions {
  padding: 8px 10px;
  background: #f5f0e8;
  border-top: 1px solid #e0d8cc;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.sug-btn {
  background: #fff;
  border: 1px solid #c3b8a5;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.74rem;
  color: #2d4a2a;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s;
}

.sug-btn:hover { background: #eae4d6; }

/* Fila d'entrada */
/* Input, botó d'enviar i separador */
#chat-input-row {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid #d8d0c0;
  background: #fff;
}

/* Input text */
#chat-input {
  flex: 1;
  border: 1px solid #d8d0c0;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  background: #f5f0e8;
  color: #1a1a14;
}

/* Botó d'enviar */
#chat-send {
  background: #2d4a2a;
  color: #f5f0e8;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}

/* Botó flotant (FAB) */
/* Bimbolla flotant que obre el xat */
#chat-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #2d4a2a;
  border: 3px solid #4a7c59;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(26, 46, 30, 0.28);
  font-size: 26px;
  color: #f5f0e8;
  transition: transform 0.2s;
  overflow: hidden;
}

#chat-fab:hover { transform: scale(1.08); }

.estat-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 0.71rem;
  font-weight: 700;
  color: #fff;
  margin-left: 4px;
}

.badge-critic     { background: #8b1a1a; }
.badge-perill     { background: #c44b2b; }
.badge-vulnerable { background: #e8a030; color: #2a2112; }