#hermes-chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#hermes-chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #1d4ed8;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, background 0.15s ease;
}

#hermes-chat-toggle:hover {
  background: #1e40af;
  transform: scale(1.05);
}

#hermes-chat-window {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 490px;
  max-height: calc(100vh - 110px);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#hermes-chat-window[hidden],
#hermes-prechat-form[hidden],
#hermes-chat-messages[hidden],
#hermes-chat-form[hidden],
#hermes-chat-clear[hidden],
#hermes-prechat-error[hidden] {
  display: none;
}

.hermes-chat-header {
  background: #1d4ed8;
  color: #ffffff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 15px;
}

.hermes-chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#hermes-chat-clear {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #ffffff;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

#hermes-chat-close {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

/* Pre-chat Lead & Anti-Bot Gate */
#hermes-prechat-form {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  background: #f9fafb;
}

.hermes-prechat-intro {
  margin: 0 0 4px 0;
  font-size: 13.5px;
  color: #374151;
  line-height: 1.4;
}

.hermes-field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #1f2937;
  margin-top: 2px;
}

#hermes-prechat-form input[type="text"],
#hermes-prechat-form input[type="tel"] {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  background: #ffffff;
  color: #111827;
  outline: none;
}

#hermes-prechat-form input:focus {
  border-color: #1d4ed8;
}

#hermes-human-check-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.hermes-hp-wrap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.hermes-prechat-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
}

#hermes-prechat-submit {
  margin-top: 6px;
  background: #1d4ed8;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

#hermes-prechat-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Active Chat Messages */
#hermes-chat-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f9fafb;
}

.hermes-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.hermes-msg-user {
  align-self: flex-end;
  background: #1d4ed8;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.hermes-msg-assistant {
  align-self: flex-start;
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}

.hermes-msg-typing {
  opacity: 0.7;
  font-style: italic;
}

.hermes-msg-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

#hermes-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

#hermes-chat-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 14px;
  outline: none;
}

#hermes-chat-input:focus {
  border-color: #1d4ed8;
}

#hermes-chat-send {
  background: #1d4ed8;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

#hermes-chat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
