/* --- AVATAR ENGINE CSS (Modular & Embeddable) --- */

/* Parent Container Context (Ensure relative positioning if not already defined) */
.contact-form-container {
  position: relative;
  overflow: hidden;
}

/* 1. LOADING OVERLAY (AI Synthesis Console) */
.avatar-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 12, 22, 0.95);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.avatar-loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Spinning AI Core Orbe */
.avatar-loader-orb {
  width: 70px;
  height: 70px;
  position: relative;
  margin-bottom: 2rem;
}

.avatar-loader-circle {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent-purple);
  border-bottom-color: var(--accent-teal);
  animation: avatar-loader-spin 1.8s linear infinite;
}

.avatar-loader-inner {
  position: absolute;
  top: 15%;
  left: 15%;
  width: 70%;
  height: 70%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
  opacity: 0.8;
  animation: avatar-loader-pulse 2s ease-in-out infinite alternate;
}

/* Laser Scanning Line */
.avatar-laser-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(to right, transparent, var(--accent-teal), var(--accent-blue), transparent);
  box-shadow: 0 0 12px var(--accent-teal);
  animation: avatar-laser-move 3s ease-in-out infinite;
  opacity: 0.6;
}

/* Custom Terminal Console Logs */
.avatar-terminal {
  width: 100%;
  max-width: 380px;
  background: rgba(5, 5, 10, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 1.25rem;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.8rem;
  color: #a0aec0;
  margin-bottom: 1.5rem;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.8);
}

.avatar-terminal-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 0.5rem;
}

.avatar-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.avatar-dot.red { background: #ef4444; }
.avatar-dot.yellow { background: #f59e0b; }
.avatar-dot.green { background: #10b981; }

.avatar-terminal-title {
  margin-left: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.avatar-terminal-logs {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 110px;
}

.avatar-log-line {
  opacity: 0;
  transform: translateY(4px);
  animation: avatar-log-fade 0.3s forwards;
}

.avatar-log-tag {
  color: var(--accent-teal);
  font-weight: bold;
}
.avatar-log-tag.info { color: var(--accent-blue); }
.avatar-log-tag.done { color: var(--accent-emerald); }


/* 2. VIDEO PLAYER VIEW (The Avatar Card) */
.avatar-player-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 12, 22, 0.98);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  z-index: 11;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.75rem;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.97);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.avatar-player-overlay.active {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
}

/* Header Info */
.avatar-player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.75rem;
}

.avatar-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.2);
  border-radius: 20px;
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent-teal);
  text-transform: uppercase;
}

.avatar-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-teal);
  box-shadow: 0 0 8px var(--accent-teal);
  animation: avatar-loader-pulse 1s infinite alternate;
}

/* Portrait Representation */
.avatar-portrait-container {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin: 1rem 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.avatar-portrait-img {
  width: auto;
  height: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 50%;
  aspect-ratio: 1;
  border: 2px solid var(--border-glass);
  box-shadow: 0 0 30px rgba(0,0,0,0.6), 0 0 15px rgba(0, 242, 254, 0.1);
  transition: transform 0.5s ease;
  animation: avatar-breathing 4s ease-in-out infinite alternate;
}

.avatar-portrait-container:hover .avatar-portrait-img {
  transform: scale(1.03);
}

/* Character Badge Nameplate */
.avatar-nameplate {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 12, 22, 0.85);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(8px);
  border-radius: 6px;
  padding: 0.4rem 1rem;
  text-align: center;
  width: 85%;
}

.avatar-name {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0.02em;
}

.avatar-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 1px 0 0 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* 3. DYNAMIC AUDIO EQUALIZER */
.avatar-equalizer {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 35px;
  margin-bottom: 0.75rem;
}

.equalizer-bar {
  width: 4px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to top, var(--accent-blue), var(--accent-teal));
  opacity: 0.3;
  transition: height 0.1s ease, opacity 0.3s ease;
}

.avatar-equalizer.playing .equalizer-bar {
  opacity: 0.9;
  animation: equalizer-bounce 1s infinite alternate;
}

/* Distribute random anim delays for natural audio look */
.avatar-equalizer.playing .equalizer-bar:nth-child(2n) { animation-delay: 0.15s; }
.avatar-equalizer.playing .equalizer-bar:nth-child(3n) { animation-delay: 0.3s; }
.avatar-equalizer.playing .equalizer-bar:nth-child(4n) { animation-delay: 0.05s; }
.avatar-equalizer.playing .equalizer-bar:nth-child(5n) { animation-delay: 0.4s; }
.avatar-equalizer.playing .equalizer-bar:nth-child(6n) { animation-delay: 0.25s; }

/* 4. SUBTITLES INTERFACE */
.avatar-subtitles-box {
  background: rgba(5, 5, 10, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  min-height: 80px;
  max-height: 100px;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #cbd5e1;
  text-align: center;
  margin-bottom: 1rem;
  box-shadow: inset 0 1px 6px rgba(0,0,0,0.4);
}

.avatar-subtitles-text {
  margin: 0;
  font-family: var(--font-body);
}

/* 5. PLAYER ACTION BUTTONS */
.avatar-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.avatar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.avatar-btn-replay {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.avatar-btn-replay:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.avatar-btn-mute {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.avatar-btn-mute:hover {
  background: rgba(255, 255, 255, 0.08);
}

.avatar-btn-mute.muted {
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.avatar-btn-close {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(74, 0, 224, 0.2) 0%, rgba(0, 242, 254, 0.2) 100%);
  border: 1px solid rgba(0, 242, 254, 0.3);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.1);
  margin-top: 0.25rem;
}

.avatar-btn-close:hover {
  background: linear-gradient(135deg, rgba(74, 0, 224, 0.35) 0%, rgba(0, 242, 254, 0.35) 100%);
  border-color: rgba(0, 242, 254, 0.6);
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.2);
}

/* Disable styles */
.avatar-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


/* --- ANIMATION KEYFRAMES --- */

/* Loader Spin */
@keyframes avatar-loader-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Pulse Orbe */
@keyframes avatar-loader-pulse {
  0% { opacity: 0.4; transform: scale(0.95); }
  100% { opacity: 0.9; transform: scale(1.05); }
}

/* Laser scan line sweep */
@keyframes avatar-laser-move {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}

/* Log lines enter */
@keyframes avatar-log-fade {
  to { opacity: 1; transform: translateY(0); }
}

/* Natural breathing motion for the static executive photo */
@keyframes avatar-breathing {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 30px rgba(0,0,0,0.6), 0 0 15px rgba(0, 242, 254, 0.08);
  }
  100% {
    transform: translateY(-2px) scale(1.015);
    box-shadow: 0 0 35px rgba(0,0,0,0.7), 0 0 22px rgba(0, 242, 254, 0.15);
  }
}

/* Equalizer Bars animations */
@keyframes equalizer-bounce {
  0% { height: 4px; }
  100% { height: 28px; }
}
