/* AO Creative Studios — AI assistant chat widget (uses tokens from ao.css) */
.aochat { position: fixed; right: 20px; bottom: 20px; z-index: 120; font-family: var(--font-body); }
.aochat svg { width: 100%; height: 100%; }
.aochat-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.aochat-fab {
  position: relative; width: 62px; height: 62px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--grad-gold); color: #111; box-shadow: 0 16px 40px -10px rgba(242,181,44,0.6), 0 0 0 1px rgba(255,255,255,0.15) inset;
  transition: transform 0.4s var(--ease), box-shadow 0.4s;
}
.aochat-fab::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(242,181,44,0.45); animation: aopulse 2.6s ease-out infinite; }
.aochat.is-open .aochat-fab::before { display: none; }
.aochat-fab:hover { transform: scale(1.06); }
.aochat-fab-ico { position: absolute; width: 28px; height: 28px; transition: opacity 0.25s, transform 0.4s var(--ease); }
.aochat-fab-close { opacity: 0; transform: rotate(-90deg) scale(0.6); width: 24px; height: 24px; }
.aochat.is-open .aochat-fab-open { opacity: 0; transform: rotate(90deg) scale(0.6); }
.aochat.is-open .aochat-fab-close { opacity: 1; transform: none; }
.aochat-dot { position: absolute; top: 4px; right: 4px; width: 14px; height: 14px; border-radius: 50%; background: #22c55e; border: 2px solid var(--bg); }
@keyframes aopulse { 0% { transform: scale(0.9); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }

.aochat-teaser {
  position: absolute; right: 0; bottom: 78px; width: 250px; padding: 14px 36px 14px 16px; border-radius: 16px 16px 4px 16px;
  background: var(--surface-2); border: 1px solid var(--line-strong); color: #dedcd6; font-size: 14px; line-height: 1.5;
  box-shadow: 0 20px 50px -16px rgba(0,0,0,0.8); cursor: pointer; animation: aoin 0.5s var(--ease);
}
.aochat-teaser b { color: var(--gold); }
.aochat-teaser-x { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; padding: 4px; border: 0; border-radius: 50%; background: rgba(255,255,255,0.06); color: var(--muted); }
.aochat-teaser[hidden] { display: none; }
@keyframes aoin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.aochat-panel {
  position: absolute; right: 0; bottom: 78px; width: 380px; height: min(600px, calc(100vh - 120px));
  display: flex; flex-direction: column; overflow: hidden; border-radius: 22px;
  background: #101013; border: 1px solid var(--line-strong);
  box-shadow: 0 40px 100px -30px rgba(0,0,0,0.9), 0 0 0 1px rgba(242,181,44,0.08);
  opacity: 0; transform: translateY(16px) scale(0.97); transform-origin: bottom right;
  transition: opacity 0.3s, transform 0.4s var(--ease);
}
.aochat-panel[hidden] { display: none; }
.aochat.is-open .aochat-panel { opacity: 1; transform: none; }

.aochat-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px; background: linear-gradient(140deg, #2a2210, #151418 70%); border-bottom: 1px solid var(--line); }
.aochat-avatar { flex: none; width: 42px; height: 42px; padding: 9px; border-radius: 13px; background: var(--grad-gold); color: #111; }
.aochat-head strong { display: block; font-family: var(--font-head); font-size: 17px; color: var(--text); }
.aochat-head small { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.aochat-head small i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.aochat-close { margin-left: auto; width: 34px; height: 34px; padding: 8px; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); }
.aochat-close:hover { color: var(--text); border-color: var(--gold); }

.aochat-log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; }
.aochat-msg { max-width: 86%; padding: 11px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; animation: aoin 0.35s var(--ease); }
.aochat-msg a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }
.aochat-msg--assistant { align-self: flex-start; background: var(--surface-2); color: #e6e4de; border-bottom-left-radius: 5px; }
.aochat-msg--user { align-self: flex-end; background: var(--grad-gold); color: #111; font-weight: 600; border-bottom-right-radius: 5px; }
.aochat-msg--user a { color: #111; }
.aochat-msg--error { border: 1px solid rgba(239,68,68,0.35); }
.aochat-typing { display: flex; gap: 5px; padding: 14px 16px; }
.aochat-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: aodot 1.2s infinite ease-in-out; }
.aochat-typing i:nth-child(2) { animation-delay: 0.15s; } .aochat-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes aodot { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

.aochat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 12px; }
.aochat-chips[hidden] { display: none; }
.aochat-chips button { padding: 8px 13px; border-radius: 999px; border: 1px solid rgba(242,181,44,0.4); background: rgba(242,181,44,0.06); color: var(--gold); font-size: 13px; font-weight: 700; transition: background 0.25s, color 0.25s; }
.aochat-chips button:hover { background: var(--gold); color: #111; }

.aochat-form { display: flex; align-items: flex-end; gap: 8px; margin: 0 12px; padding: 8px 8px 8px 14px; border-radius: 16px; background: #18181c; border: 1px solid var(--line-strong); transition: border-color 0.25s; }
.aochat-form:focus-within { border-color: var(--gold); }
.aochat-form textarea { flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; line-height: 1.45; padding: 6px 0; max-height: 120px; }
.aochat-form textarea::placeholder { color: var(--dim); }
.aochat-form button { flex: none; width: 38px; height: 38px; padding: 9px; border-radius: 12px; border: 0; background: var(--grad-gold); color: #111; transition: transform 0.25s; }
.aochat-form button:hover { transform: scale(1.06); }
.aochat-form button:disabled { opacity: 0.5; transform: none; }
.aochat-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px 14px; font-size: 12px; color: var(--dim); }
.aochat-foot a { display: inline-flex; align-items: center; gap: 6px; color: #4ade80; font-weight: 700; }
.aochat-foot a svg { width: 16px; height: 16px; }
.aochat-foot a:hover { color: #86efac; }

@media (max-width: 600px) {
  .aochat { right: 14px; bottom: 14px; }
  .aochat-fab { width: 56px; height: 56px; }
  .aochat-panel { position: fixed; inset: 0; width: auto; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .aochat.is-open .aochat-fab { display: none; }
  .aochat-teaser { bottom: 70px; width: 230px; }
}
@media print { .aochat { display: none; } }
