.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 90px; /* clears the template's .scroll-top button (fixed, right:15px, bottom:15px) */
  z-index: 9999;
  font-family: var(--default-font);
}

.chat-widget-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent-color);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  cursor: pointer;
}

.chat-widget-panel {
  display: none;
  position: absolute;
  right: 0;
  bottom: 74px;
  width: 320px;
  max-width: calc(100vw - 40px);
  height: 420px;
  max-height: calc(100vh - 120px);
  background: var(--surface-color);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  flex-direction: column;
  overflow: hidden;
}

.chat-widget.open .chat-widget-panel {
  display: flex;
}

.chat-widget-header {
  background: var(--accent-color);
  color: #fff;
  padding: 14px 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-widget-header button {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.chat-widget-namegate {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 20px 16px;
  flex: 1;
}

.chat-widget-namegate p {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--default-color, #444444);
}

.chat-widget-namegate input {
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}

.chat-widget-namegate button {
  border: none;
  background: var(--accent-color);
  color: #fff;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-widget-msg {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-widget-msg.customer {
  align-self: flex-end;
  background: var(--accent-color);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-widget-msg.admin {
  align-self: flex-start;
  background: color-mix(in srgb, var(--default-color, #444444), transparent 92%);
  color: var(--default-color, #444444);
  border-bottom-left-radius: 4px;
}

.chat-widget-status {
  padding: 8px 12px;
  font-size: 13px;
  color: #b02a37;
  text-align: center;
}

.chat-widget-form {
  display: flex;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.chat-widget-form input {
  flex: 1;
  border: none;
  padding: 12px;
  font-size: 14px;
  outline: none;
}

.chat-widget-form button {
  border: none;
  background: var(--accent-color);
  color: #fff;
  padding: 0 16px;
  cursor: pointer;
}

.chat-widget-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
