/* Stile chat JR Richmond — replica look & feel del bot Tiledesk ufficiale. */
:root {
  --jr-black: #000000;
  --jr-header: #0a0a0a;
  --jr-pink: #e05e91;
  --jr-bot-bg: #f4f4f5;
  --jr-bot-text: #262626;
  --jr-user-bg: #111111;
  --jr-btn-border: #d9d9d9;
  --jr-btn-hover: #f2f2f2;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--jr-black);
  color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-bg {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
  pointer-events: none;
}
.brand-logo-img {
  width: clamp(240px, 55vw, 680px);
  height: auto;
  opacity: .95;
  user-select: none;
}
#chat-app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  height: 100vh;
  max-height: 780px;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .5);
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--jr-header);
  color: #fff;
}
.chat-title { font-weight: 700; font-size: 16px; letter-spacing: .02em; }
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
}
.msg-bot { display: flex; align-items: flex-start; gap: 8px; max-width: 88%; }
.avatar {
  flex: 0 0 26px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #e6e6e6;
  display: flex; align-items: center; justify-content: center;
  margin-top: 18px;
  color: #9a9a9a;
  font-size: 14px;
}
.msg-content { display: flex; flex-direction: column; gap: 3px; }
.sender { color: var(--jr-pink); font-size: 12px; font-weight: 600; padding-left: 2px; }
.bubble {
  padding: 11px 14px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 14.5px;
  line-height: 1.45;
  animation: pop .15s ease;
}
.bubble.bot {
  background: var(--jr-bot-bg);
  color: var(--jr-bot-text);
  border-top-left-radius: 4px;
}
.bubble.user {
  align-self: flex-end;
  background: var(--jr-user-bg);
  color: #fff;
  border-bottom-right-radius: 4px;
  max-width: 82%;
}
.bubble.system {
  align-self: center;
  background: transparent;
  color: #a0a0a0;
  font-size: 12px;
  padding: 2px;
}
.bubble a { color: inherit; }
.buttons {
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-self: flex-start;
  width: 88%;
  padding-left: 34px;
}
.choice-btn {
  padding: 11px 16px;
  border: 1px solid var(--jr-btn-border);
  background: #fff;
  color: var(--jr-bot-text);
  border-radius: 22px;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  transition: background .15s, border-color .15s;
}
.choice-btn:hover { background: var(--jr-btn-hover); border-color: #bdbdbd; }
.choice-btn:disabled { opacity: .5; cursor: default; }
.choice-btn.selected { background: #111; color: #fff; border-color: #111; }
.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #ececec;
  background: #fff;
}
#user-input {
  flex: 1;
  padding: 11px 8px;
  border: none;
  font-size: 15px;
  outline: none;
  background: transparent;
}
#send-btn {
  width: 40px; height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--jr-black);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  flex: 0 0 40px;
}
#send-btn:disabled { opacity: .35; cursor: default; }
@keyframes pop { from { transform: translateY(4px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 768px) {
  body { justify-content: flex-end; }
  #chat-app {
    border-radius: 14px;
    height: 92vh;
    margin-right: 40px;
  }
}
