/* /var/www/adbhutbharat.net/css/voice-ui.css */

/* Voice System Styles */
:root {
  --voice-primary: #667eea;
  --voice-secondary: #764ba2;
  --voice-success: #4caf50;
  --voice-error: #f44336;
  --voice-warning: #ff9800;
  --voice-info: #2196f3;
  --voice-bg: #ffffff;
  --voice-text: #333333;
  --voice-border: #e0e0e0;
  --voice-shadow: rgba(0, 0, 0, 0.1);
}

/* Voice System Container */
.voice-system-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 10000;
  animation: slideInUp 0.3s ease-out;
}

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

/* Main Voice Button */
.voice-system-button {
  background: linear-gradient(135deg, var(--voice-primary) 0%, var(--voice-secondary) 100%);
  color: white;
  border: none;
  border-radius: 30px;
  padding: 15px 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 25px var(--voice-shadow);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.voice-system-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.voice-system-button:active {
  transform: translateY(-1px);
}

.voice-system-button.active {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { 
    box-shadow: 0 10px 25px var(--voice-shadow),
                0 0 0 0 rgba(245, 87, 108, 0.4); 
  }
  50% { 
    box-shadow: 0 10px 35px rgba(245, 87, 108, 0.3),
                0 0 0 20px rgba(245, 87, 108, 0); 
  }
}

/* Voice Icon Wrapper */
.voice-icon-wrapper {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-icon {
  fill: currentColor;
  position: relative;
  z-index: 2;
  width: 24px;
  height: 24px;
}

/* Voice Waves Animation */
.voice-waves {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.3s;
}

.voice-system-button.active .voice-waves {
  opacity: 1;
}

.voice-waves .wave {
  width: 3px;
  height: 20px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 3px;
  transform: scaleY(0.3);
  transition: transform 0.3s;
}

.voice-waves .wave.active {
  animation: waveAnimation 0.8s ease-in-out infinite;
}

.voice-waves .wave:nth-child(1).active { animation-delay: 0s; }
.voice-waves .wave:nth-child(2).active { animation-delay: 0.1s; }
.voice-waves .wave:nth-child(3).active { animation-delay: 0.2s; }
.voice-waves .wave:nth-child(4).active { animation-delay: 0.3s; }
.voice-waves .wave:nth-child(5).active { animation-delay: 0.4s; }

@keyframes waveAnimation {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

/* Input Voice Buttons */
.input-voice-button {
  background: linear-gradient(135deg, var(--voice-primary) 0%, var(--voice-secondary) 100%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px var(--voice-shadow);
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.input-voice-button:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.input-voice-button:active {
  transform: translateY(-50%) scale(0.95);
}

.input-voice-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Voice Active State */
input.voice-active,
textarea.voice-active {
  border-color: var(--voice-primary) !important;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
  background: linear-gradient(to right, transparent 0%, rgba(102, 126, 234, 0.05) 100%);
}

/* Transcript Display */
.voice-transcript-display {
  position: fixed;
  bottom: 150px;
  right: 20px;
  width: 350px;
  max-height: 400px;
  background: var(--voice-bg);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  animation: fadeIn 0.3s ease-out;
}

.voice-transcript-display.show {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.transcript-header {
  padding: 15px 20px;
  background: linear-gradient(135deg, var(--voice-primary) 0%, var(--voice-secondary) 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.transcript-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.3s;
}

.transcript-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.transcript-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
  scrollbar-width: thin;
  scrollbar-color: #ccc #f8f9fa;
}

.transcript-content::-webkit-scrollbar {
  width: 6px;
}

.transcript-content::-webkit-scrollbar-track {
  background: #f8f9fa;
}

.transcript-content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.transcript-message {
  margin-bottom: 15px;
  padding: 10px 15px;
  border-radius: 8px;
  animation: fadeInUp 0.3s ease;
}

.transcript-message.user {
  background: #e3f2fd;
  margin-left: 20px;
  border-bottom-right-radius: 4px;
}

.transcript-message.assistant {
  background: white;
  margin-right: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border-bottom-left-radius: 4px;
}

.transcript-message .speaker {
  font-weight: 600;
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  text-transform: uppercase;
  opacity: 0.7;
}

.transcript-message .text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--voice-text);
}

.transcript-interim {
  padding: 10px 20px;
  background: white;
  border-top: 1px solid var(--voice-border);
  font-style: italic;
  color: #666;
  min-height: 40px;
  display: flex;
  align-items: center;
  font-size: 14px;
}

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

/* Status Indicator */
.voice-status-indicator {
  position: fixed;
  top: 80px;
  right: 20px;
  background: white;
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: 0 2px 10px var(--voice-shadow);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9998;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  transition: all 0.3s;
}

.status-dot.ready { 
  background: var(--voice-success); 
}

.status-dot.listening { 
  background: var(--voice-info); 
  animation: pulse-dot 1s infinite;
}

.status-dot.speaking { 
  background: var(--voice-warning); 
  animation: pulse-dot 0.8s infinite;
}

.status-dot.processing { 
  background: var(--voice-secondary); 
}

.status-dot.error { 
  background: var(--voice-error); 
}

.status-dot.inactive { 
  background: #ccc; 
}

@keyframes pulse-dot {
  0%, 100% { 
    transform: scale(1); 
    opacity: 1; 
  }
  50% { 
    transform: scale(1.5); 
    opacity: 0.7; 
  }
}

/* Waveform Canvas */
.voice-waveform-canvas {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.05);
}

.voice-system-button.active .voice-waveform-canvas {
  opacity: 0.3;
}

/* Voice Settings Panel */
.voice-settings-panel {
  position: fixed;
  bottom: 140px;
  right: 380px;
  width: 300px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 20px var(--voice-shadow);
  padding: 20px;
  display: none;
  z-index: 9997;
}

.voice-settings-panel.show {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

.voice-settings-title {
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--voice-text);
}

.voice-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.voice-setting-label {
  font-size: 14px;
  color: var(--voice-text);
}

.voice-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: #ccc;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.3s;
}

.voice-toggle.active {
  background: var(--voice-success);
}

.voice-toggle::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.voice-toggle.active::after {
  transform: translateX(20px);
}

/* Loading Animation */
.voice-loading {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.voice-loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--voice-primary);
  animation: loading-bounce 1.4s ease-in-out infinite;
}

.voice-loading-dot:nth-child(1) { animation-delay: -0.32s; }
.voice-loading-dot:nth-child(2) { animation-delay: -0.16s; }
.voice-loading-dot:nth-child(3) { animation-delay: 0; }

@keyframes loading-bounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .voice-system-container {
    bottom: 70px;
    right: 15px;
  }

  .voice-system-button {
    padding: 12px 20px;
    font-size: 14px;
  }

  .voice-system-button .voice-button-text {
    display: none;
  }

  .voice-transcript-display {
    width: calc(100vw - 30px);
    max-width: 350px;
    bottom: 130px;
    right: 15px;
  }

  .voice-status-indicator {
    top: 70px;
    right: 15px;
    font-size: 12px;
    padding: 6px 12px;
  }

  .voice-settings-panel {
    right: 15px;
    width: calc(100vw - 30px);
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  .voice-transcript-display {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 120px;
  }

  .transcript-header {
    padding: 12px 16px;
  }

  .transcript-content {
    padding: 15px;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --voice-bg: #1e1e1e;
    --voice-text: #e0e0e0;
    --voice-border: #444;
    --voice-shadow: rgba(0, 0, 0, 0.3);
  }

  .voice-transcript-display {
    background: var(--voice-bg);
    color: var(--voice-text);
  }

  .transcript-content {
    background: #2a2a2a;
  }

  .transcript-message.assistant {
    background: #3a3a3a;
    color: var(--voice-text);
  }

  .transcript-message.user {
    background: #2c5282;
    color: white;
  }

  .transcript-interim {
    background: var(--voice-bg);
    border-top-color: var(--voice-border);
    color: #aaa;
  }

  .voice-status-indicator {
    background: #2a2a2a;
    color: var(--voice-text);
  }

  .voice-settings-panel {
    background: #2a2a2a;
    color: var(--voice-text);
  }
}

/* Hindi Mode Adjustments */
body.hindi-mode .voice-button-text,
body.hindi-mode .transcript-message,
body.hindi-mode .voice-settings-title,
body.hindi-mode .voice-setting-label {
  font-family: 'Noto Sans Devanagari', 'Mangal', sans-serif;
}

/* Accessibility */
.voice-system-button:focus,
.input-voice-button:focus,
.transcript-close:focus,
.voice-toggle:focus {
  outline: 2px solid #4a5568;
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .voice-system-container,
  .voice-transcript-display,
  .voice-status-indicator,
  .voice-settings-panel,
  .input-voice-button {
    display: none !important;
  }
}
