/* Avatar CSS */

.avatar-narrator-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 300px;
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  padding: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: fade-in-up var(--duration-normal) var(--ease-out-expo) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.avatar-narrator-container.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

.avatar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.avatar-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--glow-green);
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-title .led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--glow-green);
  box-shadow: 0 0 8px var(--glow-green);
  animation: hologram-flicker 2s infinite;
}

.avatar-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color var(--duration-fast) ease, background var(--duration-fast) ease;
}

.avatar-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.avatar-visual {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 255, 65, 0.2);
}

.avatar-matrix-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.3;
  pointer-events: none;
}

.avatar-hologram {
  width: 64px;
  height: 64px;
  color: var(--glow-green);
  opacity: 0.8;
  transition: transform 0.1s ease, filter 0.1s ease;
  filter: drop-shadow(0 0 8px rgba(0, 255, 65, 0.5));
}

.avatar-hologram.speaking {
  transform: scale(1.1);
  filter: drop-shadow(0 0 16px rgba(0, 255, 65, 0.8));
  animation: hologram-speaking 0.5s infinite alternate;
}

.avatar-hologram.loading {
  animation: spin 2s linear infinite;
}

.audio-visualizer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}

.audio-visualizer.active {
  opacity: 1;
}

.audio-bar {
  width: 4px;
  background: var(--glow-green);
  border-radius: 2px 2px 0 0;
  height: 4px;
  transition: height 0.05s ease;
}

.avatar-subtitle-container {
  max-height: 140px;
  overflow-y: auto;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  border-left: 2px solid var(--glow-green);
}

.avatar-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hologram-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes hologram-speaking {
  0% { transform: scale(1.05); filter: drop-shadow(0 0 10px rgba(0, 255, 65, 0.6)); }
  100% { transform: scale(1.15); filter: drop-shadow(0 0 20px rgba(0, 255, 65, 1)); }
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  .avatar-narrator-container {
    width: calc(100vw - 32px);
    bottom: 16px;
    right: 16px;
  }
}
