/* StetoRadr site chatbot — brand-aligned floating assistant */
.steto-chat {
  --sc-crimson: #920932;
  --sc-crimson-deep: #6e0625;
  --sc-cream: #fcf6f2;
  --sc-text: #1a1214;
  --sc-muted: rgba(26, 18, 20, 0.62);
  --sc-border: rgba(146, 9, 50, 0.16);
  --sc-shadow: 0 12px 40px rgba(60, 10, 24, 0.18);
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  color: var(--sc-text);
}

.steto-chat *,
.steto-chat *::before,
.steto-chat *::after {
  box-sizing: border-box;
}

.steto-chat-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--sc-border);
  background: var(--sc-crimson);
  color: #fff;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--sc-shadow);
  transition: background 0.15s ease, transform 0.15s ease;
}

.steto-chat-toggle:hover {
  background: var(--sc-crimson-deep);
}

.steto-chat-toggle:focus-visible {
  outline: 2px solid var(--sc-crimson);
  outline-offset: 3px;
}

.steto-chat-toggle-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.steto-chat-panel {
  display: none;
  width: min(360px, calc(100vw - 24px));
  height: min(520px, calc(100vh - 40px));
  flex-direction: column;
  background: var(--sc-cream);
  border: 1px solid var(--sc-border);
  border-radius: 16px;
  box-shadow: var(--sc-shadow);
  overflow: hidden;
}

.steto-chat.is-open .steto-chat-panel {
  display: flex;
}

.steto-chat.is-open .steto-chat-toggle {
  display: none;
}

.steto-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  background: #fff;
  border-bottom: 1px solid var(--sc-border);
}

.steto-chat-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--sc-crimson);
  line-height: 1.25;
}

.steto-chat-sub {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: var(--sc-muted);
  line-height: 1.35;
}

.steto-chat-close {
  border: 0;
  background: transparent;
  color: var(--sc-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  flex: 0 0 auto;
}

.steto-chat-close:hover {
  background: rgba(146, 9, 50, 0.08);
  color: var(--sc-crimson);
}

.steto-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(250, 191, 107, 0.18), transparent 55%),
    var(--sc-cream);
}

.steto-chat-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.steto-chat-bubble.has-md {
  white-space: normal;
}

.steto-chat-bubble.has-md p {
  margin: 0 0 0.55em;
}

.steto-chat-bubble.has-md p:last-child {
  margin-bottom: 0;
}

.steto-chat-bubble.has-md h1,
.steto-chat-bubble.has-md h2,
.steto-chat-bubble.has-md h3 {
  margin: 0.65em 0 0.35em;
  font-weight: 700;
  line-height: 1.25;
  color: var(--sc-crimson);
}

.steto-chat-bubble.has-md h1:first-child,
.steto-chat-bubble.has-md h2:first-child,
.steto-chat-bubble.has-md h3:first-child {
  margin-top: 0;
}

.steto-chat-bubble.has-md h1 { font-size: 1.05rem; }
.steto-chat-bubble.has-md h2 { font-size: 0.98rem; }
.steto-chat-bubble.has-md h3 { font-size: 0.92rem; }

.steto-chat-bubble.has-md strong {
  font-weight: 700;
  color: var(--sc-text);
}

.steto-chat-bubble.has-md em {
  font-style: italic;
}

.steto-chat-bubble.has-md ul,
.steto-chat-bubble.has-md ol {
  margin: 0.35em 0 0.55em;
  padding-left: 1.25em;
}

.steto-chat-bubble.has-md li {
  margin: 0.2em 0;
}

.steto-chat-bubble.has-md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84em;
  background: rgba(146, 9, 50, 0.08);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.steto-chat-bubble.has-md a {
  color: var(--sc-crimson);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.steto-chat-bubble.assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--sc-border);
  color: var(--sc-text);
}

.steto-chat-bubble.user {
  align-self: flex-end;
  background: var(--sc-crimson);
  color: #fff;
}

.steto-chat-bubble.system {
  align-self: stretch;
  background: rgba(146, 9, 50, 0.06);
  border: 1px dashed var(--sc-border);
  color: var(--sc-muted);
  font-size: 0.8rem;
}

.steto-chat-bubble.pending {
  opacity: 0.72;
  font-style: italic;
}

.steto-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--sc-border);
  background: #fff;
}

.steto-chat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--sc-border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.88rem;
  background: var(--sc-cream);
  color: var(--sc-text);
  resize: none;
  min-height: 42px;
  max-height: 96px;
}

.steto-chat-input:focus {
  outline: 2px solid rgba(146, 9, 50, 0.35);
  outline-offset: 1px;
}

.steto-chat-send {
  border: 0;
  border-radius: 10px;
  background: var(--sc-crimson);
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0 14px;
  cursor: pointer;
  flex: 0 0 auto;
}

.steto-chat-send:hover:not(:disabled) {
  background: var(--sc-crimson-deep);
}

.steto-chat-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.steto-chat-disclaimer {
  margin: 0;
  padding: 0 12px 10px;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--sc-muted);
  background: #fff;
}

.steto-chat-disclaimer a {
  color: var(--sc-crimson);
}

@media (max-width: 520px) {
  .steto-chat {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .steto-chat-toggle {
    width: 100%;
    justify-content: center;
  }

  .steto-chat-panel {
    width: 100%;
    height: min(70vh, 560px);
  }
}
