/* Base styles */
body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
  background: linear-gradient(45deg, #000000, #0a0a23, #000033);
  background-size: 400%;
  animation: gradientShift 15s ease infinite;
  cursor: default;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Neural network background */
.neural-network {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.neuron {
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(0, 128, 255, 0.6);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0, 128, 255, 0.8);
  animation: neuronPulse 3s ease-in-out infinite;
}

.neuron::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(0, 128, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: neuronRing 4s ease-in-out infinite;
}

@keyframes neuronPulse {
  0%,
  100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

@keyframes neuronRing {
  0%,
  100% {
    opacity: 0.3;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1.5);
  }
}

.connection {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 128, 255, 0.4), transparent);
  transform-origin: left center;
  animation: connectionPulse 5s ease-in-out infinite;
}

@keyframes connectionPulse {
  0%,
  100% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.6;
  }
}

/* Content containers */
.content-container {
  position: relative;
  z-index: 1;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 128, 255, 0.2);
  box-shadow: 0 0 20px rgba(0, 128, 255, 0.2);
  border-radius: 16px;
  padding: 2rem;
  overflow: hidden;
}

.content-container:hover {
  transform: translateY(-5px);
  box-shadow: 0 0 30px rgba(0, 128, 255, 0.3);
}

.content-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #0080ff, transparent);
}

@keyframes neonPulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(45deg, #0055ff, #0099ff);
  color: white;
  border: none;
  box-shadow: 0 0 15px rgba(0, 128, 255, 0.5);
}

.btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(0, 128, 255, 0.7);
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 128, 255, 0.3);
  color: rgba(255, 255, 255, 0.7);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(0, 128, 255, 0.2);
  color: #fff;
  box-shadow: 0 0 15px rgba(0, 128, 255, 0.5);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Typography */
h1,
h2,
h3 {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(0, 128, 255, 0.5);
}

p,
span,
div {
  color: #ffffff;
}

.text-center {
  text-align: center;
}

/* Recording animation */
.recording {
  animation: recordingPulse 1.5s ease-in-out infinite;
}

@keyframes recordingPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 15px rgba(0, 128, 255, 0.5);
    background: linear-gradient(45deg, #0055ff, #0099ff);
  }
  25% {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(0, 128, 255, 0.8);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 35px rgba(0, 128, 255, 1);
    background: linear-gradient(45deg, #0099ff, #0055ff);
  }
  75% {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(0, 128, 255, 0.8);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 15px rgba(0, 128, 255, 0.5);
    background: linear-gradient(45deg, #0055ff, #0099ff);
  }
}

/* Prediction display */
.prediction-display {
  background: linear-gradient(45deg, #0055ff, #0099ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 3rem;
  font-weight: bold;
  text-align: center;
  text-shadow: 0 0 20px rgba(0, 128, 255, 0.8);
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    filter: drop-shadow(0 0 10px rgba(0, 128, 255, 0.5));
  }
  to {
    filter: drop-shadow(0 0 20px rgba(0, 128, 255, 0.8));
  }
}

.prediction-container {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(0, 128, 255, 0.3);
  border-radius: 16px;
  padding: 2rem;
  margin: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.digit-display {
  font-size: 7rem;
  font-weight: bold;
  color: #0099ff;
  text-shadow: 0 0 20px rgba(0, 128, 255, 0.8);
  margin: 0.5rem 0;
}

.word-display {
  font-size: 1.5rem;
  color: #0055ff;
  text-shadow: 0 0 10px rgba(0, 128, 255, 0.6);
  margin-bottom: 0.5rem;
}

/* Probability items */
.probability-item {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 128, 255, 0.1);
  border-radius: 8px;
  padding: 0.5rem;
  margin: 0.25rem 0;
  display: flex;
  flex-direction: column;
  transition: background 0.2s ease;
}

.probability-item:hover {
  background: rgba(0, 0, 0, 0.5);
}

.probability-bar {
  height: 4px;
  background: linear-gradient(90deg, #0055ff, #0099ff);
  border-radius: 2px;
  margin-top: 0.25rem;
  transition: width 0.5s ease;
}

.top-prediction {
  border: 2px solid rgba(0, 128, 255, 0.5);
  background: rgba(0, 0, 0, 0.6);
}

.probability-container {
  width: 100%;          /* Prend toute la largeur disponible */
  min-width: 600px;     /* Largeur minimale augmentée */
  max-width: 100%;      /* S'adapte au conteneur parent */
  max-height: 500px;    /* Conserve la hauteur maximale */
  overflow-x: auto;     /* Défilement horizontal si nécessaire */
  overflow-y: auto;     /* Défilement vertical conservé */
  padding: 15px;        /* Espacement interne */
  box-sizing: border-box; /* Inclut le padding dans la largeur */
  display: flex;        /* Optionnel : pour un meilleur contrôle */
  flex-direction: column; /* Organisation verticale */
}

.probability-container::-webkit-scrollbar {
  width: 6px;
}

.probability-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.probability-container::-webkit-scrollbar-thumb {
  background: rgba(0, 128, 255, 0.5);
  border-radius: 3px;
}

/* Home page specific */
.hero-title {
  font-size: 3.5rem;
  background: linear-gradient(45deg, #0055ff, #0099ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(0, 128, 255, 0.5);
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.5rem;
  color: #ffffff;
  margin-bottom: 2rem;
}

.feature-card {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  flex: 1;
  min-width: 250px;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0 20px rgba(0, 128, 255, 0.3);
}

.feature-icon {
  font-size: 2rem;
  color: #0080ff;
  margin-bottom: 1rem;
}

.feature-title {
  font-size: 1.25rem;
  color: white;
  margin-bottom: 0.5rem;
}

.feature-description {
  font-size: 0.9rem;
  color: #ffffff;
}

/* Layout utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.space-y-4 > * + * {
  margin-top: 1rem;
}

.space-x-4 > * + * {
  margin-left: 1rem;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-4 {
  gap: 1rem;
}

.w-full {
  width: 100%;
}

.max-w-md {
  max-width: 28rem;
}

.max-w-sm {
  max-width: 32rem;
}

.max-w-xs {
  max-width: 20rem;
}

.max-w-lg {
  max-width: 48rem;
}

.max-w-xl {
  max-width: 56rem;
}

.max-w-2xl {
  max-width: 64rem;
}

.hidden {
  display: none;
}

.mt-4 {
  margin-top: 1rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.my-8 {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

/* Status message */
#statusMessage {
  color: #ffffff;
  text-shadow: 0 0 5px rgba(0, 128, 255, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1.2rem;
  }

  .feature-card {
    min-width: 100%;
  }
}

.recording #micIcon {
  animation: micRotate 2s linear infinite;
}

@keyframes micRotate {
  0% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(5deg) scale(1.1);
  }
  50% {
    transform: rotate(0deg) scale(1.2);
  }
  75% {
    transform: rotate(-5deg) scale(1.1);
  }
  100% {
    transform: rotate(0deg) scale(1);
  }
}

/* Audio playback styling */
.audio-container {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(0, 128, 255, 0.3);
  border-radius: 20px;
  padding: 1rem;
  margin: 1rem 0;
  position: relative;
  overflow: hidden;
}

.audio-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #0080ff, transparent);
  animation: neonPulse 3s infinite;
}

.custom-audio-player {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.play-pause-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(45deg, #0055ff, #0099ff);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px rgba(0, 128, 255, 0.5);
}

.play-pause-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 25px rgba(0, 128, 255, 0.8);
}

.play-pause-btn svg {
  width: 20px;
  height: 20px;
  fill: white;
}

.audio-progress {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0055ff, #0099ff);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s ease;
}

.progress-thumb {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: #0080ff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 128, 255, 0.8);
  left: 0%;
}

.time-display {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #ffffff;
  text-shadow: 0 0 5px rgba(0, 128, 255, 0.5);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.volume-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 128, 255, 0.3);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.volume-btn:hover {
  background: rgba(0, 128, 255, 0.5);
}

.volume-btn svg {
  width: 16px;
  height: 16px;
  fill: white;
}

.volume-slider {
  width: 30px;
  height: 3px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}

.volume-fill {
  height: 100%;
  background: linear-gradient(90deg, #0055ff, #0099ff);
  border-radius: 2px;
  width: 100%;
}

/* Hide default audio element */
audio {
  display: none;
}