/**
 * AEYA NAVIGATOR — Freestanding AI Nurse Mascot & Conversational Chat
 * System: Sirin Backoffice Suite (App89)
 * Character: เอญ่า (Aeya) — Smart Hospital AI Assistant
 * Design: Quiet Luxury Healthcare (Pure Transparent Cutout Mascot)
 */

/* ==========================================================================
   1. Freestanding Mascot Character (Standing at Bottom Right, No Circle Box)
   ========================================================================== */
.aeya-freestanding-container {
  position: fixed;
  bottom: 0;
  right: 20px;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  font-family: var(--sui-font-body, "Sarabun", sans-serif);
}

/* Greeting Speech Bubble Above Mascot */
.aeya-speech-bubble {
  pointer-events: auto;
  position: absolute;
  bottom: 165px;
  right: 10px;
  width: 240px;
  background: var(--sui-surface, #ffffff);
  color: var(--sui-text, #211c27);
  padding: 10px 14px 10px 12px;
  border-radius: 16px 16px 4px 16px;
  box-shadow: var(--sui-shadow, 0 14px 36px rgba(52, 34, 64, 0.18));
  border: 1.5px solid var(--sui-line-strong, rgba(122, 90, 157, 0.35));
  font-size: 0.84rem;
  line-height: 1.4;
  cursor: pointer;
  transform-origin: bottom right;
  animation: aeyaBubblePop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transition: transform 0.2s ease, opacity 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.aeya-speech-bubble:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: var(--sui-accent, #7a5a9d);
}

.aeya-speech-bubble .aeya-bubble-text {
  flex: 1;
}

.aeya-speech-bubble .aeya-bubble-text strong {
  display: block;
  color: var(--sui-accent-strong, #53366f);
  font-size: 0.86rem;
  margin-bottom: 2px;
  font-family: var(--sui-font-display, "Prompt", sans-serif);
}

.aeya-speech-bubble .aeya-bubble-close {
  background: none;
  border: none;
  color: var(--sui-muted, #675f6d);
  cursor: pointer;
  padding: 2px;
  font-size: 14px;
  line-height: 1;
  border-radius: 50%;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.aeya-speech-bubble .aeya-bubble-close:hover {
  opacity: 1;
  color: var(--sui-danger, #b42318);
}

/* Mascot Clickable Stage */
.aeya-mascot-figure-btn {
  pointer-events: auto;
  position: relative;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: aeyaMascotFloat 4.2s ease-in-out infinite;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 10px 22px rgba(83, 54, 111, 0.28));
}

.aeya-mascot-figure-btn:hover {
  transform: translateY(-6px) scale(1.06);
  filter: drop-shadow(0 16px 30px rgba(122, 90, 157, 0.45));
}

.aeya-mascot-figure-btn:active {
  transform: scale(0.96);
}

/* Transparent Character Image Wrapper */
.aeya-cutout-wrapper {
  position: relative;
  width: 115px;
  height: 155px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.aeya-depth-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 10px 20px rgba(83, 54, 111, 0.24));
  transition: opacity 0.22s ease, filter 0.25s ease;
}

.aeya-cutout-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  display: block;
  pointer-events: none;
  user-select: none;
  opacity: 1;
  transition: opacity 0.22s ease, transform 0.25s ease, filter 0.25s ease;
}

.aeya-component-root[data-render-mode="depth"].is-depth-ready .aeya-depth-canvas {
  opacity: 1;
}

.aeya-component-root[data-render-mode="depth"].is-depth-ready .aeya-cutout-img {
  opacity: 0;
}

/* Futuristic Tablet Hologram Glow (Thinking / Searching State) */
.aeya-tablet-holo-glow {
  position: absolute;
  bottom: 22%;
  left: 12%;
  width: 48px;
  height: 38px;
  background: radial-gradient(ellipse at center, rgba(0, 242, 254, 0.55) 0%, rgba(122, 90, 157, 0.2) 60%, transparent 85%);
  border-radius: 8px;
  filter: blur(4px);
  opacity: 0;
  transform: scale(0.7);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}

/* Body Gestures & State Classes */
/* State: Thinking / Searching */
.aeya-mascot-figure-btn.is-thinking .aeya-cutout-img,
.aeya-mascot-figure-btn.is-searching .aeya-cutout-img {
  filter: drop-shadow(0 0 14px rgba(0, 242, 254, 0.65)) drop-shadow(0 10px 22px rgba(83, 54, 111, 0.28));
}

.aeya-mascot-figure-btn.is-thinking .aeya-depth-canvas,
.aeya-mascot-figure-btn.is-searching .aeya-depth-canvas {
  filter: drop-shadow(0 0 12px rgba(0, 242, 254, 0.5)) drop-shadow(0 10px 20px rgba(83, 54, 111, 0.25));
}

.aeya-mascot-figure-btn.is-thinking .aeya-tablet-holo-glow,
.aeya-mascot-figure-btn.is-searching .aeya-tablet-holo-glow {
  opacity: 1;
  transform: scale(1.15);
  animation: aeyaTabletPulse 1.2s infinite alternate ease-in-out;
}

/* State: Speaking / Guiding */
.aeya-mascot-figure-btn.is-speaking .aeya-cutout-img {
  filter: drop-shadow(0 0 16px rgba(24, 121, 78, 0.85)) drop-shadow(0 0 26px rgba(122, 90, 157, 0.45));
  animation: aeyaSpeakingBob 0.6s infinite alternate ease-in-out;
}

.aeya-mascot-figure-btn.is-speaking .aeya-depth-canvas {
  filter: drop-shadow(0 0 14px rgba(24, 121, 78, 0.72)) drop-shadow(0 0 22px rgba(122, 90, 157, 0.35));
}

/* Mascot Name Badge Tag */
.aeya-name-tag {
  margin-top: -8px;
  position: relative;
  z-index: 2;
  background: var(--sui-surface, #ffffff);
  border: 1.5px solid var(--sui-line-strong, rgba(122, 90, 157, 0.35));
  padding: 3px 10px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(52, 34, 64, 0.15);
  font-family: var(--sui-font-display, "Prompt", sans-serif);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--sui-text, #211c27);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.aeya-name-tag .aeya-tag-dot {
  width: 7px;
  height: 7px;
  background: var(--sui-success, #18794e);
  border-radius: 50%;
  animation: aeyaPulse 2s infinite;
}

/* User-visible safety switch: the original 2D cutout is always one tap away. */
.aeya-render-toggle {
  pointer-events: auto;
  position: absolute;
  right: -10px;
  bottom: 28px;
  z-index: 4;
  width: 44px;
  height: 44px;
  padding: 5px 4px 4px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 1px solid var(--sui-line-strong, rgba(122, 90, 157, 0.35));
  border-radius: 999px;
  background: var(--sui-surface, #ffffff);
  background: color-mix(in srgb, var(--sui-surface, #ffffff) 92%, transparent);
  color: var(--sui-accent-strong, #53366f);
  box-shadow: 0 6px 16px rgba(52, 34, 64, 0.18);
  backdrop-filter: blur(10px);
  cursor: pointer;
  font-family: var(--sui-font-body, "Sarabun", sans-serif);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.aeya-render-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.aeya-render-toggle:hover {
  transform: translateY(-2px);
  border-color: var(--sui-accent, #7a5a9d);
}

.aeya-render-toggle:focus-visible {
  outline: 3px solid var(--sui-focus, rgba(122, 90, 157, 0.38));
  outline-offset: 2px;
}

.aeya-render-toggle[aria-pressed="true"] {
  background: var(--sui-surface-soft, #eee5f6);
  background: color-mix(in srgb, var(--sui-accent-soft, #eee5f6) 88%, var(--sui-surface, #ffffff));
  border-color: var(--sui-accent, #7a5a9d);
}

/* ==========================================================================
   2. Interactive Chat Stream Window (Docked Beside Character)
   ========================================================================== */
.aeya-chat-dock {
  position: fixed;
  bottom: 20px;
  right: 155px;
  z-index: 1060;
  width: 400px;
  max-width: calc(100vw - 180px);
  height: 550px;
  max-height: calc(100vh - 40px);
  background: var(--sui-surface, #ffffff);
  border-radius: 20px;
  box-shadow: var(--sui-shadow, 0 24px 70px rgba(52, 34, 64, 0.25));
  border: 1px solid var(--sui-line-strong, rgba(122, 90, 157, 0.28));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateX(30px) scale(0.94);
  transform-origin: bottom right;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease;
  font-family: var(--sui-font-body, "Sarabun", sans-serif);
}

.aeya-chat-dock.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateX(0) scale(1);
}

/* Chat Header */
.aeya-chat-header {
  padding: 12px 16px;
  background: linear-gradient(to right, var(--sui-surface-soft, #f4eff5), var(--sui-surface, #ffffff));
  border-bottom: 1px solid var(--sui-line, rgba(83, 54, 111, 0.12));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.aeya-chat-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.aeya-profile-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--sui-accent, #7a5a9d);
  box-shadow: 0 2px 8px rgba(122, 90, 157, 0.2);
}

.aeya-profile-info h4 {
  font-family: var(--sui-font-display, "Prompt", sans-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--sui-text, #211c27);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.aeya-status-badge {
  font-size: 0.7rem;
  color: var(--sui-success, #18794e);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.aeya-status-badge::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--sui-success, #18794e);
  border-radius: 50%;
  animation: aeyaPulse 2s infinite;
}

.aeya-chat-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.aeya-action-btn {
  background: var(--sui-surface-soft, #f4eff5);
  border: 1px solid var(--sui-line, rgba(83, 54, 111, 0.15));
  color: var(--sui-muted, #675f6d);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}

.aeya-action-btn:hover {
  background: var(--sui-glow, rgba(154, 112, 181, 0.2));
  color: var(--sui-accent-strong, #53366f);
}

.aeya-action-btn.is-active {
  background: var(--sui-accent, #7a5a9d);
  color: #ffffff;
  border-color: var(--sui-accent, #7a5a9d);
}

/* Chat Messages Body */
.aeya-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--sui-canvas-alt, #f0ebf1);
}

.aeya-chat-messages::-webkit-scrollbar {
  width: 5px;
}

.aeya-chat-messages::-webkit-scrollbar-thumb {
  background: var(--sui-line-strong, rgba(83, 54, 111, 0.25));
  border-radius: 99px;
}

/* Time Divider */
.aeya-time-divider {
  text-align: center;
  font-size: 0.72rem;
  color: var(--sui-muted, #8d8594);
  position: relative;
  margin: 4px 0;
}

/* Message Rows */
.aeya-msg-row {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: aeyaMsgIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.aeya-msg-row.is-bot {
  align-self: flex-start;
}

.aeya-msg-row.is-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.aeya-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--sui-accent, #7a5a9d);
  flex-shrink: 0;
  margin-top: 2px;
}

.aeya-msg-bubble {
  padding: 10px 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.aeya-msg-row.is-bot .aeya-msg-bubble {
  background: var(--sui-surface, #ffffff);
  color: var(--sui-text, #211c27);
  border-radius: 16px 16px 16px 4px;
  border: 1px solid var(--sui-line, rgba(83, 54, 111, 0.15));
}

.aeya-msg-row.is-user .aeya-msg-bubble {
  background: var(--sui-accent, #7a5a9d);
  color: var(--sui-on-accent, #ffffff);
  border-radius: 16px 16px 4px 16px;
}

.aeya-msg-time {
  font-size: 0.68rem;
  color: var(--sui-muted, #8d8594);
  margin-top: 4px;
  text-align: right;
}

.aeya-msg-row.is-user .aeya-msg-time {
  color: rgba(255, 255, 255, 0.8);
}

/* Speak Message Button inside Bubble */
.aeya-msg-speak-btn {
  background: none;
  border: none;
  color: var(--sui-muted, #675f6d);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 2px 4px;
  margin-left: 6px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.aeya-msg-speak-btn:hover {
  opacity: 1;
  color: var(--sui-accent, #7a5a9d);
}

/* Minimal Direct App Pills (Capsule Style) */
.aeya-app-pills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.aeya-app-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--sui-surface, #ffffff);
  border: 1px solid var(--sui-line-strong, rgba(122, 90, 157, 0.25));
  color: var(--sui-accent-strong, #53366f);
  text-decoration: none;
  font-family: var(--sui-font-display, "Prompt", sans-serif);
  font-size: 0.82rem;
  font-weight: 550;
  box-shadow: 0 2px 6px rgba(52, 34, 64, 0.04);
  transition: all 0.18s ease;
  cursor: pointer;
  max-width: 100%;
}

.aeya-app-pill:hover {
  background: var(--sui-accent-strong, #53366f);
  color: #ffffff;
  border-color: var(--sui-accent-strong, #53366f);
  box-shadow: 0 4px 12px rgba(83, 54, 111, 0.22);
  transform: translateY(-1px);
}

.aeya-app-pill-icon {
  font-size: 0.8rem;
  color: var(--sui-accent, #7a5a9d);
  display: inline-flex;
  align-items: center;
  transition: color 0.18s ease;
}

.aeya-app-pill:hover .aeya-app-pill-icon {
  color: #ffffff;
}

.aeya-app-pill-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aeya-app-pill-arrow {
  font-size: 0.72rem;
  opacity: 0.65;
  margin-left: 1px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.aeya-app-pill:hover .aeya-app-pill-arrow {
  opacity: 1;
  transform: translateX(2px);
}

/* Rich Result Action Card Inside Chat (Legacy fallback) */
.aeya-card-wrapper {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aeya-chat-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--sui-surface-soft, #f4eff5);
  border: 1px solid var(--sui-line-strong, rgba(122, 90, 157, 0.25));
  border-radius: 12px;
  text-decoration: none;
  color: var(--sui-text, #211c27);
  transition: all 0.15s ease;
  cursor: pointer;
}

.aeya-chat-card:hover {
  background: var(--sui-surface, #ffffff);
  border-color: var(--sui-accent, #7a5a9d);
  box-shadow: 0 4px 14px rgba(122, 90, 157, 0.18);
  transform: translateY(-2px);
}

.aeya-chat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--sui-glow, rgba(154, 112, 181, 0.2));
  color: var(--sui-accent, #7a5a9d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.aeya-chat-card:hover .aeya-chat-card-icon {
  background: var(--sui-accent, #7a5a9d);
  color: #ffffff;
}

.aeya-chat-card-body {
  flex: 1;
  min-width: 0;
}

.aeya-chat-card-title {
  font-family: var(--sui-font-display, "Prompt", sans-serif);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sui-text, #211c27);
  margin: 0;
}

.aeya-chat-card-desc {
  font-size: 0.76rem;
  color: var(--sui-muted, #675f6d);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.aeya-chat-card-btn {
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--sui-accent, #7a5a9d);
  color: #ffffff;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Interactive Suggestion Chips in Chat */
.aeya-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.aeya-chat-chip {
  display: inline-flex;
  align-items: center;
  background: var(--sui-surface, #ffffff);
  border: 1px solid var(--sui-line-strong, rgba(122, 90, 157, 0.25));
  color: var(--sui-accent-strong, #53366f);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(52, 34, 64, 0.04);
  transition: all 0.18s ease;
}

.aeya-chat-chip:hover {
  background: var(--sui-accent-strong, #53366f);
  color: #ffffff;
  border-color: var(--sui-accent-strong, #53366f);
  box-shadow: 0 4px 12px rgba(83, 54, 111, 0.22);
  transform: translateY(-1px);
}

/* Typing Indicator */
.aeya-typing-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--sui-surface, #ffffff);
  border: 1px solid var(--sui-line, rgba(83, 54, 111, 0.15));
  border-radius: 16px 16px 16px 4px;
  width: fit-content;
}

.aeya-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--sui-accent, #7a5a9d);
  border-radius: 50%;
  animation: aeyaDotBounce 1.4s infinite ease-in-out both;
}

.aeya-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.aeya-typing-dot:nth-child(2) { animation-delay: -0.16s; }

.aeya-typing-text {
  font-size: 0.74rem;
  color: var(--sui-muted, #675f6d);
}

/* Chat Footer & Input */
.aeya-chat-footer {
  padding: 10px 14px 14px;
  background: var(--sui-surface, #ffffff);
  border-top: 1px solid var(--sui-line, rgba(83, 54, 111, 0.12));
  flex-shrink: 0;
}

.aeya-quick-prompts {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 8px;
}

.aeya-quick-prompts::-webkit-scrollbar {
  display: none;
}

.aeya-prompt-pill {
  background: var(--sui-surface-soft, #f4eff5);
  border: 1px solid var(--sui-line, rgba(83, 54, 111, 0.15));
  color: var(--sui-muted, #675f6d);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.74rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.aeya-prompt-pill:hover {
  background: var(--sui-glow, rgba(154, 112, 181, 0.2));
  color: var(--sui-accent-strong, #53366f);
}

.aeya-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.aeya-chat-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-family: var(--sui-font-body, "Sarabun", sans-serif);
  color: var(--sui-text, #211c27);
  background: var(--sui-surface-soft, #f4eff5);
  border: 1.5px solid var(--sui-line-strong, rgba(122, 90, 157, 0.25));
  border-radius: 12px;
  outline: none;
  transition: all 0.2s ease;
}

.aeya-chat-input:focus {
  background: var(--sui-surface, #ffffff);
  border-color: var(--sui-focus, #7a5a9d);
  box-shadow: 0 0 0 3px var(--sui-glow, rgba(154, 112, 181, 0.2));
}

.aeya-chat-input::placeholder {
  color: var(--sui-muted, #8d8594);
  font-size: 0.82rem;
}

.aeya-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--sui-accent, #7a5a9d);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.aeya-send-btn:hover {
  background: var(--sui-accent-strong, #53366f);
  transform: scale(1.05);
}

.aeya-send-btn:active {
  transform: scale(0.95);
}

/* ==========================================================================
   3. Animations
   ========================================================================== */
@keyframes aeyaMascotFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes aeyaSpeakingBob {
  0% {
    transform: translateY(0) scale(1);
  }
  100% {
    transform: translateY(-3px) scale(1.02);
  }
}

@keyframes aeyaSpeakingNod {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  100% {
    transform: translateY(-4px) rotate(-1.5deg);
  }
}

@keyframes aeyaTabletPulse {
  0% {
    opacity: 0.6;
    transform: scale(1);
    filter: blur(3px);
  }
  100% {
    opacity: 1;
    transform: scale(1.25);
    filter: blur(6px);
  }
}

@keyframes aeyaBubblePop {
  0% {
    opacity: 0;
    transform: scale(0.7) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes aeyaMsgIn {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes aeyaPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(24, 121, 78, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(24, 121, 78, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(24, 121, 78, 0);
  }
}

@keyframes aeyaDotBounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* ==========================================================================
   3.5 Voice Settings Studio Panel (Drawer inside Chat Dock)
   ========================================================================== */
.aeya-voice-panel {
  position: absolute;
  top: 62px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--sui-surface, #ffffff);
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  transform: translateY(-15px);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, visibility 0.25s ease;
}

.aeya-voice-panel.is-open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.aeya-voice-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--sui-line, rgba(83, 54, 111, 0.12));
}

.aeya-voice-panel-header h5 {
  font-family: var(--sui-font-display, "Prompt", sans-serif);
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--sui-text, #211c27);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.aeya-admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(122, 90, 157, 0.15);
  color: var(--sui-accent-strong, #53366f);
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  border: 1px solid rgba(122, 90, 157, 0.3);
}

.aeya-voice-panel-desc {
  font-size: 0.78rem;
  color: var(--sui-muted, #675f6d);
  margin-bottom: 14px;
  line-height: 1.4;
}

/* Voice Card List */
.aeya-voice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.aeya-voice-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--sui-surface-soft, #f4eff5);
  border: 1.5px solid var(--sui-line, rgba(83, 54, 111, 0.15));
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.aeya-voice-card:hover {
  background: var(--sui-surface, #ffffff);
  border-color: var(--sui-accent, #7a5a9d);
  box-shadow: 0 4px 12px rgba(122, 90, 157, 0.12);
}

.aeya-voice-card.is-selected {
  background: var(--sui-surface, #ffffff);
  border-color: var(--sui-accent, #7a5a9d);
  box-shadow: 0 0 0 2px var(--sui-accent, #7a5a9d);
}

.aeya-voice-info {
  flex: 1;
  min-width: 0;
}

.aeya-voice-name {
  font-family: var(--sui-font-display, "Prompt", sans-serif);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--sui-text, #211c27);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.aeya-voice-type {
  font-size: 0.72rem;
  color: var(--sui-muted, #675f6d);
  margin-top: 2px;
}

.aeya-gender-badge {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 500;
}

.aeya-gender-badge.female {
  background: rgba(122, 90, 157, 0.15);
  color: var(--sui-accent-strong, #53366f);
}

.aeya-gender-badge.male {
  background: rgba(43, 114, 186, 0.15);
  color: #1a5695;
}

.aeya-rec-badge {
  background: var(--sui-accent, #7a5a9d);
  color: #ffffff;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 500;
}

.aeya-voice-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.aeya-preview-btn {
  background: var(--sui-surface, #ffffff);
  border: 1px solid var(--sui-line-strong, rgba(122, 90, 157, 0.3));
  color: var(--sui-accent-strong, #53366f);
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.aeya-preview-btn:hover {
  background: var(--sui-accent, #7a5a9d);
  color: #ffffff;
}

.aeya-select-radio {
  width: 16px;
  height: 16px;
  accent-color: var(--sui-accent, #7a5a9d);
  cursor: pointer;
}

/* Sliders Control Section */
.aeya-sliders-box {
  background: var(--sui-surface-soft, #f4eff5);
  border: 1px solid var(--sui-line, rgba(83, 54, 111, 0.12));
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.aeya-slider-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aeya-slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--sui-text, #211c27);
  font-weight: 500;
}

.aeya-slider-val {
  color: var(--sui-accent-strong, #53366f);
  font-weight: 600;
}

.aeya-range-input {
  width: 100%;
  accent-color: var(--sui-accent, #7a5a9d);
  cursor: pointer;
}

/* Panel Footer */
.aeya-voice-panel-footer {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

.aeya-save-voice-btn {
  flex: 1;
  padding: 9px 14px;
  background: var(--sui-accent, #7a5a9d);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-family: var(--sui-font-display, "Prompt", sans-serif);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.aeya-save-voice-btn:hover {
  background: var(--sui-accent-strong, #53366f);
}

.aeya-close-panel-btn {
  padding: 9px 14px;
  background: var(--sui-surface-soft, #f4eff5);
  border: 1px solid var(--sui-line, rgba(83, 54, 111, 0.15));
  color: var(--sui-muted, #675f6d);
  border-radius: 10px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.aeya-close-panel-btn:hover {
  color: var(--sui-text, #211c27);
}

/* ==========================================================================
   4. Theme overrides & Responsive
   ========================================================================== */
[data-theme="cyber"] .aeya-name-tag {
  background: #0d1b2a;
  border-color: rgba(0, 242, 254, 0.4);
}

[data-theme="cyber"] .aeya-render-toggle {
  background: rgba(13, 27, 42, 0.92);
  border-color: rgba(0, 242, 254, 0.42);
  color: #8ff8ff;
}

[data-theme="saturday"] .aeya-render-toggle {
  background: rgba(15, 23, 42, 0.94);
  border-color: #fbbf24;
  color: #f8fafc;
}

[data-theme="cyber"] .aeya-chat-dock {
  background: #0d1b2a;
  border-color: rgba(0, 242, 254, 0.35);
  box-shadow: 0 0 40px rgba(0, 242, 254, 0.25);
}

[data-theme="cyber"] .aeya-chat-messages {
  background: #060d15;
}

/* Responsive */
@media (max-width: 640px) {
  .aeya-freestanding-container {
    right: 12px;
  }
  .aeya-cutout-wrapper {
    width: 90px;
    height: 125px;
  }
  .aeya-render-toggle {
    right: -6px;
    bottom: 24px;
  }
  .aeya-speech-bubble {
    bottom: 135px;
    right: 0;
    width: 220px;
  }
  .aeya-chat-dock {
    bottom: 90px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    height: calc(100vh - 110px);
    transform: translateY(20px) scale(0.95);
  }
  .aeya-chat-dock.is-open {
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .aeya-mascot-figure-btn,
  .aeya-mascot-figure-btn.is-speaking .aeya-cutout-img,
  .aeya-mascot-figure-btn.is-thinking .aeya-tablet-holo-glow,
  .aeya-mascot-figure-btn.is-searching .aeya-tablet-holo-glow,
  .aeya-name-tag .aeya-tag-dot {
    animation: none !important;
  }

  .aeya-depth-canvas,
  .aeya-cutout-img,
  .aeya-render-toggle {
    transition-duration: 0.01ms !important;
  }
}
