/* ============================================
   Eva Voice Widget - Professional voice assistant
   ============================================ */

/* Floating button - positioned well above WhatsApp */
.eva-voice-btn {
  position: fixed;
  bottom: 110px;
  right: 30px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #1B4D6E;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(27, 77, 110, 0.35);
  z-index: 9998;
  transition: transform 0.3s, box-shadow 0.3s;
}

.eva-voice-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(27, 77, 110, 0.5);
}

.eva-voice-btn i {
  color: #fff;
  font-size: 22px;
}

/* Tooltip */
.eva-voice-tooltip {
  position: absolute;
  right: 68px;
  top: 50%;
  transform: translateY(-50%);
  background: #1a1a2e;
  color: #fff;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.eva-voice-btn:hover .eva-voice-tooltip {
  opacity: 1;
}

.eva-voice-tooltip::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-left-color: #1a1a2e;
}

/* Panel */
.eva-voice-panel {
  position: fixed;
  bottom: 180px;
  right: 30px;
  width: 370px;
  max-height: 530px;
  background: #f8f9fa;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: eva-slide-up 0.25s ease-out;
  border: 1px solid #e2e8f0;
}

.eva-voice-panel.active {
  display: flex;
}

@keyframes eva-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Panel header - corporate dark blue */
.eva-voice-header {
  background: #1B4D6E;
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eva-voice-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eva-voice-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  object-fit: cover;
}

.eva-voice-header-text h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.eva-voice-header-text .eva-status {
  font-size: 11px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.eva-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.eva-status-dot.ready { background: #10b981; }
.eva-status-dot.listening { background: #10b981; animation: eva-dot-pulse 1.2s infinite; }
.eva-status-dot.thinking { background: #f59e0b; animation: eva-dot-pulse 0.6s infinite; }
.eva-status-dot.speaking { background: #60a5fa; animation: eva-dot-pulse 0.8s infinite; }

@keyframes eva-dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.eva-voice-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.2s;
  padding: 4px;
  line-height: 1;
}

.eva-voice-close:hover { color: #fff; }

/* Transcript area */
.eva-voice-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  min-height: 240px;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fff;
}

.eva-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
}

.eva-msg.eva {
  align-self: flex-start;
  background: #f1f5f9;
  color: #334155;
  border-bottom-left-radius: 3px;
}

.eva-msg.user {
  align-self: flex-end;
  background: #1B4D6E;
  color: #fff;
  border-bottom-right-radius: 3px;
}

.eva-msg.user.interim {
  opacity: 0.6;
  font-style: italic;
}

/* Audio visualizer */
.eva-voice-visualizer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 0;
  background: #fff;
}

.eva-voice-visualizer.hidden { display: none; }

.eva-viz-bar {
  width: 3px;
  height: 18px;
  background: #1B4D6E;
  border-radius: 2px;
  animation: eva-viz 0.8s ease-in-out infinite;
}

.eva-viz-bar:nth-child(1) { animation-delay: 0s; }
.eva-viz-bar:nth-child(2) { animation-delay: 0.1s; }
.eva-viz-bar:nth-child(3) { animation-delay: 0.2s; }
.eva-viz-bar:nth-child(4) { animation-delay: 0.3s; }
.eva-viz-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes eva-viz {
  0%, 100% { height: 6px; opacity: 0.4; }
  50% { height: 22px; opacity: 1; }
}

/* Controls */
.eva-voice-controls {
  padding: 10px 16px 12px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
}

.eva-mic-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.eva-mic-btn.active {
  background: #dc2626;
  color: #fff;
  animation: eva-mic-pulse 1.5s infinite;
}

.eva-mic-btn.inactive {
  background: #1B4D6E;
  color: #fff;
}

.eva-mic-btn:hover {
  transform: scale(1.05);
}

@keyframes eva-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.3); }
  50% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
}

.eva-voice-input-wrap {
  flex: 1;
  display: flex;
  gap: 8px;
}

.eva-voice-text-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

.eva-voice-text-input:focus {
  border-color: #1B4D6E;
}

.eva-voice-send-btn {
  background: #1B4D6E;
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.eva-voice-send-btn:hover {
  background: #153d58;
}

/* Footer */
.eva-voice-footer {
  padding: 6px 16px;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 10px;
  text-align: center;
  border-top: 1px solid #e2e8f0;
}

/* Unsupported browser message */
.eva-voice-unsupported {
  padding: 8px 16px;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  text-align: center;
  display: none;
}

/* Responsive */
@media (max-width: 480px) {
  .eva-voice-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 75vh;
    border-radius: 12px 12px 0 0;
  }

  .eva-voice-transcript {
    min-height: 120px;
    max-height: 40vh;
  }

  .eva-voice-btn {
    bottom: 90px;
    right: 20px;
    width: 52px;
    height: 52px;
  }

  .eva-voice-btn i {
    font-size: 20px;
  }

  .eva-voice-tooltip {
    display: none;
  }
}
