/* ============================================================
   FOXO — Digifox AI fox avatar chat
   ============================================================ */

/* ---------- Launcher bubble ---------- */
.foxo-launch {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 220;
  width: 58px;
  height: 58px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffc76b, #f5673c 55%, #c93a26);
  box-shadow: var(--glow-accent), 0 8px 24px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.foxo-launch svg {
  width: 34px;
  height: 34px;
  pointer-events: none;
}
.foxo-launch:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 0 34px rgba(245, 103, 60, 0.55), 0 10px 28px rgba(0, 0, 0, 0.5);
}
.foxo-launch .foxo-ping {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(245, 103, 60, 0.6);
  animation: foxo-ping 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes foxo-ping {
  0%   { transform: scale(0.9); opacity: 0.8; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}
.foxo-launch .foxo-tip {
  position: absolute;
  right: 70px;
  bottom: 12px;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.foxo-launch:hover .foxo-tip,
.foxo-launch:focus-visible .foxo-tip {
  opacity: 1;
  transform: translateX(0);
}

/* ---------- Panel ---------- */
.foxo-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 230;
  width: min(400px, calc(100vw - 2.5rem));
  height: min(600px, calc(100dvh - 2.5rem));
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, var(--bg-1), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(245, 103, 60, 0.12);
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
  overflow: hidden;
}
.foxo-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---------- Header with avatar ---------- */
.foxo-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}
.foxo-avatar {
  width: 64px;
  height: 56px;
  flex: 0 0 auto;
  position: relative;
}
.foxo-avatar::before {
  content: "";
  position: absolute;
  inset: 2px 6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 103, 60, 0.35), transparent 65%);
}
.foxo-avatar svg {
  position: relative;
  width: 100%;
  height: 100%;
  animation: foxo-float 4.5s ease-in-out infinite;
}
@keyframes foxo-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2.5px); }
}
.foxo-head-meta { min-width: 0; }
.foxo-head-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
/* voice-wave accent beside the name while Foxo talks */
.foxo-wave {
  display: inline-flex;
  gap: 2px;
  align-items: flex-end;
  height: 12px;
}
.foxo-wave i {
  width: 3px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.35;
  transition: opacity 0.2s;
}
.foxo-panel.talking .foxo-wave i {
  opacity: 1;
  animation: foxo-wave 0.6s ease-in-out infinite;
}
.foxo-panel.talking .foxo-wave i:nth-child(2) { animation-delay: 0.12s; }
.foxo-panel.talking .foxo-wave i:nth-child(3) { animation-delay: 0.24s; }
@keyframes foxo-wave {
  0%, 100% { height: 4px; }
  50%      { height: 12px; }
}
.foxo-head-sub {
  font-size: 0.72rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.foxo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5dd97c;
  box-shadow: 0 0 8px rgba(93, 217, 124, 0.7);
}
.foxo-close {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color 0.2s, border-color 0.2s;
}
.foxo-close:hover { color: var(--text); border-color: var(--border-hover); }

/* ---------- Chat log ---------- */
.foxo-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 103, 60, 0.4) transparent;
}
.foxo-log::-webkit-scrollbar { width: 5px; }
.foxo-log::-webkit-scrollbar-thumb {
  background: rgba(245, 103, 60, 0.4);
  border-radius: 3px;
}

.foxo-msg {
  max-width: 84%;
  padding: 0.6rem 0.85rem;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  animation: foxo-pop 0.25s ease;
}
@keyframes foxo-pop {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.foxo-msg.bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.foxo-msg.user {
  align-self: flex-end;
  background: var(--grad-primary);
  color: #20110a;
  font-weight: 600;
  border-bottom-right-radius: 4px;
}
.foxo-msg a {
  color: var(--gold);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.foxo-msg.user a { color: #351208; }

.foxo-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 0.3rem 0.1rem;
}
.foxo-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: foxo-dot 1s ease-in-out infinite;
}
.foxo-typing i:nth-child(2) { animation-delay: 0.15s; }
.foxo-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes foxo-dot {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50%      { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Quick-reply chips ---------- */
.foxo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 1rem 0.55rem;
}
.foxo-chip {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--gold);
  background: rgba(235, 151, 24, 0.1);
  border: 1px solid rgba(235, 151, 24, 0.35);
  border-radius: 999px;
  padding: 0.38rem 0.8rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
}
.foxo-chip:hover {
  background: rgba(235, 151, 24, 0.22);
  border-color: var(--amber);
  transform: translateY(-1px);
}

/* ---------- Input row ---------- */
.foxo-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}
.foxo-input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.88rem;
  padding: 0.6rem 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.foxo-input::placeholder { color: var(--text-faint); }
.foxo-input:focus { border-color: var(--border-hover); }
.foxo-send {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #20110a;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.2s;
}
.foxo-send:hover { transform: scale(1.08); }
.foxo-send svg { width: 18px; height: 18px; }

.foxo-note {
  font-size: 0.66rem;
  color: var(--text-faint);
  text-align: center;
  padding: 0 1rem 0.55rem;
}

/* ============================================================
   The fox face — states
   ============================================================ */
.fox-svg .fox-pupils { transform: translate(var(--ex, 0px), var(--ey, 0px)); transition: transform 0.12s ease-out; transform-box: view-box; }
.fox-svg .fox-lid    { transform: scaleY(0); transform-box: fill-box; transform-origin: center; }
.fox-svg.blinking .fox-lid { animation: foxo-blink 0.16s ease; transform-box: fill-box; }
@keyframes foxo-blink {
  0%, 100% { transform: scaleY(0); }
  50%      { transform: scaleY(1); }
}
.fox-svg .fox-happy  { opacity: 0; transition: opacity 0.15s; }
.fox-svg .fox-open-eyes { transition: opacity 0.15s; }

.fox-panel.mood-happy .fox-happy       { opacity: 1; }
.fox-panel.mood-happy .fox-open-eyes   { opacity: 0; }
.fox-panel.mood-happy .fox-brow        { transform: translateY(-2px); }
.fox-panel.mood-think .fox-brow        { transform: translateY(-4px) rotate(-4deg); }
.fox-svg .fox-brow { transition: transform 0.2s; transform-box: fill-box; }

.fox-panel.mood-think .fox-avatar svg .fox-ear-l,
.fox-panel.mood-think .fox-avatar svg .fox-ear-r { transform: rotate(-5deg); transform-box: fill-box; transform-origin: bottom center; transition: transform 0.3s; }

/* mouth opens only while talking */
.fox-panel.mood-happy .fox-mouth,
.fox-panel.mood-think .fox-mouth,
.fox-panel:not(.talking) .fox-mouth { transform: scaleY(0.1); transform-box: fill-box; transform-origin: center top; }
.fox-panel.talking .fox-mouth {
  animation: foxo-talk 0.22s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center top;
}
@keyframes foxo-talk {
  0%, 100% { transform: scaleY(0.35); }
  50%      { transform: scaleY(1.4); }
}
.fox-panel.mood-happy .fox-smile { opacity: 1; }
.fox-smile { transition: opacity 0.2s; }

/* ---------- Mobile: bottom sheet ---------- */
@media (max-width: 560px) {
  .foxo-panel {
    right: 0.6rem;
    bottom: 0.6rem;
    width: calc(100vw - 1.2rem);
    height: calc(100dvh - 5.5rem);
  }
  .foxo-launch { width: 52px; height: 52px; right: 0.9rem; bottom: 0.9rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .foxo-ping,
  .foxo-avatar svg,
  .foxo-wave i { animation: none !important; }
}
