/* AutoKey website assistant: launcher pill, voice orb panel, message card */

/* The old text-only chat bubble stays in the page as a fallback, but the new
   assistant is the front door now. */
.concierge-launcher { display: none !important; }

.akr-launch {
  position: fixed; right: 20px; bottom: 20px; z-index: 900;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px 10px 10px;
  background: var(--panel); color: var(--paper);
  border: 1px solid var(--brass); border-radius: 999px;
  font: 500 0.98rem/1.1 var(--font-body);
  box-shadow: 0 10px 28px rgba(0,0,0,0.45), 0 0 0 0 rgba(79,168,160,0.5);
  cursor: pointer;
  animation: akr-ring 3.2s ease-out infinite;
}
.akr-launch:hover { border-color: var(--teal); }
.akr-launch[hidden] { display: none; }
.akr-launch-orb { width: 34px; height: 34px; flex: none; }
.akr-launch small { display: block; color: var(--fog); font-size: 0.74rem; font-weight: 400; margin-top: 2px; }
@keyframes akr-ring {
  0%   { box-shadow: 0 10px 28px rgba(0,0,0,0.45), 0 0 0 0 rgba(79,168,160,0.45); }
  70%  { box-shadow: 0 10px 28px rgba(0,0,0,0.45), 0 0 0 14px rgba(79,168,160,0); }
  100% { box-shadow: 0 10px 28px rgba(0,0,0,0.45), 0 0 0 0 rgba(79,168,160,0); }
}

/* Orb */
.akr-orb {
  --lvl: 0;
  position: relative; border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0) 28%),
    radial-gradient(circle at 50% 55%, #7fd6cc 0%, var(--teal) 42%, #1f5a55 100%);
  box-shadow: 0 0 calc(18px + var(--lvl) * 46px) calc(2px + var(--lvl) * 12px) rgba(79,168,160,0.55),
              inset 0 -8px 18px rgba(0,0,0,0.35);
  transform: scale(calc(1 + var(--lvl) * 0.16));
  transition: box-shadow 0.08s linear, transform 0.08s linear, background 0.4s;
}
.akr-orb::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%;
  border: 2px solid rgba(79,168,160,0.0);
}
.akr-orb[data-state="idle"]       { animation: akr-breathe 4s ease-in-out infinite; }
.akr-orb[data-state="connecting"] { animation: akr-breathe 1.2s ease-in-out infinite; filter: saturate(0.6); }
.akr-orb[data-state="listening"]::after { border-color: rgba(79,168,160,0.55); animation: akr-pulse 1.8s ease-out infinite; }
.akr-orb[data-state="thinking"]   { animation: akr-spin-glow 1.1s linear infinite; }
.akr-orb[data-state="speaking"] {
  background:
    radial-gradient(circle at 34% 30%, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0) 28%),
    radial-gradient(circle at 50% 55%, #f0cf8d 0%, var(--brass) 45%, #6b4e1c 100%);
  box-shadow: 0 0 calc(18px + var(--lvl) * 46px) calc(2px + var(--lvl) * 12px) rgba(199,154,75,0.6),
              inset 0 -8px 18px rgba(0,0,0,0.35);
}
.akr-orb[data-state="muted"] { filter: grayscale(0.85) brightness(0.7); }
@keyframes akr-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes akr-pulse { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
@keyframes akr-spin-glow { 0% { filter: hue-rotate(0deg); } 100% { filter: hue-rotate(40deg); } }

/* Panel */
.akr-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 950;
  width: min(380px, calc(100vw - 24px));
  background: var(--panel); color: var(--paper);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
  overflow: hidden;
  font-family: var(--font-body);
}
.akr-panel[hidden] { display: none; }
.akr-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 0 16px;
}
.akr-title { font: 600 1.05rem/1.2 var(--font-display); letter-spacing: 0.01em; }
.akr-status { color: var(--fog); font-size: 0.78rem; margin-left: 8px; font-weight: 400; font-family: var(--font-body); }
.akr-x { background: none; border: 0; color: var(--fog); font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 4px 8px; }

.akr-body { padding: 8px 16px 16px; }
.akr-stage { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.akr-stage .akr-orb { width: 96px; height: 96px; margin: 14px 0 6px; }
.akr-lead { font-size: 1.02rem; margin: 0; }
.akr-sub { color: var(--fog); font-size: 0.86rem; margin: 0; }

.akr-btn {
  width: 100%; padding: 12px 16px; border-radius: 12px; cursor: pointer;
  font: 500 1rem/1.2 var(--font-body); border: 1px solid var(--line);
  background: var(--panel-alt); color: var(--paper); text-align: center; text-decoration: none; display: block;
}
.akr-btn:hover { border-color: var(--teal); }
.akr-btn-primary { background: var(--teal); border-color: var(--teal); color: #0b1514; font-weight: 600; }
.akr-btn-primary:hover { filter: brightness(1.08); }
.akr-btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.akr-btn-small { padding: 9px 10px; font-size: 0.88rem; }
.akr-fine { color: var(--fog); font-size: 0.74rem; line-height: 1.4; margin: 4px 0 0; }
.akr-fine a { color: var(--fog); }

/* Live mode (compact so the page stays visible above it) */
.akr-live { display: none; }
.akr-panel[data-mode="live"] .akr-start,
.akr-panel[data-mode="resume"] .akr-start { display: none; }
.akr-panel[data-mode="live"] .akr-live { display: block; }
.akr-panel[data-mode="live"] .akr-body { padding-top: 0; }
.akr-livetop { display: flex; align-items: center; gap: 14px; }
.akr-livetop .akr-orb { width: 54px; height: 54px; flex: none; margin: 6px 4px; }
.akr-caps { min-height: 3.2em; max-height: 7.2em; overflow-y: auto; font-size: 0.95rem; line-height: 1.4; flex: 1; }
.akr-cap-agent { color: var(--paper); }
.akr-cap-user { color: var(--fog); font-size: 0.82rem; margin-top: 4px; font-style: italic; }
.akr-controls { display: flex; gap: 8px; margin-top: 10px; }
.akr-controls .akr-btn { padding: 9px 8px; font-size: 0.88rem; }
.akr-end { background: rgba(225,6,0,0.14); border-color: rgba(225,6,0,0.5); }
.akr-typerow { display: flex; gap: 8px; margin-top: 10px; }
.akr-typerow input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--ink); color: var(--paper); font: 400 0.95rem var(--font-body);
}
.akr-typerow input:focus { outline: 2px solid var(--teal); }
.akr-typerow button { padding: 0 14px; border-radius: 10px; border: 0; background: var(--teal); color: #0b1514; font-weight: 600; cursor: pointer; }

/* Confirmation card */
.akr-confirm {
  margin-top: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--teal-soft); border: 1px solid var(--teal);
}
.akr-confirm[hidden] { display: none; }
.akr-confirm strong { display: block; font: 600 1.05rem var(--font-display); }
.akr-confirm p { margin: 4px 0 0; font-size: 0.92rem; }
.akr-confirm button { margin-top: 8px; background: none; border: 0; color: var(--fog); text-decoration: underline; cursor: pointer; font: inherit; font-size: 0.82rem; padding: 0; }

/* Message modal */
.akr-modal-back {
  position: fixed; inset: 0; z-index: 980; background: rgba(0,0,0,0.6);
  display: flex; align-items: flex-end; justify-content: center; padding: 12px;
}
.akr-modal-back[hidden] { display: none; }
.akr-modal {
  width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 18px 18px 16px; box-shadow: 0 18px 50px rgba(0,0,0,0.6);
}
.akr-modal h3 { font-size: 1.35rem; margin: 0 0 4px; }
.akr-modal label { display: block; font-size: 0.82rem; color: var(--fog); margin: 10px 0 4px; }
.akr-modal input, .akr-modal textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--ink); color: var(--paper); font: 400 1rem var(--font-body);
}
.akr-modal textarea { min-height: 96px; resize: vertical; }
.akr-modal input:focus, .akr-modal textarea:focus { outline: 2px solid var(--teal); }
.akr-modal .akr-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.akr-modal .akr-btn-row { margin-top: 14px; }
.akr-err { color: #ff8b85; font-size: 0.86rem; margin: 8px 0 0; min-height: 1.1em; }
.akr-done { text-align: center; padding: 8px 0 2px; }
.akr-done strong { display: block; font: 600 1.3rem var(--font-display); margin-bottom: 4px; }

/* Things the assistant just touched on the page */
.akr-flash { animation: akr-flash 1.6s ease-in-out 2; outline-offset: 3px; border-radius: 6px; }
@keyframes akr-flash {
  0%,100% { outline: 2px solid rgba(79,168,160,0); }
  50%     { outline: 2px solid var(--teal); box-shadow: 0 0 18px rgba(79,168,160,0.55); }
}

/* Message link inside the open/closed badge */
.status-msg-btn {
  background: none; border: 0; padding: 0; margin-left: 6px; cursor: pointer;
  color: inherit; font: inherit; text-decoration: underline;
}

@media (max-width: 560px) {
  .akr-launch { right: 12px; bottom: 12px; }
  .akr-launch small { display: none; }
  .akr-panel { right: 12px; left: 12px; bottom: 12px; width: auto; }
  .akr-modal-back { padding: 0; }
  .akr-modal { border-radius: 18px 18px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .akr-launch, .akr-orb, .akr-orb::after, .akr-flash { animation: none !important; }
}

/* Make the assistant easy to notice */
.akr-launch { padding: 12px 22px 12px 12px; font-size: 1.08rem; }
.akr-launch-orb { width: 46px; height: 46px; }
.akr-launch small { display: block !important; }
.akr-hero-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--panel); color: var(--paper); border: 1px solid var(--teal); cursor: pointer;
}
.akr-hero-btn:hover { border-color: var(--brass); }
.akr-hero-orb { width: 22px; height: 22px; flex: none; display: inline-block; }
.akr-nudge {
  position: fixed; right: 20px; bottom: 96px; z-index: 899; max-width: 260px;
  background: var(--paper); color: #12161B; border-radius: 14px; padding: 12px 34px 12px 14px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.45); cursor: pointer; font: 400 0.9rem/1.35 var(--font-body);
  animation: akr-pop 0.3s ease-out;
}
.akr-nudge strong { display: block; font-size: 1rem; margin-bottom: 2px; }
.akr-nudge::after { content: ""; position: absolute; right: 36px; bottom: -8px; border: 8px solid transparent; border-top-color: var(--paper); border-bottom: 0; }
.akr-nudge-x { position: absolute; top: 4px; right: 6px; background: none; border: 0; font-size: 1.2rem; cursor: pointer; color: #555; }
@keyframes akr-pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 560px) { .akr-launch small { display: block !important; } .akr-nudge { right: 12px; bottom: 88px; } }

/* Top-of-page assistant entry */
.akr-top-wrap { display: flex; justify-content: flex-start; margin: 0 0 18px; }
.akr-top {
  width: 100%; max-width: 560px; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 12px 18px 12px 14px; border-radius: 999px; cursor: pointer;
  background: var(--panel); color: var(--paper); border: 1px solid var(--teal);
  font-family: var(--font-body); box-shadow: 0 0 0 0 rgba(79,168,160,0.45); animation: akr-ring 3.2s ease-out infinite;
}
.akr-top:hover { border-color: var(--brass); }
.akr-top-orb { width: 48px; height: 48px; flex: none; display: inline-block; }
.akr-top-text strong { display: block; font-size: 1.05rem; font-weight: 600; }
.akr-top-text small { display: block; color: var(--fog); font-size: 0.8rem; margin-top: 2px; line-height: 1.3; }
@media (max-width: 560px) { .akr-top { border-radius: 22px; } }

/* Pulsing orb on the home banner so people know to tap it */
.akr-top-orb { animation: akr-orb-beat 1.8s ease-in-out infinite; }
.akr-top-orb::after {
  inset: -4px; border: 2px solid rgba(79,168,160,0.8);
  animation: akr-orb-ring 1.8s ease-out infinite;
}
.akr-top-text strong::after {
  content: "TAP"; margin-left: 10px; padding: 2px 8px; border-radius: 999px; vertical-align: 2px;
  background: var(--teal); color: #0b1514; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em;
}
@keyframes akr-orb-beat { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes akr-orb-ring { 0% { transform: scale(1); opacity: 0.9; } 100% { transform: scale(1.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .akr-top-orb, .akr-top-orb::after { animation: none !important; } }
