/* ============================================================
   Talking Head widget styles — AyechBusiness landing
   ============================================================ */
.hero-image {
  position: relative;
}

/* Avatar talking-head animation */
.th-avatar {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border-radius: 50%;
  will-change: transform;
}

/* Speaking: gentle bob + glow + subtle scale */
.th-avatar.th-speaking {
  animation: th-bob 0.9s ease-in-out infinite;
  box-shadow:
    0 0 40px rgba(124, 58, 237, 0.55),
    0 0 90px rgba(124, 58, 237, 0.25);
}

@keyframes th-bob {
  0%   { transform: translateY(0) scale(1); }
  30%  { transform: translateY(-6px) scale(1.015); }
  60%  { transform: translateY(2px) scale(0.995); }
  100% { transform: translateY(0) scale(1); }
}

/* Simli avatar live video — matches the static image envelope
   (portrait 368x560, rounded corners, max-height 500px). */
#th-video {
  max-width: 320px;
  width: 100%;
  max-height: 500px;
  border-radius: 20px;
  object-fit: cover;
  object-position: center;
  filter: drop-shadow(0 20px 60px rgba(0,0,0,0.4));
  background: #000;
}
@media (max-width: 768px) {
  #th-video { max-height: 250px; }
}

/* Presentation pitch video — same portrait envelope as the avatar,
   fills the widget over the static image. Plays WITH audio; the Talk
   click is a user gesture so autoplay-with-sound is permitted.
   Follows the avatar pattern: it replaces the image as the centered
   flex child of .hero-image (absolute-free, so it inherits centering). */
#th-pres {
  max-width: 320px;
  width: 100%;
  max-height: 500px;
  border-radius: 20px;
  object-fit: cover;
  object-position: center;
  filter: drop-shadow(0 20px 60px rgba(0,0,0,0.4));
  background: #000;
}
@media (max-width: 768px) {
  #th-pres { max-height: 250px; }
}

/* Status pill */
.th-pill {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 10, 18, 0.85);
  border: 1px solid rgba(124, 58, 237, 0.5);
  color: #e5e5e5;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 6px 14px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  z-index: 5;
  white-space: nowrap;
}

.th-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #555;
  flex-shrink: 0;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.th-dot.idle      { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); }
.th-dot.busy      { background: #f59e0b; box-shadow: 0 0 8px rgba(245, 158, 11, 0.6); animation: th-pulse 1.1s infinite; }
.th-dot.speaking  { background: #7c3aed; box-shadow: 0 0 12px rgba(124, 58, 237, 0.9); animation: th-pulse 0.7s infinite; }
.th-dot.error     { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }

@keyframes th-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.8); }
}

/* Talk / Stop buttons */
.th-buttons {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 5;
}

.th-btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 10px 22px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.th-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.th-btn-talk {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.45);
}

.th-btn-talk:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(124, 58, 237, 0.6);
}

.th-btn-stop {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.th-btn-stop:hover {
  background: rgba(239, 68, 68, 0.28);
}

/* "Satisfied" — leaves the pitch, back to landing (green) */
.th-btn-satisfied {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
  box-shadow: 0 4px 18px rgba(34, 197, 94, 0.45);
}

.th-btn-satisfied:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(34, 197, 94, 0.6);
}

/* "Ask" — starts the live avatar conversation (purple, primary) */
.th-btn-ask {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.45);
}

.th-btn-ask:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(124, 58, 237, 0.6);
}

/* Mobile: keep buttons usable */
@media (max-width: 640px) {
  .th-pill { top: 6px; right: 6px; font-size: 0.7rem; padding: 4px 10px; }
  .th-btn { font-size: 0.8rem; padding: 8px 16px; }
}

/* ---- Live subtitle (spoken text below the avatar) ---- */
.th-caption {
  margin-top: 14px;
  min-height: 3.2em;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: rgba(10, 10, 18, 0.72);
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: 14px;
  padding: 12px 16px;
  backdrop-filter: blur(8px);
  transition: opacity 0.25s ease;
}

.th-caption.hidden {
  opacity: 0;
}

.th-caption-text {
  color: #f1f1f6;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.01em;
}

.th-caption-text .th-caption-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 8px;
  border-radius: 50%;
  background: #7c3aed;
  vertical-align: middle;
  animation: th-pulse 0.8s infinite;
}

@media (max-width: 640px) {
  .th-caption { padding: 10px 12px; }
  .th-caption-text { font-size: 0.9rem; }
}
