/* SHA Voice Agent Widget */

/* ── Header button (desktop) ── */

#sha-voice-btn {
  padding: 12px 24px;
  border-radius: 4px;
  border: 1px solid;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: 400;
  background: none;
  text-transform: uppercase;
  font-family: inherit;
  color: #fff;
  border-color: #fff;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
  margin-left: 8px;
}

#sha-voice-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

#sha-voice-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

#sha-voice-btn.active {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
}

#sha-voice-btn.active:hover {
  background: #e74c3c;
  border-color: #e74c3c;
}

/* Scrolled / non-home header states */
.site-header-desktop.is-scrolled #sha-voice-btn,
body.no-home .site-header-desktop #sha-voice-btn,
body.off-canvas-open .site-header-desktop #sha-voice-btn,
body.lang-menu-open .site-header-desktop #sha-voice-btn {
  background-color: #2c2c2c;
  color: #ffffff;
  border-color: #2c2c2c;
}

.site-header-desktop.is-scrolled #sha-voice-btn:hover,
body.no-home .site-header-desktop #sha-voice-btn:hover,
body.off-canvas-open .site-header-desktop #sha-voice-btn:hover,
body.lang-menu-open .site-header-desktop #sha-voice-btn:hover {
  background-color: #555555;
  border-color: #555555;
  color: #ffffff;
}

.site-header-desktop.is-scrolled #sha-voice-btn.active,
body.no-home .site-header-desktop #sha-voice-btn.active,
body.off-canvas-open .site-header-desktop #sha-voice-btn.active,
body.lang-menu-open .site-header-desktop #sha-voice-btn.active {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
}

@media (max-width: 1200px) {
  #sha-voice-btn .sha-btn-label {
    display: none;
  }
  #sha-voice-btn {
    padding: 12px 14px;
  }
}

/* ── Mobile header button ── */

#sha-voice-btn-mobile {
  width: 24px;
  height: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  border: none;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 1;
  color: #fff;
  margin-right: 12px;
}

#sha-voice-btn-mobile svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

#sha-voice-btn-mobile.active svg {
  fill: #c0392b;
}

/* Match phone icon color states */
.site-header-desktop.is-scrolled #sha-voice-btn-mobile,
body.off-canvas-open .site-header-desktop #sha-voice-btn-mobile,
body.no-home .site-header-desktop #sha-voice-btn-mobile {
  color: #2c2c2c;
}

.site-header-desktop.is-scrolled #sha-voice-btn-mobile.active,
body.off-canvas-open .site-header-desktop #sha-voice-btn-mobile.active,
body.no-home .site-header-desktop #sha-voice-btn-mobile.active {
  color: #c0392b;
}

@media (max-width: 1023px) {
  #sha-voice-btn.solo-desktop {
    display: none !important;
  }
  #sha-voice-btn-mobile {
    display: flex !important;
  }
}

/* ── Orb Overlay ── */

#sha-orb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
}

#sha-orb-overlay.visible {
  display: flex;
}

#sha-orb-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

#sha-orb-status {
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.02em;
  opacity: 0.9;
}

#sha-orb-agent {
  width: 300px;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#sha-orb-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.85);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 10;
  text-align: center;
  white-space: nowrap;
}

#sha-orb-agent deepgram-agent {
  display: block;
}

/* Style the canvas inside the hoop */
#sha-orb-agent canvas {
  display: block;
}

#sha-orb-end {
  padding: 14px 40px;
  border-radius: 30px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(192, 57, 43, 0.8);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#sha-orb-end:hover {
  background: rgba(231, 76, 60, 0.9);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Pulse on header buttons while active */
@keyframes sha-pulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 6px rgba(192, 57, 43, 0.2); }
}

#sha-voice-btn.active,
#sha-voice-btn-mobile.active {
  animation: sha-pulse 2s ease-in-out infinite;
}

/* ── Transcription Console ── */

#sha-orb-inner.with-transcript {
  margin-right: 24px;
}

#sha-transcript {
  width: 360px;
  height: 300px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #fff;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

#sha-transcript::-webkit-scrollbar {
  width: 6px;
}

#sha-transcript::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.sha-transcript-entry {
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
}

.sha-transcript-entry:last-child {
  margin-bottom: 0;
}

.sha-transcript-role {
  font-weight: 600;
  flex-shrink: 0;
  min-width: 32px;
}

.sha-transcript-user .sha-transcript-role {
  color: #7ec8e3;
}

.sha-transcript-agent .sha-transcript-role {
  color: #a8e6cf;
}

.sha-transcript-text {
  opacity: 0.9;
}

@media (max-width: 768px) {
  #sha-orb-overlay.visible {
    flex-direction: column;
  }

  #sha-orb-inner.with-transcript {
    margin-right: 0;
  }

  #sha-transcript {
    width: calc(100vw - 48px);
    max-height: 200px;
    margin-top: 16px;
  }
}
