/* Agent Z: the "Ask Agent Z" button and chat panel. Uses the tokens and keyframes from styles.css. */

.az-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.az-launch {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  display: inline-flex; align-items: center;
  height: 52px; padding: 0 22px;
  border: 0; border-radius: 999px;
  background: var(--forest); color: var(--white);
  font: 600 15px/1 var(--font); cursor: pointer;
  box-shadow: 0 0 0 4px rgba(170, 221, 84, .28), 0 16px 34px -14px rgba(16, 84, 72, .65);
  transition: transform .2s var(--ease), box-shadow .2s, opacity .2s;
}
.az-launch[hidden] { display: none; }
.az-launch:hover { transform: translateY(-2px); box-shadow: 0 0 0 5px rgba(170, 221, 84, .4), 0 18px 38px -14px rgba(16, 84, 72, .7); }
.az-launch[aria-expanded="true"] { opacity: 0; pointer-events: none; }

.az-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 61;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 48px));
}
.az-panel[hidden] { display: none; }
.az-glow {
  position: absolute; inset: -18px; border-radius: 42px;
  background: conic-gradient(from var(--glow-a), #AADD54, #8EE3C2, #D9F27F, #89C943, #B5ECD9, #AADD54);
  filter: blur(30px); opacity: .7;
  animation: glowTurn 14s linear infinite;
}
.az-card {
  position: relative; height: 100%;
  display: flex; flex-direction: column;
  background: var(--white); border: 1px solid var(--border); border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(16, 84, 72, .45);
}

.az-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 18px; border-bottom: 1px solid var(--border); }
.az-mark { width: 34px; height: 34px; flex: none; }
.az-title h2 { font-size: 17px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.az-title p { font-size: 12.5px; color: var(--muted); }
.az-close {
  margin-left: auto; width: 36px; height: 36px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 12px; background: var(--white); color: var(--forest); cursor: pointer;
}
.az-close:hover { background: var(--soft); }
.az-close svg, .az-send svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.az-log {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  background: #FAFCF7;
}
.az-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.az-bot { align-self: flex-start; background: var(--white); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.az-user { align-self: flex-end; background: var(--forest); color: var(--white); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.az-msg p + p, .az-msg p + ul, .az-msg p + ol, .az-msg ul + p, .az-msg ol + p { margin-top: 8px; }
.az-msg ul, .az-msg ol { padding-left: 18px; }
.az-msg li + li { margin-top: 3px; }
.az-msg a { color: var(--leaf); text-decoration: underline; text-underline-offset: 2px; }
.az-error {
  align-self: flex-start; max-width: 88%;
  padding: 8px 12px; border-radius: 12px;
  background: #FFF7E8; border: 1px solid #F1DDB6; color: #7A4A12;
  font-size: 13px; line-height: 1.45;
}
.az-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.az-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--lime-deep); animation: azDot 1s ease-in-out infinite; }
.az-typing i:nth-child(2) { animation-delay: .15s; }
.az-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes azDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.az-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; background: #FAFCF7; }
.az-suggest[hidden] { display: none; }
.az-suggest button {
  padding: 7px 12px; border-radius: 999px;
  border: 1px solid rgba(137, 201, 67, .55); background: var(--white); color: var(--forest);
  font: 500 13px/1.2 var(--font); cursor: pointer;
}
.az-suggest button:hover { background: var(--soft); }

.az-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 8px; border-top: 1px solid var(--border); }
.az-form textarea {
  flex: 1; resize: none; max-height: 120px; overflow-y: hidden;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px;
  font: 400 14.5px/1.45 var(--font); color: var(--forest); background: var(--white);
}
.az-form textarea:focus { outline: 2px solid var(--lime-deep); outline-offset: 0; border-color: transparent; }
.az-send {
  width: 42px; height: 42px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: var(--forest); color: var(--lime); cursor: pointer;
}
.az-send:disabled { opacity: .45; cursor: default; }
.az-note { padding: 0 14px 10px; font-size: 11.5px; color: var(--muted); text-align: center; }

/* Phones: the panel becomes a full-screen sheet. */
@media (max-width: 639px) {
  .az-launch { right: 16px; bottom: 16px; height: 48px; font-size: 14px; }
  .az-panel { inset: 0; width: 100%; height: 100dvh; }
  .az-glow { display: none; }
  .az-card { border: 0; border-radius: 0; }
  .az-msg { font-size: 15px; }
  .az-form textarea { font-size: 16px; } /* 16px stops iOS zooming into the field */
}

@media (prefers-reduced-motion: reduce) {
  .az-launch, .az-glow, .az-typing i { animation: none; transition: none; }
}
