/*
File: styles.css
Path: /var/www/speechDemo/frontend/assets/css/
Created: February 25, 2025 17:35:00
*/

:root {
  --primary-color: #3367d6;
  --primary-hover: #2850a7;
  --secondary-color: #34a853;
  --danger-color: #ea4335;
  --danger-hover: #d32f2f;
  --background: #f9f9f9;
  --text-color: #333333;
  --border-color: #dddddd;
  --light-background: #f1f1f1;
  --system-message: #f0f4ff;
  --user-message: #e7f5e7;
  --ai-message: #f0f4ff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: #f5f5f5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background-color: var(--primary-color);
  color: white;
  padding: 1.5rem 2rem;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-top: 0.3rem;
}

main {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

h1,
h2,
h3 {
  color: var(--text-color);
  margin-bottom: 1rem;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.container {
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
}

.info-box {
  background-color: #e8f0fe;
  border-left: 4px solid var(--primary-color);
}

.btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  margin-right: 0.5rem;
}

.btn:hover {
  background-color: var(--primary-hover);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
  transform: none;
}

.btn-stop {
  background-color: var(--danger-color);
}

.btn-stop:hover {
  background-color: var(--danger-hover);
}

.controls-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.speech-controls {
  display: flex;
}

.ai-provider-toggle {
  display: flex;
  align-items: center;
}

.provider-label {
  margin: 0 0.5rem;
  font-weight: 500;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
}

input:checked + .slider {
  background-color: #2196f3;
}

input:focus + .slider {
  box-shadow: 0 0 1px #2196f3;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.status {
  margin: 1rem 0;
  padding: 0.75rem;
  border-radius: 4px;
  font-weight: 500;
}

.status-inactive {
  background-color: var(--light-background);
  color: #666;
}

.status-active {
  background-color: #e6f4ea;
  color: var(--secondary-color);
}

.status-error {
  background-color: #fce8e6;
  color: var(--danger-color);
}

.volume-meter {
  height: 24px;
  background-color: var(--light-background);
  border-radius: 12px;
  margin: 1rem 0;
  overflow: hidden;
}

.volume-level {
  height: 100%;
  width: 0%;
  background-color: var(--primary-color);
  border-radius: 12px;
  transition: width 0.1s ease;
}

/* Conversation Styling */
.conversation-container {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 1.5rem;
  background-color: #fafafa;
  padding: 1rem;
}

.conversation {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  padding: 1rem;
  border-radius: 8px;
  max-width: 85%;
  position: relative;
  line-height: 1.5;
}

.system-message {
  background-color: var(--system-message);
  padding: 1rem;
  border-radius: 8px;
  align-self: center;
  text-align: center;
  width: 100%;
  margin-bottom: 1rem;
}

.user-message {
  background-color: var(--user-message);
  align-self: flex-end;
  border-bottom-right-radius: 0;
}

.ai-message {
  background-color: var(--ai-message);
  align-self: flex-start;
  border-bottom-left-radius: 0;
}

.message-time {
  font-size: 0.75rem;
  color: #666;
  margin-top: 0.5rem;
  text-align: right;
}

.thinking-indicator {
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.hidden {
  display: none;
}

/* Typing animation */
.dot-pulse {
  position: relative;
  left: -9999px;
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background-color: var(--primary-color);
  color: var(--primary-color);
  box-shadow: 9999px 0 0 -5px;
  animation: dot-pulse 1.5s infinite linear;
  animation-delay: 0.25s;
}

.dot-pulse::before,
.dot-pulse::after {
  content: "";
  display: inline-block;
  position: absolute;
  top: 0;
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background-color: var(--primary-color);
  color: var(--primary-color);
}

.dot-pulse::before {
  box-shadow: 9984px 0 0 -5px;
  animation: dot-pulse-before 1.5s infinite linear;
  animation-delay: 0s;
}

.dot-pulse::after {
  box-shadow: 10014px 0 0 -5px;
  animation: dot-pulse-after 1.5s infinite linear;
  animation-delay: 0.5s;
}

@keyframes dot-pulse-before {
  0% {
    box-shadow: 9984px 0 0 -5px;
  }
  30% {
    box-shadow: 9984px 0 0 2px;
  }
  60%,
  100% {
    box-shadow: 9984px 0 0 -5px;
  }
}

@keyframes dot-pulse {
  0% {
    box-shadow: 9999px 0 0 -5px;
  }
  30% {
    box-shadow: 9999px 0 0 2px;
  }
  60%,
  100% {
    box-shadow: 9999px 0 0 -5px;
  }
}

@keyframes dot-pulse-after {
  0% {
    box-shadow: 10014px 0 0 -5px;
  }
  30% {
    box-shadow: 10014px 0 0 2px;
  }
  60%,
  100% {
    box-shadow: 10014px 0 0 -5px;
  }
}

.speech-feedback {
  margin-top: 1.5rem;
}

.transcript-container {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1rem;
  min-height: 60px;
  background-color: white;
}

.interim {
  color: #666;
  font-style: italic;
}

.final {
  color: #000;
  font-weight: normal;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
}

.metric-card {
  background-color: white;
  border-radius: 4px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  text-align: center;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  margin: 0.5rem 0;
}

.browser-support {
  margin-top: 0.5rem;
  padding: 1rem;
  border-radius: 4px;
  font-weight: 500;
}

.support-yes {
  background-color: #e6f4ea;
  color: var(--secondary-color);
}

.support-no {
  background-color: #fce8e6;
  color: var(--danger-color);
}

.commands-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.command-item {
  padding: 0.75rem;
  background-color: #f8f9fa;
  border-radius: 4px;
  border-left: 3px solid var(--primary-color);
}

.command-phrase {
  display: block;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.command-action {
  font-size: 0.9rem;
  color: #666;
}

footer {
  background-color: #333;
  color: white;
  text-align: center;
  padding: 1.5rem;
  margin-top: 2rem;
}

.version {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .controls-container {
    flex-direction: column;
    gap: 1rem;
  }

  .speech-controls {
    width: 100%;
  }

  .btn {
    flex: 1;
  }

  .metrics,
  .commands-list {
    grid-template-columns: 1fr;
  }
}

.status-speaking {
  background-color: #e67e22;
  color: white;
}
.btn-interrupt {
  background-color: #e67e22; /* Orange color */
}

.btn-interrupt:hover {
  background-color: #d35400;
}

.btn-interrupt:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

/* Enhanced thinking indicator */
.thinking-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  transition: all 0.3s ease;
}

/* Pulse animation container */
.pulse-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Individual pulse element */
.pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--primary-color);
  margin: 0 6px;
  transform: scale(0.8);
  animation: pulse 1.5s infinite ease-in-out;
}

/* Stagger the animations */
.pulse:nth-child(1) {
  animation-delay: 0s;
}
.pulse:nth-child(2) {
  animation-delay: 0.3s;
}
.pulse:nth-child(3) {
  animation-delay: 0.6s;
}

/* Pulse animation */
@keyframes pulse {
  0%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Add a subtle glow effect to the entire thinking indicator */
.thinking-indicator:not(.hidden) {
  background-color: rgba(var(--primary-color-rgb), 0.05);
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(var(--primary-color-rgb), 0.1);
}

/* Add this to your :root in styles.css */
:root {
  /* ... existing variables ... */
  --primary-color-rgb: 51, 103, 214; /* RGB values for primary color */
}

/* Improved logout button */
#logoutBtn {
  background-color: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 10px;
}

#logoutBtn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: white;
}

/* Center the content within user info */
.user-info {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.user-info-content {
  display: flex;
  align-items: center;
  font-size: 0.95rem;
}

.username-display {
  font-weight: 500;
}

/* Settings icon button */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  margin: 0 10px;
  color: white;
  opacity: 0.9;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  opacity: 1;
  transform: rotate(15deg);
}

.settings-icon {
  width: 20px;
  height: 20px;
}

.settings-group {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.settings-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.settings-group input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
}

.setting-description {
  color: #666;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.radio-options {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.radio-option {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.radio-label {
  margin-left: 0.5rem;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

/* Voice selection styling */
.voice-options {
  margin-top: 1rem;
}

.voice-option-content {
  display: flex;
  align-items: center;
}

.voice-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  margin-right: 0.5rem;
}

.alice {
  background-color: #e91e63;
}

.andy {
  background-color: #2196f3;
}

.settings-status {
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 4px;
}

.settings-status.success {
  background-color: #e6f4ea;
  color: var(--secondary-color);
  border: 1px solid #ceead6;
}

.settings-status.error {
  background-color: #fce8e6;
  color: var(--danger-color);
  border: 1px solid #fad2cf;
}

.hidden {
  display: none;
}
.voice-selection {
  margin-top: 1rem;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 4px;
  border-left: 3px solid var(--primary-color);
}

.select-container {
  margin: 0.5rem 0;
}

.select-container select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
}

.btn-small {
  padding: 0.3rem 0.8rem;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}
