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

/* Generic utility — JS show()/hide() depend on this */
.hidden {
  display: none !important;
}

/* Layout-preserving image hide: keeps .hero-image height so the
   absolutely-positioned videos keep their frame. */
.th-img-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* 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).
   Absolutely positioned so it overlays the static image (which
   stays in the DOM to keep the container height). */
#th-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: 320px;
  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;
  z-index: 3;
  display: block; /* visibility controlled by .hidden */
}
@media (max-width: 768px) {
  #th-video { max-height: 250px; }
}

/* Presentation video — plays over the static image during the intro.
   The static image stays in the DOM to maintain the container height
   so the button bar (positioned at the container bottom) sits right
   under the video frame. */
#th-presentation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: 320px;
  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;
  z-index: 2;
  display: block; /* visibility controlled by .hidden */
}
@media (max-width: 768px) {
  #th-presentation { 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: 10;
  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 / Satisfy / Ask buttons.
   Positioned at the bottom of the hero-image container so they sit
   directly under the presentation video / avatar frame. */
.th-buttons {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
}

.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-satisfy {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
  box-shadow: 0 4px 18px rgba(34, 197, 94, 0.4);
}

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

.th-btn-ask {
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  color: #fff;
  box-shadow: 0 4px 18px rgba(14, 165, 233, 0.4);
}

.th-btn-ask:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(14, 165, 233, 0.55);
}

.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);
}

/* 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; }
}