/**
 * ARGUS Live Closed Captions HUD
 * Universal real-time speech subtitle display for English voice prompts.
 */

.argus-captions-hud {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 2147483647; /* Highest layer, above modals & backdrops */
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
  max-width: min(840px, calc(100vw - 32px));
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(59, 130, 246, 0.45);
  border-radius: 9999px;
  box-shadow: 0 12px 35px -5px rgba(0, 0, 0, 0.55),
              0 0 20px rgba(37, 99, 235, 0.25);
  color: #f8fafc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.22s linear;
  box-sizing: border-box;
}

.argus-captions-hud.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* CC Badge */
.argus-captions-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 7px;
  border-radius: 6px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
  flex-shrink: 0;
  user-select: none;
}

/* Pulsing Audio Equalizer Waveform */
.argus-captions-equalizer {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 16px;
  width: 14px;
  flex-shrink: 0;
}

.argus-captions-equalizer span {
  width: 3px;
  height: 4px;
  background-color: #60a5fa;
  border-radius: 2px;
  transition: height 0.15s ease;
}

.argus-captions-hud.speaking .argus-captions-equalizer span:nth-child(1) {
  animation: argusWave 0.85s ease-in-out infinite alternate;
}

.argus-captions-hud.speaking .argus-captions-equalizer span:nth-child(2) {
  animation: argusWave 0.65s ease-in-out infinite 0.18s alternate;
}

.argus-captions-hud.speaking .argus-captions-equalizer span:nth-child(3) {
  animation: argusWave 0.95s ease-in-out infinite 0.32s alternate;
}

@keyframes argusWave {
  0% { height: 4px; opacity: 0.6; }
  100% { height: 16px; opacity: 1; }
}

/* Caption Text Content */
.argus-captions-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: #f1f5f9;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* Dismiss Close Button */
.argus-captions-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  outline: none;
  border-radius: 50%;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.argus-captions-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* Responsive adjustment for compact screens */
@media (max-width: 640px) {
  .argus-captions-hud {
    bottom: 16px;
    padding: 8px 12px;
    gap: 8px;
    border-radius: 16px;
  }
  .argus-captions-text {
    font-size: 13px;
  }
}
