/* style.css */

/* Variables CSS pour le thème sombre */
:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --text-primary: #e6e6e6;
  --text-secondary: #a9a9a9;
  --accent-color: #4cc9f0;
  --error-color: #f72585;
  --success-color: #4cc9f0;
  --button-bg: #4361ee;
  --button-hover: #3a56d4;
  --listening-color: #f72585;
  --listening-pulse: #ff0000;
}

/* Réinitialisation et base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-x: hidden;
}

/* En-tête avec le sens de traduction */
.header {
  text-align: center;
  margin-bottom: 30px;
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--accent-color);
}

/* Bouton Parler centré */
#talkButton {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background-color: var(--button-bg);
  border: none;
  color: white;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  margin: 0 auto 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: background-color 0.3s ease;
}

/* Animation de pulsation pendant l'écoute */
#talkButton.listening {
  background-color: var(--listening-color);
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Zones de texte */
.text-area {
  background-color: var(--bg-secondary);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  font-size: 1.2rem;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--accent-color);
}

#spokenText {
  color: var(--text-primary);
}

#translatedText {
  color: var(--accent-color);
  font-weight: bold;
}

/* Boutons secondaires */
.button-group {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  background-color: var(--button-bg);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn:hover {
  background-color: var(--button-hover);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  border: 1px solid var(--accent-color);
}

/* Historique */
.history-container {
  margin-top: auto;
  max-height: 200px;
  overflow-y: auto;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.history-title {
  text-align: center;
  margin-bottom: 10px;
  font-size: 1.1rem;
  color: var(--accent-color);
}

.history-list {
  list-style-type: none;
}

.history-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--bg-secondary);
  font-size: 0.9rem;
}

.history-item:last-child {
  border-bottom: none;
}

/* Zone d'erreur */
.error-message {
  background-color: rgba(247, 37, 133, 0.2);
  color: var(--error-color);
  padding: 15px;
  border-radius: 8px;
  margin-top: 20px;
  text-align: center;
  font-size: 1rem;
  display: none;
}

/* Media query pour petits écrans */
@media (max-width: 480px) {
  body {
    padding: 15px;
  }

  .header {
    font-size: 1.2rem;
  }

  #talkButton {
    width: 100px;
    height: 100px;
    font-size: 1rem;
  }

  .text-area {
    font-size: 1rem;
    min-height: 60px;
  }

  .button-group {
    gap: 10px;
  }

  .btn {
    padding: 10px 15px;
    font-size: 0.9rem;
  }
}

/* Choix des langues */
.lang-bar {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lang-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.lang-label {
  font-size: 0.8rem;
  font-weight: normal;
  color: var(--text-secondary);
}

.lang-select {
  min-width: 150px;
  padding: 12px 14px;
  font-size: 1.05rem;
  font-family: inherit;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--accent-color);
  border-radius: 8px;
}

.lang-arrow {
  padding-bottom: 10px;
  font-size: 1.4rem;
}

@media (max-width: 480px) {
  .lang-select {
    min-width: 130px;
    font-size: 1rem;
  }
}
