.crm-chat-launcher,
.crm-chat-widget {
  /* OPen Group téma — minden szín ezen az egy helyen módosítható. */
  --panel: rgba(255, 255, 255, 0.97);
  --panel-2: rgba(250, 250, 247, 0.98);
  --text: #1a1a1a;
  --text-on-brand: #ffffff;
  --muted: #4a4a52;
  --time: #888892;
  --line: #eae7e2;
  --line-soft: rgba(83, 68, 133, 0.09);
  --brand: #534485;
  --brand-deep: #3e3265;
  --brand-2: #fddc3d;
  --brand-3: #fea780;
  --brand-sea: #69b9aa;
  --brand-teal: #41a5cd;
  --user: #534485;
  --assistant: #fafaf7;
  --control: #ffffff;
  --control-hover: rgba(83, 68, 133, 0.08);
  --focus-ring: rgba(253, 220, 61, 0.28);
  --button-background: #534485;
  --button-background-hover: #fea780;
  --button-text: #ffffff;
  --button-radius: 0;
  --launcher-radius: 999px;
  --booking-button-background: #534485;
  --booking-button-background-hover: #fea780;
  --booking-button-text: #ffffff;
  --booking-button-font-weight: normal;
  --booking-button-radius: 0;
  --link-color: #534485;
  --link-color-hover: #fea780;
  --link-decoration: none;
  --header-gradient: linear-gradient(180deg, rgba(253, 220, 61, 0.28), rgba(254, 167, 128, 0.18));
  --brand-gradient: linear-gradient(135deg, var(--brand), var(--brand-deep));
  --messages-background:
    radial-gradient(circle at top right, rgba(253, 220, 61, 0.12), transparent 28%),
    radial-gradient(circle at bottom left, rgba(105, 185, 170, 0.10), transparent 22%);
  --shadow: 0 20px 60px rgba(83, 68, 133, 0.22);
  --bubble-shadow: 0 8px 24px rgba(83, 68, 133, 0.10);
}

.crm-chat-launcher,
.crm-chat-widget,
.crm-chat-widget * { box-sizing: border-box; }
.crm-chat-widget { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); }
.crm-chat-widget a[href] { color: var(--link-color); text-decoration: var(--link-decoration); }
.crm-chat-widget a[href]:hover { color: var(--link-color-hover); text-decoration: var(--link-decoration); }

.hur54b { z-index:99999; }
.crm-chat-launcher {
  position: fixed; right: 24px; bottom: 24px; width: 64px; height: 64px; border: solid 2px #fff; border-radius: var(--launcher-radius);
  background: var(--button-background); color: var(--button-text); cursor: pointer;
  box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; z-index: 99999;
  transition: transform .2s ease, box-shadow .2s ease;
}
.crm-chat-launcher:hover { background: var(--button-background-hover); transform: translateY(-2px) scale(1.02); }
.crm-chat-launcher svg { width: 28px; height: 28px; }

.crm-chat-widget {
  position: fixed; right: 24px; bottom: 100px; width: min(400px, calc(100vw - 24px)); height: min(720px, calc(100vh - 140px));
  background: var(--panel); backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow);
  overflow: hidden; display: none; flex-direction: column; z-index: 99998; transform: translateY(16px) scale(0.98); opacity: 0;
  transform-origin: bottom right; transition: opacity .22s ease, transform .22s ease;
}
.crm-chat-widget.open { display: flex; opacity: 1; transform: translateY(0) scale(1); }

.crm-chat-header { padding: 18px 18px 14px; background: var(--header-gradient); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.crm-chat-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.crm-chat-avatar {
    border-radius: 999px;
    
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-on-brand);
    flex: 0 0 auto;
    background: url(ai-favicon.png) no-repeat center center;
    background-size: 60px 51px;
    width: 100px;
    height: 72px;
}

.crm-chat-title-wrap { min-width: 0; }
.crm-chat-title { font-size: 16px; font-weight: 700; line-height: 1.2; margin: 0; }
.crm-chat-subtitle { margin: 4px 0 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-chat-close { border: 0; background: var(--button-background); color: var(--button-text); width: 38px; height: 38px; border-radius: var(--button-radius); cursor: pointer; font-size: 18px; flex: 0 0 auto; transition: background-color .2s ease; }
.crm-chat-close:hover { background: var(--button-background-hover); }

.crm-chat-messages { flex: 1; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; background: var(--messages-background); scroll-behavior: smooth; }
.crm-chat-message-row { display: flex; width: 100%; }
.crm-chat-message-row.assistant { justify-content: flex-start; }
.crm-chat-message-row.user { justify-content: flex-end; }
.crm-chat-bubble { max-width: 84%; padding: 12px 14px; border-radius: 18px; line-height: 1.5; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; box-shadow: var(--bubble-shadow); border: 1px solid var(--line-soft); }
.crm-chat-message-row.assistant .crm-chat-bubble { background: var(--assistant); color: var(--text); border-top-left-radius: 8px; }
.crm-chat-message-row.user .crm-chat-bubble { background: var(--user); color: var(--text-on-brand); border-top-right-radius: 8px; }
.crm-chat-bubble a { color: var(--link-color); text-decoration: var(--link-decoration); }
.crm-chat-bubble a:hover { color: var(--link-color-hover); text-decoration: var(--link-decoration); }
.crm-chat-time { margin-top: 6px; font-size: 11px; color: var(--time); }
.crm-chat-message-row.user .crm-chat-time { color: rgba(255, 255, 255, 0.68); }

.crm-chat-typing { display: none; padding: 0 18px 10px; color: var(--muted); font-size: 12px; }
.crm-chat-typing.visible { display: block; }
.crm-chat-typing-dots { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.crm-chat-typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-2); opacity: .35; animation: blink 1.2s infinite ease-in-out; }
.crm-chat-typing-dots span:nth-child(2) { animation-delay: .15s; }
.crm-chat-typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { transform: translateY(0); opacity: .3; } 40% { transform: translateY(-2px); opacity: 1; } }

.crm-chat-footer { padding: 14px; border-top: 1px solid var(--line); background: var(--panel-2); }
.crm-chat-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.crm-chat-input { width: 100%; min-height: 48px; max-height: 140px; resize: none; border: 1px solid var(--line); border-radius: 16px; padding: 13px 14px; background: var(--control); color: var(--text); font: inherit; line-height: 1.45; outline: none; }
.crm-chat-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--focus-ring); }
.crm-chat-send { height: 48px; min-width: 48px; border: 0; border-radius: var(--button-radius); background: var(--button-background); color: var(--button-text); cursor: pointer; padding: 0 16px; font-weight: 700; transition: transform .2s ease, opacity .2s ease, background-color .2s ease; }
.crm-chat-send:hover { background: var(--button-background-hover); transform: translateY(-1px); }
.crm-chat-send:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.crm-chat-turnstile-wrap { margin-top: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.crm-chat-turnstile-note { font-size: 11px; color: var(--muted); display: none; }
.crm-chat-footnote { margin-top: 10px; font-size: 11px; color: var(--muted); text-align: left; }

.crm-chat-booking-holder { margin-top: 12px; }
.crm-chat-booking-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 0;
  border-radius: var(--booking-button-radius) !important;
  background: var(--booking-button-background) !important;
  color: var(--booking-button-text) !important;
  font-weight: var(--booking-button-font-weight) !important;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  box-shadow: var(--bubble-shadow);
  transition: background-color .2s ease;
}
.crm-chat-booking-button:hover {
  background: var(--booking-button-background-hover) !important;
}

@media (max-width: 640px) {
  .crm-chat-launcher { right: 16px; bottom: 16px; width: 58px; height: 58px; }
  .crm-chat-widget { right: 12px; left: 12px; width: auto; bottom: 86px; height: calc(100vh - 110px); border-radius: 22px; }
  .crm-chat-bubble { max-width: 90%; }
}
