/* Robomap landing AI chat — grayscale only (matches WooCommerce plugin palette). */

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;1,8..60,400&display=swap");

:root {
  --rm-chat-black: #0a0a0a;
  --rm-chat-ink: #171717;
  --rm-chat-muted: #6b6b6b;
  --rm-chat-soft: #f4f4f4;
  --rm-chat-softer: #fafafa;
  --rm-chat-white: #ffffff;
  --rm-chat-hairline: #e5e5e5;
  --rm-chat-shadow: 0 8px 24px rgba(10, 10, 10, 0.12);
  --rm-chat-radius: 1.35rem;
  --rm-chat-sans: "DM Sans", "Segoe UI", sans-serif;
  --rm-chat-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

html[data-theme="dark"] {
  --rm-chat-black: #fafafa;
  --rm-chat-ink: #f4f4f4;
  --rm-chat-muted: #a3a3a3;
  --rm-chat-soft: #262626;
  --rm-chat-softer: #171717;
  --rm-chat-white: #0a0a0a;
  --rm-chat-hairline: #404040;
  --rm-chat-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.rm-chat {
  position: fixed;
  z-index: 10040;
  right: 1rem;
  bottom: 1rem;
  font-family: var(--rm-chat-sans);
  color: var(--rm-chat-ink);
  /* Hidden until GET /api/chat confirms the server key is configured. */
  display: none;
}

.rm-chat.is-ready {
  display: block;
}

.rm-chat__launcher {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: 999px;
  background: #0a0a0a;
  color: #ffffff;
  font-family: var(--rm-chat-sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--rm-chat-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

html[data-theme="dark"] .rm-chat__launcher {
  background: #fafafa;
  color: #0a0a0a;
}

.rm-chat__launcher:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(10, 10, 10, 0.16);
}

.rm-chat__launcher:focus-visible {
  outline: 2px solid var(--rm-chat-ink);
  outline-offset: 3px;
}

.rm-chat__launcher-icon {
  display: inline-flex;
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.rm-chat__launcher-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.rm-chat.is-open .rm-chat__launcher {
  display: none;
}

.rm-chat__panel {
  display: none;
  flex-direction: column;
  width: min(380px, calc(100vw - 2rem));
  height: min(560px, calc(100vh - 2rem));
  max-height: calc(100vh - 2rem);
  border: 1px solid var(--rm-chat-hairline);
  border-radius: var(--rm-chat-radius);
  background: var(--rm-chat-white);
  box-shadow: var(--rm-chat-shadow);
  overflow: hidden;
}

.rm-chat.is-open .rm-chat__panel {
  display: flex;
}

.rm-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid var(--rm-chat-hairline);
  background: var(--rm-chat-softer);
}

.rm-chat__title {
  margin: 0;
  font-family: var(--rm-chat-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--rm-chat-ink);
}

.rm-chat__subtitle {
  margin: 0.15rem 0 0;
  font-family: var(--rm-chat-sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--rm-chat-muted);
}

.rm-chat__close {
  width: 2.25rem;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--rm-chat-hairline);
  border-radius: 999px;
  background: var(--rm-chat-soft);
  color: var(--rm-chat-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.rm-chat__close:hover,
.rm-chat__close:focus-visible {
  color: var(--rm-chat-ink);
  background: var(--rm-chat-white);
  outline: none;
}

.rm-chat__close:focus-visible {
  outline: 2px solid var(--rm-chat-ink);
  outline-offset: 2px;
}

.rm-chat__messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
  background: var(--rm-chat-white);
}

.rm-chat__bubble {
  max-width: 88%;
  padding: 0.7rem 0.9rem;
  border-radius: 1rem;
  font-family: var(--rm-chat-serif);
  font-size: 0.95rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.rm-chat__bubble--user {
  align-self: flex-end;
  background: #0a0a0a;
  color: #ffffff;
  border-bottom-right-radius: 0.35rem;
}

html[data-theme="dark"] .rm-chat__bubble--user {
  background: #fafafa;
  color: #0a0a0a;
}

.rm-chat__bubble--assistant {
  align-self: flex-start;
  background: var(--rm-chat-white);
  color: var(--rm-chat-ink);
  border: 1px solid var(--rm-chat-hairline);
  border-bottom-left-radius: 0.35rem;
}

.rm-chat__bubble--thinking,
.rm-chat__bubble--error {
  align-self: flex-start;
  font-family: var(--rm-chat-sans);
  font-size: 0.85rem;
  color: var(--rm-chat-muted);
  background: var(--rm-chat-soft);
  border: 1px solid var(--rm-chat-hairline);
}

.rm-chat__bubble--error {
  color: var(--rm-chat-ink);
}

.rm-chat__retry {
  margin: 0.35rem 0 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--rm-chat-ink);
  font-family: var(--rm-chat-sans);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.rm-chat__retry:focus-visible {
  outline: 2px solid var(--rm-chat-ink);
  outline-offset: 2px;
}

.rm-chat__form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--rm-chat-hairline);
  background: var(--rm-chat-softer);
}

.rm-chat__input {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--rm-chat-hairline);
  border-radius: 999px;
  background: var(--rm-chat-soft);
  color: var(--rm-chat-ink);
  font-family: var(--rm-chat-serif);
  font-size: 0.95rem;
  line-height: 1.3;
}

.rm-chat__input::placeholder {
  color: var(--rm-chat-muted);
  font-family: var(--rm-chat-sans);
}

.rm-chat__input:focus {
  outline: none;
  border-color: var(--rm-chat-ink);
  background: var(--rm-chat-white);
}

.rm-chat__send {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: #0a0a0a;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html[data-theme="dark"] .rm-chat__send {
  background: #fafafa;
  color: #0a0a0a;
}

.rm-chat__send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.rm-chat__send:focus-visible {
  outline: 2px solid var(--rm-chat-ink);
  outline-offset: 2px;
}

.rm-chat__send svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

@media (max-width: 480px) {
  .rm-chat {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .rm-chat__panel {
    width: min(380px, calc(100vw - 1.5rem));
    height: min(70vh, calc(100vh - 1.5rem));
  }
}

@media (prefers-reduced-motion: reduce) {
  .rm-chat__launcher,
  .rm-chat__messages {
    transition: none;
    scroll-behavior: auto;
  }
}
