/* Dream Credit chat assistant. Markup is built by assets/js/chat.js; colours and fonts come from the site tokens in style.css. */
.chat-launch { position: fixed; right: 18px; bottom: 90px; z-index: 96; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--navy-900, #001e3a); color: #fff; cursor: pointer; box-shadow: var(--shadow-lg, 0 24px 60px rgba(0, 30, 58, 0.16)); transition: transform 0.2s, opacity 0.2s; }
.chat-launch:hover { transform: scale(1.08); }
.chat-launch:focus-visible, .chat button:focus-visible, .chat textarea:focus-visible, .chat a:focus-visible { outline: 3px solid var(--orange-400, #b8956b); outline-offset: 2px; }
.chat-launch .ic { width: 26px; height: 26px; }
.chat-launch::after { display: none; }
.chat-launch { background: linear-gradient(135deg, #001e3a 0%, #001e3a 100%); box-shadow: 0 0 0 3px rgba(184, 149, 107, 0.45), var(--shadow-lg, 0 24px 60px rgba(0, 30, 58, 0.16)); animation: chatPulse 2.6s ease-in-out infinite; }
.chat-launch .ic { width: 30px; height: 30px; stroke-width: 1.8; }
.chat-ai-chip { position: absolute; top: -6px; right: -6px; min-width: 24px; padding: 3px 6px; border-radius: 999px; background: var(--matte-gold, #b8956b); color: #fff; font: 700 0.62rem/1 var(--font-head, system-ui, sans-serif); letter-spacing: 0.06em; border: 2px solid #fff; text-align: center; }
@keyframes chatPulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(184, 149, 107, 0.45), 0 12px 30px rgba(0, 30, 58, 0.25); } 50% { box-shadow: 0 0 0 9px rgba(184, 149, 107, 0.12), 0 12px 30px rgba(0, 30, 58, 0.25); } }
.chat-bot { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #b8956b, #8a7050); color: #fff; }
.chat-head .chat-bot { width: 44px; height: 44px; border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
.chat-head .chat-bot .ic { width: 32px; height: 32px; stroke-width: 1.7; }
.chat-ai-tag { font-style: normal; font: 700 0.62rem/1 var(--font-head, system-ui, sans-serif); letter-spacing: 0.06em; padding: 3px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.18); vertical-align: middle; margin-left: 4px; }
body.chat-on .chat-launch { opacity: 0; pointer-events: none; }

.chat-teaser { position: fixed; right: 84px; bottom: 98px; z-index: 96; max-width: 220px; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: #fff; color: var(--ink, #131f22); border: 1px solid var(--line, #e7dec3); box-shadow: var(--shadow-md, 0 10px 30px rgba(0, 30, 58, 0.09)); font: 500 0.88rem/1.35 var(--font-body, system-ui, sans-serif); cursor: pointer; opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity 0.3s, transform 0.3s; text-align: left; }
.chat-teaser.show { opacity: 1; transform: none; pointer-events: auto; }
.chat-teaser b { display: block; font: 600 0.9rem/1.3 var(--font-head, system-ui, sans-serif); color: var(--navy-900, #001e3a); }

.chat { position: fixed; right: 18px; bottom: 18px; z-index: 1800; width: 390px; max-width: calc(100vw - 24px); height: min(640px, calc(100vh - 36px)); height: min(640px, calc(100dvh - 36px)); display: flex; flex-direction: column; background: var(--bg, #f6f1dc); border: 1px solid var(--line, #e7dec3); border-radius: var(--r-lg, 24px); box-shadow: var(--shadow-lg, 0 24px 60px rgba(0, 30, 58, 0.16)); overflow: hidden; font-family: var(--font-body, system-ui, sans-serif); color: var(--ink, #131f22); opacity: 0; visibility: hidden; transform: translateY(14px) scale(0.98); transform-origin: bottom right; transition: opacity 0.22s, transform 0.22s, visibility 0s linear 0.22s; }
.chat.open { opacity: 1; visibility: visible; transform: none; transition: opacity 0.22s, transform 0.22s; }

.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; background: var(--navy-900, #001e3a); color: #fff; }
.chat-head img { width: 38px; height: 38px; border-radius: 50%; background: #fff; flex: none; }
.chat-head .t { flex: 1; min-width: 0; }
.chat-head b { display: block; font: 600 1rem/1.2 var(--font-head, system-ui, sans-serif); }
.chat-head span { display: block; margin-top: 2px; font-size: 0.78rem; color: rgba(255, 255, 255, 0.78); }
.chat-head button { flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.12); color: #fff; cursor: pointer; }
.chat-head button:hover { background: rgba(255, 255, 255, 0.22); }
.chat-head .ic { width: 18px; height: 18px; }
.chat-head .chat-x .ic { transform: rotate(45deg); }

.chat-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.chat-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 0.93rem; line-height: 1.5; overflow-wrap: anywhere; }
.chat-msg p { margin: 0; }
.chat-msg p + p, .chat-msg p + ul, .chat-msg ul + p { margin-top: 8px; }
.chat-msg ul { margin: 0; padding-left: 18px; }
.chat-msg li + li { margin-top: 3px; }
.chat-msg a { color: var(--navy-800, #001e3a); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.chat-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line, #e7dec3); border-bottom-left-radius: 4px; }
.chat-msg.me { align-self: flex-end; background: var(--navy-900, #001e3a); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.chat-src { align-self: flex-start; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: -4px; font-size: 0.8rem; color: var(--muted, #5a6468); }
.chat-src a { padding: 4px 10px; border: 1px solid var(--line, #e7dec3); border-radius: var(--r-pill, 999px); background: #fff; color: var(--navy-800, #001e3a); font-weight: 500; text-decoration: none; }
.chat-src a:hover { border-color: var(--navy-800, #001e3a); }

.chat-typing { align-self: flex-start; display: flex; gap: 5px; padding: 14px 16px; border-radius: 16px 16px 16px 4px; background: #fff; border: 1px solid var(--line, #e7dec3); }
.chat-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted, #5a6468); animation: chatDot 1.2s infinite ease-in-out; }
.chat-typing i:nth-child(2) { animation-delay: 0.15s; }
.chat-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatDot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-chips button { padding: 8px 12px; border: 1px solid var(--navy-800, #001e3a); border-radius: var(--r-pill, 999px); background: #fff; color: var(--navy-900, #001e3a); font: 500 0.84rem/1.25 var(--font-body, system-ui, sans-serif); text-align: left; cursor: pointer; transition: background 0.15s; }
.chat-chips button:hover { background: var(--blue-50, #f7f1d9); }

.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid var(--line, #e7dec3); }
.chat-form textarea { flex: 1; min-width: 0; box-sizing: border-box; height: 44px; min-height: 44px; max-height: 96px; margin: 0; resize: none; overflow-y: hidden; padding: 10px 12px; border: 1px solid var(--line, #e7dec3); border-radius: 14px; background: var(--bg, #f6f1dc); color: var(--ink, #131f22); font: 400 16px/1.4 var(--font-body, system-ui, sans-serif); }
.chat-form textarea::placeholder { color: var(--muted, #5a6468); }
.chat-form button { flex: none; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--orange-500, #a98c69); color: var(--navy-950, #00152b); cursor: pointer; transition: transform 0.15s, opacity 0.15s; }
.chat-form button:hover { transform: scale(1.06); }
.chat-form button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.chat-form .ic { width: 20px; height: 20px; }

.chat-foot { padding: 8px 12px 10px; background: #fff; border-top: 1px solid var(--line, #e7dec3); }
.chat-act { display: flex; gap: 8px; }
.chat-act a { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px; border-radius: var(--r-pill, 999px); background: var(--blue-50, #f7f1d9); color: var(--navy-900, #001e3a); font: 600 0.8rem/1 var(--font-head, system-ui, sans-serif); text-decoration: none; }
.chat-act a:hover { background: var(--blue-100, #ece4cb); }
.chat-act .ic { width: 16px; height: 16px; }
.chat-note { margin: 7px 2px 0; font-size: 0.7rem; line-height: 1.35; color: var(--muted, #5a6468); text-align: center; }

/* cb-lock normally freezes page scroll (the call back panel uses it). On desktop the chat is a small side panel, so keep the page scrollable. */
@media (min-width: 721px) { body.chat-on.cb-lock { overflow: visible; } }

@media (max-width: 720px) {
  /* The right edge already holds the Request Call Back tab, so the launcher sits bottom left, above the Call and WhatsApp bar. */
  .chat-launch { left: 14px; right: auto; bottom: calc(86px + env(safe-area-inset-bottom)); width: 52px; height: 52px; }

  .chat-teaser { left: 74px; right: auto; bottom: calc(92px + env(safe-area-inset-bottom)); border-radius: 16px 16px 16px 4px; }
  .chat { inset: 0; width: 100%; max-width: none; height: 100vh; height: 100dvh; border: 0; border-radius: 0; transform: translateY(24px); }
  .chat-msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) {
  .chat, .chat.open, .chat-teaser, .chat-launch { transition: none; animation: none; }
  .chat-typing i { animation: none; opacity: 0.6; }
  .chat-log { scroll-behavior: auto; }
}
@media print { .chat, .chat-launch, .chat-teaser { display: none !important; } }
