/* ===== CHAT BUTTON ===== */
#ai-chat-btn {
  position: fixed;
  bottom: 18px;
  right: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: #fff;
  font-size: 26px;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  z-index: 9999;
}

/* ===== CHAT BOX ===== */
#ai-chat-box {
  position: fixed;
  bottom: 90px;
  right: 18px;
  width: 320px;
  max-height: 420px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
}

/* Aperta */
#ai-chat-box.open {
  display: flex;
}

/* ===== HEADER ===== */
.ai-chat-header {
  background: #1e3a8a;
  color: #fff;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-chat-header button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

/* ===== MESSAGES ===== */
#ai-chat-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: #f8fafc;
  font-size: 0.9rem;
}

#ai-chat-messages .me {
  background: #2563eb;
  color: #fff;
  padding: 8px 10px;
  border-radius: 12px 12px 0 12px;
  margin-bottom: 8px;
  align-self: flex-end;
  max-width: 85%;
}

#ai-chat-messages .bot {
  background: #e5e7eb;
  color: #111;
  padding: 8px 10px;
  border-radius: 12px 12px 12px 0;
  margin-bottom: 8px;
  max-width: 85%;
}

/* ===== INPUT ===== */
#ai-chat-form {
  display: flex;
  border-top: 1px solid #e5e7eb;
}

#ai-chat-input {
  flex: 1;
  border: none;
  padding: 10px;
  font-size: 0.9rem;
}

#ai-chat-input:focus {
  outline: none;
}

#ai-chat-form button {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 0 14px;
  cursor: pointer;
}


.ai-thinking {
  padding: 8px 12px;
  margin: 6px 0;
  background: #f1f5f9;
  border-radius: 12px;
  font-style: italic;
  color: #555;
}

.ai-message {
  padding: 8px 12px;
  margin: 6px 0;
  background: #e5f0ff;
  border-radius: 12px;
  line-height: 1.4;
}

.ai-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.ai-btn {
  background: #2563eb;
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.9rem;
}

.ai-btn:hover {
  background: #1e40af;
}
