/* ─────────────────────────────────────────────
   SEED Avatar v3.0 — Chat UI
   ───────────────────────────────────────────── */

/* ══════ CHAT WRAPPER ══════ */
.chat-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.chat-wrapper.expanded .chat-messages { max-height: 260px; }
.chat-wrapper.expanded .chat-input { font-size: 0.9rem; padding: 14px 20px; }

/* ══════ MESSAGES AREA ══════ */
.chat-messages {
  min-height: 0;
  max-height: 90px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(155, 126, 232, 0.15) transparent;
}

.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(155, 126, 232, 0.15); border-radius: 2px; }

/* ══════ CHAT BUBBLES ══════ */
.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.82rem;
  line-height: 1.55;
  animation: chatFadeIn 0.35s var(--ease-out);
  word-wrap: break-word;
}

.chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.12), rgba(212, 165, 116, 0.06));
  border: 1px solid rgba(212, 165, 116, 0.18);
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
}

.chat-bubble.avni {
  align-self: flex-start;
  background: rgba(155, 126, 232, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(155, 126, 232, 0.12);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-bubble.status {
  align-self: center;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-style: italic;
  padding: 4px 12px;
  border: none;
}

/* ══════ CHAT INPUT ══════ */
.chat-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.chat-input {
  flex: 1;
  padding: 10px 16px;
  background: rgba(12, 12, 28, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.82rem;
  outline: none;
  transition: all var(--duration-normal) var(--ease-out);
}

.chat-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.chat-input:focus {
  border-color: var(--border-focus);
  background: rgba(12, 12, 28, 0.85);
  box-shadow: 0 0 20px rgba(212, 165, 116, 0.06);
}

/* ══════ SEND BUTTON ══════ */
.chat-send-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.2), rgba(155, 126, 232, 0.15));
  border: 1px solid rgba(212, 165, 116, 0.2);
  color: var(--accent-warm);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-normal) var(--ease-out);
  outline: none;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.3), rgba(155, 126, 232, 0.25));
  transform: scale(1.06);
  box-shadow: 0 0 16px rgba(212, 165, 116, 0.12);
}

.chat-send-btn:active {
  transform: scale(0.94);
}

.chat-send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ══════ ANIMATION PANEL ══════ */
.anim-panel {
  width: 100%;
  max-width: 720px;
  background: rgba(12, 12, 28, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.35s var(--ease-out);
  /* Defaults to CLOSED in cinematic mode */
}

.anim-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.anim-panel-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.anim-panel-title {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.anim-panel-chevron {
  font-size: 0.5rem;
  color: var(--text-muted);
  transition: transform 0.3s var(--ease-out);
}

.anim-panel.open .anim-panel-chevron { transform: rotate(180deg); }

.anim-panel-body {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 10px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease-out), padding 0.3s var(--ease-out);
}

.anim-panel.open .anim-panel-body {
  max-height: 160px;
  padding: 4px 10px 10px;
}

.anim-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  outline: none;
  white-space: nowrap;
}

.anim-btn:hover {
  background: var(--accent-glow);
  border-color: rgba(212, 165, 116, 0.2);
  color: var(--accent-warm);
  transform: translateY(-1px);
}

.anim-btn:active { transform: scale(0.96); }

.anim-btn.playing {
  background: rgba(212, 165, 116, 0.15);
  border-color: rgba(212, 165, 116, 0.35);
  color: var(--accent-warm);
  box-shadow: 0 0 16px rgba(212, 165, 116, 0.12);
}

/* ══════ EXPRESSION PICKER ══════ */
.expr-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: all var(--duration-normal) var(--ease-out);
  outline: none;
}

.expr-toggle-btn:hover {
  background: var(--surface-glass-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.expr-toggle-btn.active {
  background: var(--accent-violet-glow);
  border-color: rgba(155, 126, 232, 0.25);
  color: var(--accent-violet);
}

.expr-picker-panel {
  position: fixed;
  bottom: 220px; right: 24px;
  width: 280px;
  z-index: 20;
  background: rgba(10, 10, 22, 0.95);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(155, 126, 232, 0.12);
  border-radius: var(--radius-lg);
  padding: 16px;
  transform: translateY(12px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s var(--ease-spring), opacity 0.3s var(--ease-out);
  overflow-y: auto;
  max-height: 360px;
  scrollbar-width: thin;
  scrollbar-color: rgba(155, 126, 232, 0.12) transparent;
}

.expr-picker-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.expr-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.expr-picker-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 400;
  font-style: italic;
  color: var(--accent-violet);
  letter-spacing: 0.06em;
  opacity: 0.8;
}

.expr-picker-close {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  outline: none;
}

.expr-picker-close:hover {
  background: var(--surface-glass-hover);
  color: var(--text-primary);
}

.expr-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.expr-picker-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 400;
  transition: all 0.2s var(--ease-out);
  outline: none;
}

.expr-picker-btn .ep-emoji {
  font-size: 1rem;
  line-height: 1;
}

.expr-picker-btn:hover {
  background: var(--surface-glass-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.expr-picker-btn.active {
  background: var(--accent-violet-glow);
  border-color: rgba(155, 126, 232, 0.3);
  color: var(--accent-violet);
}

/* ══════ MIC + LIVE BUTTONS ══════ */
.mic-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(12, 12, 28, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-normal) var(--ease-out);
  outline: none;
  flex-shrink: 0;
}

.mic-btn:hover {
  background: var(--surface-glass-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: scale(1.05);
}

.mic-btn:active { transform: scale(0.94); }

.mic-btn.listening {
  background: rgba(224, 90, 90, 0.12);
  border-color: rgba(224, 90, 90, 0.4);
  color: var(--error);
  animation: micPulse 1.2s ease-in-out infinite;
}

.live-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  background: rgba(12, 12, 28, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  gap: 5px;
  transition: all var(--duration-normal) var(--ease-out);
  outline: none;
  flex-shrink: 0;
  font-family: var(--font-body);
  font-weight: 500;
}

.live-btn:hover {
  background: var(--surface-glass-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.live-btn.active {
  background: rgba(224, 90, 90, 0.12);
  border-color: rgba(224, 90, 90, 0.4);
  color: #ff8888;
  animation: livePulse 1.2s ease-in-out infinite;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(224, 90, 90, 0.3);
  background: rgba(224, 90, 90, 0.08);
  color: #ff9090;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: all var(--duration-normal) var(--ease-out);
}

.live-indicator.visible {
  opacity: 1;
  transform: translateY(0);
}

.live-indicator .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #ff6666;
  box-shadow: 0 0 10px rgba(255, 102, 102, 0.8);
  animation: liveDotBlink 1s ease-in-out infinite;
}

.live-ring {
  position: fixed;
  left: 50%; top: 42%;
  width: min(55vw, 560px);
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: 0 0 0 transparent;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
}

.live-active .live-ring {
  opacity: 1;
  border-color: rgba(255, 90, 90, 0.5);
  animation: liveRingPulse 1.6s ease-in-out infinite;
}

/* ══════ AURA RING ══════ */
.aura-ring {
  position: fixed;
  left: 50%; top: 42%;
  width: min(50vw, 480px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity 2.5s ease, box-shadow 3s ease;
}
.aura-ring.visible { opacity: 1; }

/* ══════ EMOTION TIMELINE ══════ */
.emotion-timeline {
  width: 100%; max-width: 720px; height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(12, 12, 28, 0.4);
  border: 1px solid rgba(155, 126, 232, 0.1);
  border-left: 3px solid rgba(155, 126, 232, 0.2);
  overflow: hidden;
  pointer-events: auto;
  opacity: 0.5;
  transition: opacity 0.3s;
}
.emotion-timeline:hover { opacity: 0.85; }
.emotion-timeline canvas { width: 100%; height: 100%; display: block; }

/* ══════ TYPING INDICATOR ══════ */
.typing-dots {
  display: inline-flex; gap: 5px; padding: 10px 14px; align-items: center;
}
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-violet); opacity: 0.35;
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

/* ══════ MEMORY INDICATOR ══════ */
.memory-indicator {
  font-size: 0.63rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ══════ TIME PERIOD ══════ */
.time-indicator {
  position: fixed;
  top: 64px; left: 28px;
  font-size: 0.72rem;
  color: var(--text-muted);
  z-index: 10;
  pointer-events: none;
  font-family: var(--font-display);
  font-style: italic;
  letter-spacing: 0.03em;
  opacity: 0.5;
}

/* ══════ RESPONSIVE ══════ */
@media (max-width: 640px) {
  .bottom-controls-row { flex-wrap: wrap; }
  .toolbar-row { order: 3; width: 100%; justify-content: center; }
  .chat-wrapper { max-width: 100%; }
  .chat-messages { max-height: 80px; }
  .live-btn { height: 34px; padding: 0 10px; font-size: 0.62rem; }
  .live-indicator { font-size: 0.52rem; padding: 4px 8px; }
  .expr-picker-panel { width: 260px; right: 12px; bottom: 180px; }
  .anim-panel { max-width: 100%; }
  .rasa-grid { gap: 4px; }
  .rasa-btn { min-width: 46px; padding: 4px 6px 3px; }
  .rasa-btn .emoji { font-size: 1rem; }
  .rasa-btn .label { font-size: 0.44rem; }
  .current-rasa { right: 12px; }
  .current-rasa-name { font-size: 1.4rem; }
  .current-rasa-emoji { font-size: 2rem; }
  .header { padding: 12px 16px; }
  .header-left { gap: 10px; }
  .header-title { font-size: 0.95rem; }
  .bottom-panel { padding: 0 10px 10px; }
  .model-selector-btn { padding: 5px 10px 5px 8px; font-size: 0.68rem; }
  .model-selector-btn .model-icon { width: 18px; height: 18px; font-size: 0.58rem; }
  .model-dropdown { min-width: 200px; }
  .seed-panel { right: 12px; width: 180px; bottom: 170px; }
  .controls-right { gap: 4px; }
  .slider-row { width: 130px; padding: 4px 8px; }
  .icon-btn { width: 28px; height: 28px; font-size: 0.8rem; }
  .seed-btn-toggle { width: 28px; height: 28px; font-size: 0.8rem; }
}