/* sitechat.css - dependency-free styles for the sitechat widget.
 * All rules are scoped under .sitechat-root. Override the accent with
 * --sitechat-accent on the root (the widget sets it from config.accentColor).
 */

.sitechat-root {
  --sitechat-accent: #0f766e;
  --sitechat-accent-ink: #ffffff;
  --sitechat-bg: #ffffff;
  --sitechat-ink: #101828;
  --sitechat-muted: #667085;
  --sitechat-line: #e4e7ec;
  --sitechat-agent-bg: #f2f4f7;
  --sitechat-radius: 16px;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--sitechat-ink);
}

.sitechat-root * { box-sizing: border-box; }

/* ------------------------------------------------------------- launcher */

.sitechat-launcher {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--sitechat-accent);
  color: var(--sitechat-accent-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.24);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
  margin-left: auto;
}
.sitechat-launcher:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(16, 24, 40, 0.28); }
.sitechat-launcher:focus-visible { outline: 3px solid #98a2b3; outline-offset: 2px; }
.sitechat-launcher-icon { font-size: 24px; line-height: 1; }
.sitechat-open .sitechat-launcher { display: none; }

/* ---------------------------------------------------------------- panel */

.sitechat-panel {
  width: 360px;
  height: 520px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--sitechat-bg);
  border: 1px solid var(--sitechat-line);
  border-radius: var(--sitechat-radius);
  box-shadow: 0 18px 48px rgba(16, 24, 40, 0.22);
  overflow: hidden;
}
.sitechat-panel[hidden] { display: none; }

.sitechat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--sitechat-accent);
  color: var(--sitechat-accent-ink);
  flex: 0 0 auto;
}
.sitechat-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.sitechat-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sitechat-head-text { flex: 1 1 auto; min-width: 0; }
.sitechat-title { font-weight: 600; font-size: 15px; }
.sitechat-subtitle { font-size: 12px; opacity: 0.85; }
.sitechat-status {
  font-size: 12px;
  margin-top: 2px;
  font-weight: 500;
  color: #fef0c7;
}
.sitechat-status[hidden] { display: none; }
.sitechat-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 24px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
}
.sitechat-close:hover { background: rgba(255, 255, 255, 0.16); }
.sitechat-close:focus-visible { outline: 2px solid #ffffff; outline-offset: 1px; }

/* ------------------------------------------------------------- messages */

.sitechat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
  scrollbar-width: thin;
}
.sitechat-msg { display: flex; flex-direction: column; max-width: 100%; }
.sitechat-bubble {
  padding: 9px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  max-width: 84%;
  font-size: 14px;
}
.sitechat-msg--user { align-items: flex-end; }
.sitechat-msg--user .sitechat-bubble {
  background: var(--sitechat-accent);
  color: var(--sitechat-accent-ink);
  border-bottom-right-radius: 4px;
}
.sitechat-msg--agent .sitechat-bubble,
.sitechat-msg--assistant .sitechat-bubble {
  background: var(--sitechat-agent-bg);
  color: var(--sitechat-ink);
  border-bottom-left-radius: 4px;
}
.sitechat-msg--notice { align-items: center; }
.sitechat-msg--notice .sitechat-bubble {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 12.5px;
  text-align: center;
  max-width: 95%;
}

/* --------------------------------------------------------------- typing */

.sitechat-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 6px 16px 0;
  background: #ffffff;
  flex: 0 0 auto;
}
.sitechat-typing[hidden] { display: none; }
.sitechat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sitechat-accent);
  opacity: 0.4;
  animation: sitechat-bounce 1.1s infinite ease-in-out;
}
.sitechat-dot:nth-child(2) { animation-delay: 0.15s; }
.sitechat-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes sitechat-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-4px); opacity: 0.9; }
}

/* ----------------------------------------------------------- composer */

.sitechat-form {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--sitechat-line);
  background: #ffffff;
  flex: 0 0 auto;
}
.sitechat-input {
  flex: 1 1 auto;
  resize: none;
  min-height: 38px;
  max-height: 110px;
  padding: 9px 11px;
  border: 1px solid var(--sitechat-line);
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  color: inherit;
  background: #ffffff;
  overflow-y: auto;
  field-sizing: content;
}
.sitechat-input:focus { outline: none; border-color: var(--sitechat-accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14); }
.sitechat-send {
  flex: 0 0 auto;
  border: 0;
  border-radius: 12px;
  background: var(--sitechat-accent);
  color: var(--sitechat-accent-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
}
.sitechat-send:hover { filter: brightness(1.06); }
.sitechat-send:focus-visible { outline: 3px solid #98a2b3; outline-offset: 2px; }
.sitechat-counter {
  position: absolute;
  top: -18px;
  right: 14px;
  font-size: 11px;
  color: var(--sitechat-muted);
  background: #ffffff;
  padding: 0 4px;
}
.sitechat-counter[hidden] { display: none; }

.sitechat-footer {
  padding: 6px 12px 8px;
  text-align: center;
  font-size: 11px;
  color: var(--sitechat-muted);
  border-top: 1px solid var(--sitechat-line);
  background: #ffffff;
  flex: 0 0 auto;
}
.sitechat-powered-link { color: inherit; text-decoration: underline; }

/* ---------------------------------------------------------- responsive */

@media (max-width: 480px) {
  .sitechat-root { right: 12px; bottom: 12px; left: 12px; }
  .sitechat-open .sitechat-root { left: 0; }
  .sitechat-panel {
    width: 100%;
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
    border-radius: 14px;
  }
  .sitechat-bubble { max-width: 92%; }
}

/* ------------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
  .sitechat-launcher,
  .sitechat-dot,
  .sitechat-bubble { transition: none !important; animation: none !important; }
  .sitechat-dot { opacity: 0.55; }
}

.sitechat-mic {
  flex: 0 0 auto;
  border: 1px solid var(--sitechat-line);
  background: var(--sitechat-bg);
  color: var(--sitechat-muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.sitechat-mic:hover { border-color: var(--sitechat-accent); color: var(--sitechat-accent); }
.sitechat-mic.recording {
  background: var(--sitechat-accent);
  border-color: var(--sitechat-accent);
  color: var(--sitechat-accent-ink);
  animation: sitechat-pulse 1.2s ease-in-out infinite;
}
@keyframes sitechat-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(15,118,110,.45); }
  50% { box-shadow: 0 0 0 8px rgba(15,118,110,0); }
}

/* SITECHAT_MIC_V2 */
.sitechat-mic{flex:0 0 auto;width:38px;height:38px;border:1px solid var(--sitechat-line);background:var(--sitechat-bg);color:var(--sitechat-muted);border-radius:50%;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;padding:0;transition:background .15s,color .15s,border-color .15s}
.sitechat-mic:hover{border-color:var(--sitechat-accent);color:var(--sitechat-accent)}
.sitechat-mic.recording{background:var(--sitechat-accent);border-color:var(--sitechat-accent);color:var(--sitechat-accent-ink);animation:sitechat-mic-pulse 1.2s ease-in-out infinite}
@keyframes sitechat-mic-pulse{0%,100%{box-shadow:0 0 0 0 rgba(15,118,110,.45)}50%{box-shadow:0 0 0 8px rgba(15,118,110,0)}}
@media (prefers-reduced-motion: reduce){.sitechat-mic.recording{animation:none}}

/* SITECHAT_MIC_V3 */
.sitechat-input-wrap{position:relative;flex:1 1 auto;display:flex;min-width:0}
.sitechat-input-wrap .sitechat-input{flex:1 1 auto;padding-right:44px}
.sitechat-mic{position:absolute;right:8px;top:50%;transform:translateY(-50%);width:26px;height:26px;border:0;background:transparent;color:var(--sitechat-muted);border-radius:50%;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;padding:0;line-height:1;transition:color .15s,background .15s}
.sitechat-mic:hover{color:var(--sitechat-accent);background:rgba(15,118,110,.08)}
.sitechat-mic:focus-visible{outline:2px solid var(--sitechat-accent);outline-offset:2px}
.sitechat-mic.recording{color:var(--sitechat-accent-ink);background:var(--sitechat-accent);animation:sitechat-mic-pulse 1.2s ease-in-out infinite}
@keyframes sitechat-mic-pulse{0%,100%{box-shadow:0 0 0 0 rgba(15,118,110,.5)}50%{box-shadow:0 0 0 7px rgba(15,118,110,0)}}
@media (prefers-reduced-motion: reduce){.sitechat-mic.recording{animation:none}}

/* SITECHAT_LOGO_HEADER */
.sitechat-avatar{width:32px;height:32px;border-radius:8px;background:#ffffff;overflow:hidden;display:flex;align-items:center;justify-content:center;padding:3px}
.sitechat-avatar .sitechat-logo{width:100%;height:100%;object-fit:contain;display:block}
.sitechat-avatar-initials{display:none}

/* SITECHAT_LOGO_ONLY_HEADER */
.sitechat-head-text{flex:1 1 auto;min-width:0;display:flex;align-items:center}
.sitechat-header-logo{height:26px;width:auto;max-width:170px;object-fit:contain;display:block;filter:brightness(0) invert(1)}
.sitechat-avatar{width:30px;height:30px;border-radius:50%;background:rgba(255,255,255,.22);display:flex;align-items:center;justify-content:center;overflow:hidden;padding:0}
.sitechat-avatar .sitechat-logo{display:none}
.sitechat-avatar-initials{font-weight:700;font-size:13px}
@media (max-width:420px){.sitechat-header-logo{height:22px;max-width:130px}}

/* SITECHAT_HEADER_CIRCLE_FIX: avatar is now unused in the header */
.sitechat-header .sitechat-avatar{display:none !important}
.sitechat-head-text{margin-left:0}
