/* ============================================================================
   DOMUS-IA - Realtime Voice Call UI Styles
   ============================================================================ */

/* Call button in chat header */
.realtime-call-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
}

.realtime-call-btn.idle {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}
.realtime-call-btn.idle:hover {
  background: rgba(34, 197, 94, 0.35);
  transform: scale(1.05);
}

.realtime-call-btn.connecting {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  pointer-events: none;
}

.realtime-call-btn.active {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  animation: callPulse 2s infinite;
}
.realtime-call-btn.active:hover {
  background: rgba(239, 68, 68, 0.4);
}

.realtime-call-btn.no-access {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.4);
  cursor: not-allowed;
}

/* Locked icon for no-access */
.realtime-call-btn.no-access .call-icon::after {
  content: '\f023'; /* fa-lock */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 8px;
  position: absolute;
  bottom: -2px;
  right: -2px;
  color: #fbbf24;
}

.call-icon {
  position: relative;
  font-size: 14px;
}

.call-label {
  display: none;
}
@media (min-width: 768px) {
  .call-label {
    display: inline;
  }
}

@keyframes callPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* ============================================================================
   Call overlay (fullscreen-ish overlay during call)
   ============================================================================ */
.realtime-call-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, 
    rgba(15, 15, 35, 0.97) 0%, 
    rgba(30, 27, 75, 0.97) 50%,
    rgba(15, 15, 35, 0.97) 100%);
  backdrop-filter: blur(20px);
  animation: overlayFadeIn 0.3s ease-out;
  border-radius: inherit;
  overflow: hidden;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.realtime-call-overlay.hidden {
  display: none !important;
}

/* Avatar container with pulsing rings */
.call-avatar-container {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
}

.call-avatar-container img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  position: relative;
  z-index: 2;
  border: 3px solid rgba(99, 102, 241, 0.5);
}

/* Voice activity ring */
.call-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.3);
  z-index: 1;
}

.call-ring.pulse {
  animation: ringPulse 1.5s ease-out infinite;
}

.call-ring.pulse-2 {
  animation: ringPulse 1.5s ease-out infinite 0.5s;
  inset: -16px;
}

.call-ring.pulse-3 {
  animation: ringPulse 1.5s ease-out infinite 1s;
  inset: -24px;
}

@keyframes ringPulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
    border-color: rgba(99, 102, 241, 0.5);
  }
  100% {
    transform: scale(1.3);
    opacity: 0;
    border-color: rgba(99, 102, 241, 0);
  }
}

/* User speaking: green rings */
.call-overlay-state-user-speaking .call-ring.pulse {
  border-color: rgba(34, 197, 94, 0.5);
}
.call-overlay-state-user-speaking .call-ring.pulse-2 {
  border-color: rgba(34, 197, 94, 0.3);
}

/* Sofia speaking: indigo/purple rings with faster animation */
.call-overlay-state-sofia-speaking .call-ring.pulse {
  border-color: rgba(139, 92, 246, 0.6);
  animation-duration: 1s;
}
.call-overlay-state-sofia-speaking .call-ring.pulse-2 {
  border-color: rgba(139, 92, 246, 0.4);
  animation-duration: 1s;
}
.call-overlay-state-sofia-speaking .call-ring.pulse-3 {
  border-color: rgba(139, 92, 246, 0.2);
  animation-duration: 1s;
}

/* Status text */
.call-status {
  text-align: center;
  margin-bottom: 32px;
}

.call-status-name {
  font-size: 24px;
  font-weight: 700;
  color: white;
  margin-bottom: 4px;
}

.call-status-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  min-height: 20px;
}

.call-status-text.connecting {
  color: #fbbf24;
}
.call-status-text.active {
  color: #4ade80;
}
.call-status-text.speaking {
  color: #a78bfa;
}

/* Transcript area */
.call-transcript {
  width: 100%;
  max-width: 400px;
  max-height: 140px;
  overflow-y: auto;
  padding: 0 20px;
  margin-bottom: 32px;
  scrollbar-width: none;
}
.call-transcript::-webkit-scrollbar {
  display: none;
}

.call-transcript-line {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 6px;
  animation: transcriptFade 0.3s ease-out;
  max-width: 85%;
}

.call-transcript-line.user {
  background: rgba(99, 102, 241, 0.15);
  color: rgba(255, 255, 255, 0.8);
  margin-left: auto;
  text-align: right;
}

.call-transcript-line.assistant {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}

@keyframes transcriptFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Call controls */
.call-controls {
  display: flex;
  gap: 20px;
  align-items: center;
}

.call-control-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.2s ease;
}

.call-control-btn:hover {
  transform: scale(1.1);
}

.call-control-btn:active {
  transform: scale(0.95);
}

/* Mute button */
.call-control-btn.mute {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}
.call-control-btn.mute.muted {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

/* End call button */
.call-control-btn.end-call {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  font-size: 24px;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}
.call-control-btn.end-call:hover {
  box-shadow: 0 4px 30px rgba(239, 68, 68, 0.6);
}

/* Timer */
.call-timer {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  font-variant-numeric: tabular-nums;
  margin-top: 16px;
  font-family: 'Inter', monospace;
}

/* Premium upgrade prompt */
.realtime-upgrade-prompt {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 35, 0.95);
  backdrop-filter: blur(20px);
  padding: 32px;
  text-align: center;
  animation: overlayFadeIn 0.3s ease-out;
}

.realtime-upgrade-prompt.hidden {
  display: none !important;
}

.realtime-upgrade-prompt h3 {
  color: white;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.realtime-upgrade-prompt p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.realtime-upgrade-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #ec4899);
  color: white;
  padding: 12px 32px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}
.realtime-upgrade-btn:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.realtime-dismiss-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
  cursor: pointer;
  margin-top: 12px;
  padding: 8px;
}
.realtime-dismiss-btn:hover {
  color: rgba(255, 255, 255, 0.7);
}
