/* Amia.ai site guide chatbot. Light, enterprise styling. Body text 18px. Orange reserved for actions. */
.ag-root {
  --ag-bg: #ffffff;
  --ag-surface: #f6f5f2;
  --ag-border: #dedbd3;
  --ag-text: #1b1a24;
  --ag-muted: #4a4858;
  --ag-navy: #14132b;
  --ag-orange: #d9541e;
  --ag-orange-hover: #b8441a;
  --ag-focus: #2e5bd8;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  color: var(--ag-text);
}
.ag-root *, .ag-root *::before, .ag-root *::after { box-sizing: border-box; }
.ag-root button:focus-visible, .ag-root a:focus-visible, .ag-root input:focus-visible {
  outline: 3px solid var(--ag-focus); outline-offset: 2px;
}

/* Launcher */
.ag-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 9998;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border: 1px solid var(--ag-navy); border-radius: 999px;
  background: var(--ag-navy); color: #fff;
  font-family: inherit; font-size: 17px; font-weight: 600; line-height: 1.2; cursor: pointer;
  box-shadow: 0 6px 20px rgba(20, 19, 43, 0.18);
}
.ag-launcher:hover { background: #24223f; }
.ag-launcher svg { width: 20px; height: 20px; flex: none; }
.ag-root.ag-open .ag-launcher { display: none; }

/* Panel */
.ag-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 9999;
  width: min(440px, calc(100vw - 32px)); height: min(700px, calc(100vh - 48px));
  display: none; flex-direction: column; overflow: hidden;
  background: var(--ag-bg); border: 1px solid var(--ag-border); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(20, 19, 43, 0.22);
}
.ag-root.ag-open .ag-panel { display: flex; }

.ag-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px 14px 18px; background: var(--ag-navy); color: #fff;
}
.ag-avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: #fff; color: var(--ag-navy);
  font-weight: 700; font-size: 18px;
}
.ag-head-text { flex: 1; min-width: 0; }
.ag-title { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; }
.ag-sub { margin: 2px 0 0; font-size: 14px; color: #d4d2e3; line-height: 1.4; }
.ag-icon-btn {
  flex: none; width: 40px; height: 40px; border: 0; border-radius: 8px;
  background: transparent; color: #fff; font-size: 24px; line-height: 1; cursor: pointer;
}
.ag-icon-btn:hover { background: rgba(255,255,255,0.12); }

/* Conversation */
.ag-log { position: relative; flex: 1; overflow-y: auto; padding: 18px 16px 8px; background: var(--ag-surface); }
.ag-msg { display: flex; margin: 0 0 12px; }
.ag-bubble { max-width: 88%; padding: 12px 16px; border-radius: 14px; }
.ag-bubble p { margin: 0 0 10px; }
.ag-bubble p:last-child { margin-bottom: 0; }
.ag-bot .ag-bubble { background: #fff; border: 1px solid var(--ag-border); border-top-left-radius: 4px; }
.ag-user { justify-content: flex-end; }
.ag-user .ag-bubble { background: var(--ag-navy); color: #fff; border-top-right-radius: 4px; }

.ag-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -2px 0 14px; }
.ag-chip {
  padding: 9px 14px; font-family: inherit; font-size: 16px; line-height: 1.35; text-align: left;
  color: var(--ag-navy); background: #fff; border: 1px solid #bdb9ae; border-radius: 18px; cursor: pointer;
}
.ag-chip:hover { border-color: var(--ag-navy); background: #eeece6; }

.ag-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ag-link {
  display: inline-block; padding: 9px 14px; border-radius: 8px; font-size: 16px; font-weight: 600;
  text-decoration: none; border: 1px solid var(--ag-navy); color: var(--ag-navy); background: #fff;
}
.ag-link:hover { background: var(--ag-surface); }
.ag-link.ag-primary { background: var(--ag-orange); border-color: var(--ag-orange); color: #fff; }
.ag-link.ag-primary:hover { background: var(--ag-orange-hover); border-color: var(--ag-orange-hover); }

/* Typing indicator */
.ag-typing .ag-bubble { display: inline-flex; gap: 5px; padding: 14px 16px; }
.ag-typing span { width: 8px; height: 8px; border-radius: 50%; background: #8f8b9e; }
@media (prefers-reduced-motion: no-preference) {
  .ag-typing span { animation: ag-dot 1s infinite ease-in-out; }
  .ag-typing span:nth-child(2) { animation-delay: 0.15s; }
  .ag-typing span:nth-child(3) { animation-delay: 0.3s; }
  @keyframes ag-dot { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }
  .ag-root.ag-open .ag-panel { animation: ag-in 160ms ease-out; }
  @keyframes ag-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

/* Composer */
.ag-bottom { padding: 12px 16px 10px; border-top: 1px solid var(--ag-border); background: #fff; }
.ag-compose { display: flex; gap: 8px; }
.ag-compose input {
  flex: 1; min-width: 0; padding: 12px 14px; font-family: inherit; font-size: 17px; color: var(--ag-text);
  background: #fff; border: 1px solid #bdb9ae; border-radius: 8px;
}
.ag-send {
  padding: 0 18px; border: 0; border-radius: 8px; background: var(--ag-orange); color: #fff;
  font-family: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
}
.ag-send:hover { background: var(--ag-orange-hover); }
.ag-note { margin: 8px 0 0; font-size: 14px; line-height: 1.4; color: var(--ag-muted); }
.ag-inline { color: var(--ag-navy); font-weight: 600; }

@media (max-width: 520px) {
  .ag-launcher { right: 16px; bottom: 16px; padding: 14px; }
  .ag-launcher span { display: none; }
  .ag-launcher svg { width: 24px; height: 24px; }
  .ag-panel { right: 8px; left: 8px; bottom: 8px; width: auto; height: calc(100vh - 16px); }
  .ag-bubble { max-width: 94%; }
}

/* Keep guide text colors when the host site styles p and li */
.ag-root .ag-head .ag-title { color: #fff !important; }
.ag-root .ag-head .ag-sub { color: #d4d2e3 !important; }
.ag-root .ag-bubble p { color: inherit !important; }
.ag-root .ag-bot .ag-bubble { color: var(--ag-text); }
.ag-root .ag-note { color: var(--ag-muted) !important; }
