/* Assurify Care chat widget — reuses this site's existing design tokens
   (see :root in styles.css) so it reads as part of the page, not a
   bolted-on third-party widget. */

#assurify-chat-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 999;
  font-family: var(--font-sans);
}

.ac-launcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 13px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-float);
  transition: transform 0.15s ease;
}
.ac-launcher:hover { transform: translateY(-2px); }
.ac-launcher-icon { font-size: 16px; }

.ac-panel {
  position: absolute;
  right: 0;
  bottom: 64px;
  width: 340px;
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* The `hidden` HTML attribute only applies `display: none` via the
   browser's lowest-priority user-agent stylesheet — any author rule
   that sets `display` on the same element (the `display: flex` above)
   overrides it regardless of selector specificity, which is exactly
   why the panel was showing open by default instead of waiting for a
   click on the launcher. This rule restores the actual toggle: the
   widget starts (and stays, until clicked) as just the launcher icon,
   matching the original "collapsed unless clicked" design. */
.ac-panel[hidden] {
  display: none;
}

.ac-head {
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-soft) 100%);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.ac-head strong { display: block; font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.ac-head span { display: block; font-size: 12px; opacity: 0.8; margin-top: 2px; }
.ac-close {
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.ac-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
  min-height: 220px;
}

.ac-bubble {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: var(--radius-m);
  font-size: 13.5px;
  line-height: 1.45;
}
.ac-bubble a { color: inherit; text-decoration: underline; }
.ac-bubble-bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.ac-bubble-user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ac-typing { display: flex; gap: 4px; padding: 13px; }
.ac-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-soft); opacity: 0.4;
  animation: ac-typing-bounce 1.1s infinite ease-in-out;
}
.ac-typing span:nth-child(2) { animation-delay: 0.15s; }
.ac-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ac-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 0.9; }
}

.ac-quickreplies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 14px;
  background: var(--bg);
}
.ac-chip {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.ac-chip:hover { border-color: var(--accent); }

.ac-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.ac-input-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: var(--font-sans);
  outline: none;
}
.ac-input-row input:focus { border-color: var(--accent); }
.ac-input-row button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.ac-file-row {
  display: flex;
  align-items: center;
}
.ac-file-input {
  /* The real <input type="file"> is visually hidden; its paired <label
     for="acFileInput"> (styled like any other chip below) is what the
     customer actually sees and clicks — this gets the native file picker
     (including the camera option on mobile) without a raw file input
     breaking the chat's look. */
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.ac-file-label {
  display: inline-block;
}

@media (max-width: 480px) {
  #assurify-chat-root { right: 12px; bottom: 12px; }
  .ac-panel { width: calc(100vw - 24px); bottom: 60px; }
}
