/* Chat assistant — floating launcher + panel */

.chat-root { position: fixed; right: 20px; bottom: 20px; z-index: 4000; }

/* ── Launcher ── */
.chat-launcher {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--grad-primary); color: var(--white);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 28px rgba(var(--brand-blue-600-rgb),0.42);
  transition: var(--transition);
}
.chat-launcher:hover { background: var(--grad-primary-hover); transform: translateY(-2px); }
.chat-launcher:focus-visible { outline: 3px solid var(--brand-blue-300); outline-offset: 3px; }
.chat-ic-close { display: none; }
.chat-launcher[aria-expanded="true"] .chat-ic-open { display: none; }
.chat-launcher[aria-expanded="true"] .chat-ic-close { display: block; }

/* ── Panel ── */
.chat-panel {
  position: absolute; right: 0; bottom: 72px;
  width: 370px; max-width: calc(100vw - 32px);
  height: 540px; max-height: calc(100vh - 120px);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(var(--brand-blue-900-rgb),0.28);
  display: flex; flex-direction: column; overflow: hidden;
  animation: chatIn 0.24s cubic-bezier(0.34,1.4,0.64,1);
}
.chat-panel[hidden] { display: none; }
@keyframes chatIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.chat-head {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 16px; flex-shrink: 0;
  background: var(--grad-deep); color: var(--white);
}
.chat-head-mark {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: rgba(255,255,255,0.16);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.02em;
}
.chat-head-text { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.chat-head-title { font-size: 0.9rem; font-weight: 600; }
.chat-head-sub { font-size: 0.71rem; color: rgba(255,255,255,0.65); margin-top: 1px; }
.chat-close {
  width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
  background: rgba(255,255,255,0.1); color: var(--white);
  border: 1px solid rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
}
.chat-close:hover { background: rgba(255,255,255,0.22); }
.chat-close:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }

/* ── Messages ── */
.chat-list {
  flex: 1; overflow-y: auto; padding: 16px 14px;
  background: var(--brand-blue-50);
  display: flex; flex-direction: column; gap: 10px;
}
.chat-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.chat-msg-user { justify-content: flex-end; }
.chat-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--grad-primary); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.56rem; font-weight: 700; letter-spacing: 0.02em;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.chat-bubble {
  padding: 10px 13px; border-radius: 14px;
  font-size: 0.845rem; line-height: 1.58; max-width: 84%;
}
.chat-msg-bot .chat-bubble {
  background: var(--white); color: var(--text);
  border: 1px solid var(--gray-200);
  border-bottom-left-radius: 4px;
}
.chat-msg-user .chat-bubble {
  background: var(--grad-primary); color: var(--white);
  border-bottom-right-radius: 4px;
}
.chat-bubble strong { font-weight: 600; }
.chat-msg-bot .chat-bubble strong { color: var(--brand-blue-700); }

/* Typing indicator */
.chat-typing .chat-bubble { display: flex; gap: 4px; padding: 13px; }
.chat-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand-blue-300);
  animation: chatDot 1.1s ease-in-out infinite;
}
.chat-dot:nth-child(2) { animation-delay: 0.16s; }
.chat-dot:nth-child(3) { animation-delay: 0.32s; }
@keyframes chatDot {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30%           { opacity: 1;    transform: translateY(-3px); }
}

/* ── Topic chips ── */
.chat-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding-left: 34px; margin-top: -2px;
}
.chat-chip {
  background: var(--white); color: var(--brand-blue-700);
  border: 1px solid var(--brand-blue-200);
  border-radius: 16px; padding: 7px 12px;
  font-family: inherit; font-size: 0.78rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); line-height: 1.3;
  text-align: left;
}
.chat-chip:hover { background: var(--brand-blue-100); border-color: var(--brand-blue-400); }
.chat-chip:focus-visible { outline: 2px solid var(--brand-blue-600); outline-offset: 2px; }
.chat-chip-primary {
  background: var(--grad-primary); color: var(--white);
  border-color: transparent; font-weight: 600;
}
.chat-chip-primary:hover { background: var(--grad-primary-hover); }

/* ── Composer ── */
.chat-form {
  display: flex; gap: 8px; padding: 11px 12px; flex-shrink: 0;
  border-top: 1px solid var(--gray-200); background: var(--white);
}
.chat-input {
  flex: 1; padding: 10px 13px;
  border: 1.5px solid var(--gray-200); border-radius: 20px;
  font-family: inherit; font-size: 0.85rem; color: var(--text);
  background: var(--white); transition: var(--transition); min-width: 0;
}
.chat-input:focus {
  outline: none; border-color: var(--brand-blue-600);
  box-shadow: 0 0 0 3px rgba(var(--brand-blue-600-rgb),0.16);
}
.chat-send {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--grad-primary); color: var(--white); border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
}
.chat-send:hover { background: var(--grad-primary-hover); }
.chat-send:focus-visible { outline: 2px solid var(--brand-blue-600); outline-offset: 2px; }

.chat-foot {
  padding: 9px 14px 11px; flex-shrink: 0;
  font-size: 0.68rem; color: var(--text-muted);
  line-height: 1.5; text-align: center;
  border-top: 1px solid var(--gray-150); background: var(--white);
}

@media (max-width: 480px) {
  .chat-root { right: 14px; bottom: 14px; }
  .chat-panel {
    width: calc(100vw - 28px);
    height: calc(100vh - 100px);
  }
  .chat-launcher { width: 52px; height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-panel { animation: none; }
  .chat-dot { animation: none; opacity: 0.6; }
  .chat-launcher:hover { transform: none; }
}
