:root {
  --um-chat-primary: #0f2a44;
  --um-chat-primary-dark: #071a2d;
  --um-chat-accent: #d62828;
  --um-chat-bg: #ffffff;
  --um-chat-text: #1a1a1a;
  --um-chat-muted: #5f6772;
  --um-chat-border: #e3e9f2;
}

.um-chat-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1500;
  font-family: Inter, Arial, sans-serif;
  color: var(--um-chat-text);
  line-height: 1.35;
}

.um-chat-launcher {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  border: 0;
  border-radius: 999px;
  padding: 10px 22px 10px 10px;
  background: var(--um-chat-primary);
  color: #fff;
  box-shadow: 0 12px 34px rgba(15, 42, 68, 0.28);
  cursor: pointer;
  font-weight: 800;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.um-chat-launcher:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 42px rgba(15, 42, 68, 0.32);
}

.um-chat-launcher-avatar {
  position: relative;
  display: inline-flex;
}

.um-chat-launcher-avatar .um-chat-avatar {
  width: 64px;
  height: 64px;
  border-width: 3px;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.22);
}

.um-chat-launcher-avatar .um-chat-dot {
  position: absolute;
  right: 3px;
  bottom: 4px;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
}

.um-chat-launcher-text {
  display: grid;
  gap: 1px;
}

.um-chat-launcher-text strong {
  font-size: 16px;
  line-height: 1.15;
}

.um-chat-launcher-text small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 700;
}

.um-chat-launcher.is-pulsing {
  animation: um-chat-pulse 1.35s ease-in-out 2;
}

@keyframes um-chat-pulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.035); }
}

.um-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  object-fit: cover;
  background: #fff;
  border: 2px solid rgba(255, 255, 255, 0.88);
}

.um-chat-prompt {
  position: absolute;
  right: 0;
  bottom: 70px;
  width: min(310px, calc(100vw - 34px));
  background: #fff;
  border: 1px solid var(--um-chat-border);
  border-radius: 12px;
  padding: 12px 38px 12px 14px;
  box-shadow: 0 12px 34px rgba(15, 42, 68, 0.18);
  font-size: 14px;
  animation: um-chat-float-in 220ms ease both;
}

.um-chat-prompt::after {
  content: "";
  position: absolute;
  right: 24px;
  bottom: -7px;
  width: 13px;
  height: 13px;
  background: #fff;
  border-right: 1px solid var(--um-chat-border);
  border-bottom: 1px solid var(--um-chat-border);
  transform: rotate(45deg);
}

.um-chat-prompt strong {
  display: block;
  color: var(--um-chat-primary);
}

.um-chat-prompt button {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  background: transparent;
  color: var(--um-chat-muted);
  cursor: pointer;
  font-size: 18px;
}

.um-chat-window {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(410px, calc(100vw - 34px));
  max-height: min(680px, calc(100vh - 110px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #fff;
  border: 1px solid var(--um-chat-border);
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(15, 42, 68, 0.26);
  overflow: hidden;
  animation: um-chat-float-in 180ms ease both;
}

.um-chat-window[hidden],
.um-chat-prompt[hidden] {
  display: none;
}

.um-chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: linear-gradient(135deg, var(--um-chat-primary), var(--um-chat-primary-dark));
  color: #fff;
}

.um-chat-header > .um-chat-avatar {
  width: 56px;
  height: 56px;
  border-width: 3px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.um-chat-header-text {
  flex: 1;
  min-width: 0;
}

.um-chat-header-text strong {
  display: block;
  line-height: 1.15;
}

.um-chat-header-text span {
  display: block;
  opacity: 0.86;
  font-size: 12px;
}

.um-chat-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
}

.um-chat-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #9ca3af;
}

.um-chat-dot.online {
  background: #2fd36f;
}

.um-chat-dot.away {
  background: #f2a928;
}

.um-chat-close {
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 20px;
}

.um-chat-body {
  padding: 14px;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0)),
    #f7f9fc;
}

.um-chat-message {
  display: flex;
  gap: 9px;
  margin-bottom: 10px;
}

.um-chat-message.visitor {
  justify-content: flex-end;
}

.um-chat-message .um-chat-avatar {
  width: 34px;
  height: 34px;
  border-width: 2px;
}

.um-chat-bubble {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 13px;
  background: #fff;
  border: 1px solid var(--um-chat-border);
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 4px 14px rgba(15, 42, 68, 0.05);
}

.um-chat-message.visitor .um-chat-bubble {
  background: var(--um-chat-primary);
  border-color: var(--um-chat-primary);
  color: #fff;
}

.um-chat-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 13px;
  background: #fff;
  border: 1px solid var(--um-chat-border);
  border-radius: 12px;
}

.um-chat-form h3 {
  margin: 0;
  color: var(--um-chat-primary);
  font-size: 20px;
}

.um-chat-form p {
  margin: 0;
  color: var(--um-chat-muted);
  font-size: 14px;
}

.um-chat-form input,
.um-chat-form textarea {
  width: 100%;
  border: 1px solid #cfd7e2;
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
  font-size: 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.um-chat-form label {
  display: grid;
  gap: 5px;
  color: var(--um-chat-primary);
  font-size: 12px;
  font-weight: 800;
}

.um-chat-form label span {
  color: var(--um-chat-muted);
  font-weight: 700;
}

.um-chat-form input:focus,
.um-chat-form textarea:focus,
.um-chat-send input:focus {
  border-color: var(--um-chat-primary);
  box-shadow: 0 0 0 3px rgba(15, 42, 68, 0.1);
  outline: none;
}

.um-chat-form textarea {
  min-height: 92px;
  resize: vertical;
}

.um-chat-form button,
.um-chat-send button {
  border: 0;
  border-radius: 8px;
  background: var(--um-chat-accent);
  color: #fff;
  padding: 11px 14px;
  font-weight: 800;
  cursor: pointer;
  transition: filter 150ms ease, transform 150ms ease;
}

.um-chat-form button:hover,
.um-chat-send button:hover {
  filter: brightness(0.96);
}

.um-chat-form button:disabled,
.um-chat-send button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.um-chat-error {
  color: #9f1d1d;
  background: #fff0f0;
  border: 1px solid #f2c1c1;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
}

.um-chat-footer {
  padding: 12px;
  border-top: 1px solid var(--um-chat-border);
  background: #fff;
}

.um-chat-send {
  display: flex;
  gap: 8px;
}

.um-chat-send input {
  flex: 1;
  min-width: 0;
  border: 1px solid #cfd7e2;
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
}

.um-chat-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 6px 0 10px 37px;
}

.um-chat-topics button {
  border: 1px solid var(--um-chat-border);
  border-radius: 999px;
  background: #fff;
  color: var(--um-chat-primary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 9px;
}

.um-chat-success {
  display: grid;
  gap: 4px;
  margin: 12px 0 4px 37px;
  padding: 12px;
  background: #edf9f2;
  border: 1px solid #bde7cc;
  border-radius: 12px;
  color: #0f5f3a;
}

.um-chat-success strong {
  font-size: 14px;
}

.um-chat-success span {
  font-size: 13px;
}

.um-chat-privacy {
  margin-top: 8px;
  color: var(--um-chat-muted);
  font-size: 11px;
}

.um-chat-honeypot {
  position: absolute;
  left: -9999px;
}

@keyframes um-chat-float-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 560px) {
  .um-chat-widget {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .um-chat-launcher {
    margin-left: auto;
    max-width: calc(100vw - 24px);
  }

  .um-chat-window {
    left: 0;
    right: 0;
    width: 100%;
    bottom: 72px;
    height: min(640px, calc(100vh - 94px));
    max-height: calc(100vh - 94px);
    border-radius: 14px;
  }

  .um-chat-prompt {
    right: 0;
    width: min(320px, 100%);
  }

  .um-chat-topics,
  .um-chat-success {
    margin-left: 0;
  }
}

@media (max-width: 380px) {
  .um-chat-launcher-avatar .um-chat-avatar {
    width: 56px;
    height: 56px;
  }

  .um-chat-launcher-text small {
    display: none;
  }
}
