/* Reset básico */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
  display: flex;
  height: 100vh;
  background-color: #F5F5F7;
  color: #1C1C1E;
}

/* Panel izquierdo: lista de escenarios */
nav {
  width: 250px;
  background-color: #fff;
  border-right: 1px solid #D1D1D6;
  padding: 1rem;
  overflow-y: auto;
}

nav h2 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
  color: #1C1C1E;
}

.audio-caption {
  font-style: italic;
  font-size: 0.9em;
  color: #555;
}

/* Tarjeta de escenario */
.scenario-card {
  background: #fff;
  border: 1px solid #D1D1D6;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08); 
  overflow: hidden;
  margin-bottom: 1rem;
  transition: transform 0.2s;
}

.scenario-card:hover {
  transform: translateY(-2px);
}

.card-image img {
  width: 100%;
  display: block;
}

.card-content {
  padding: 1rem;
}

.card-content h3 {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
  color: #1C1C1E;
}

.card-content p {
  font-size: 0.9rem;
  color: #3A3A3C;
}

.card-footer {
  padding: 0.5rem 1rem 1rem;
  text-align: right;
}

.start-button {
  padding: 0.5rem 1rem;
  border: none;
  background-color: #30BFBF;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.start-button:hover {
  background-color: #28A0A0;
}

.scenario-item {
  display: block;
  border: none;
  background-color: #007AFF;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s;
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  text-align: left;
}

.scenario-item:hover {
  background-color: #e6e6e6;
}

/* Panel derecho: área de chat */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow: hidden;
}

/* Cabecera del chat */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: #30BFBF;
  color: #fff;
  font-weight: bold;
  border-radius: 8px;
  margin-bottom: 1rem;
}

/* Opcional: estilo para el título de la cabecera */
.header-title {
  font-size: 1.2rem;
}

/* Área de mensajes */
.chat-messages {
  flex: 1;
  padding: 1rem;
  background-color: #FFFFFF;
  border: 1px solid #D1D1D6;
  border-radius: 8px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.message {
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  border-radius: 6px;
}

/* Estilo para mensajes del Moderator: centrados y con fondo distintivo */
.message.moderator {
  background-color: #E5F1FF;
  text-align: center;
  align-self: center;
  color: #1C1C1E;
}

/* Estilo para mensajes que comienzan con [Patient] (opcional, ya que por defecto se alinean a la izquierda) */
.message.patient {
  text-align: right;
  align-self: flex-start;
}

.message.user {
  background-color: #E5F1FF;
  align-self: flex-end;
}

.message.model {
  background-color: #F0F0F5;
  align-self: flex-start;
}

/* Área de entrada (para ambos modos texto y voz) */
.chat-input-container {
  display: flex;
  gap: 0.5rem;
}

.chat-input-container input[type="text"] {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #D1D1D6;
  border-radius: 6px;
}

.chat-input-container button {
  padding: 0.5rem 1rem;
  border: none;
  background-color: #30BFBF;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.chat-input-container button:hover {
  background-color: #28A0A0;
}

/* Feedback visual */
.feedback-container {
  margin-top: 1rem;
  padding: 1rem;
  background-color: #fff;
  border: 1px solid #D1D1D6;
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: monospace;
}

/* Estilos para entrada de voz */
.voice-input-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.voice-button {
  background-color: #30BFBF;
  border: none;
  border-radius: 50%;
  width: 70px;
  height: 70px;
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

.voice-button img {
  width: 35px;
  height: auto;
}

.voice-button:hover {
  background-color: #28A0A0;
}

.live-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

/* Contenedor de la onda */
.live-indicator .wave {
  display: flex;
  gap: 0.2rem;
  align-items: flex-end;
  height: 20px; /* Altura máxima de la animación */
}

/* Barras de la onda */
.live-indicator .wave .bar {
  width: 4px;
  background-color: #30BFBF; /* Puedes usar el mismo color del botón, por ejemplo */
  animation: pulse 1s ease-in-out infinite;
  /* Inicialmente con una altura mínima para que se note la animación */
  height: 4px;
}

/* Ajustamos diferentes tiempos de animación a cada barra para dar efecto */
.live-indicator .wave .bar:nth-child(1) {
  animation-delay: 0s;
}
.live-indicator .wave .bar:nth-child(2) {
  animation-delay: 0.2s;
}
.live-indicator .wave .bar:nth-child(3) {
  animation-delay: 0.4s;
}
.live-indicator .wave .bar:nth-child(4) {
  animation-delay: 0.6s;
}
.live-indicator .wave .bar:nth-child(5) {
  animation-delay: 0.8s;
}

/* Definición de la animación */
@keyframes pulse {
  0%, 100% {
    height: 4px;
    opacity: 0.5;
  }
  50% {
    height: 20px;
    opacity: 1;
  }
}

/* Estilos para el switch de modo de entrada */
.input-mode-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Switch styling */
.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;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: #34C759;
}

.switch input:checked + .slider:before {
  transform: translateX(26px);
}

.small-switch {
  width: 40px;
  height: 24px;
}

.small-switch .slider {
  border-radius: 24px;
  transition: 0.4s;
  background-color: #D1D1D6;
}

.small-switch .slider:before {
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  border-radius: 50%;
  transition: 0.4s;
  background-color: #FFFFFF;
}

.small-switch input:checked + .slider {
  background-color: #34C759;
}

.small-switch input:checked + .slider:before {
  transform: translateX(16px);
  background-color: #FFFFFF;
}

.mode-label {
  font-size: 0.9rem;
  color: #fff;
}

/* Responsive: en pantallas pequeñas se organiza en columna */
@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  nav {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #D1D1D6;
  }
  .card-image img {
    display: none;
  }
  .voice-button {
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }
  .voice-button img {
    width: 32px;
  }
}
