 body { font-family: 'Inter', sans-serif; margin: 0;padding: 0;}
  
  /* Structure fixe pour mobile */
  html {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }
  
  body {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    overflow: hidden;
  }
  
  /* Gérer le clavier virtuel sur mobile */
  @supports (height: 100dvh) {
    body {
      height: 100dvh;
    }
  }
  
  /* Désactiver le double-tap zoom */
  input, textarea, button, select {
    font-size: 16px;
  }
  
  /* Markdown Styles */
  .prose { max-width: 100%; overflow-wrap: break-word; word-break: break-word; }
  .prose p { margin-bottom: 0.5em; margin-top: 0; }
  .prose p:last-child { margin-bottom: 0; }
  .prose code { font-family: monospace; font-size: 0.85em; }
  .prose :not(pre) > code { background: rgba(100,116,139,0.2); padding: 0.1em 0.3em; border-radius: 0.2em; word-break: break-word; }
  .prose ul, .prose ol { margin-left: 1rem; margin-bottom: 0.5em; list-style-type: disc; margin-top: 0; padding-left: 1.5rem; }
  .prose ol { list-style-type: decimal; }
  .prose img { max-width: 100%; height: auto; border-radius: 0.5rem; display: block; }
  .prose a { color: #0ea5e9; text-decoration: underline; word-break: break-word; }

  /* Table Styles */
  .prose table { width: 100%; border-collapse: collapse; margin: 1rem 0; display: block; overflow-x: auto; border-radius: 0.5rem; border: 1px solid #334155; font-size: 0.875rem; }
  .dark .prose table { border-color: #475569; }
  .prose th, .prose td { border: none; padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid #334155; white-space: normal; word-break: break-word; }
  .dark .prose th, .dark .prose td { border-color: #475569; }
  .prose tr:last-child td { border-bottom: none; }
  .prose th { background: #e2e8f0; font-weight: 600; padding: 0.5rem 0.75rem; }
  .dark .prose th { background: #1e293b; }

  .menu-btn {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem;
    border-radius: .75rem;
    transition: background .2s;
  }
  .menu-btn:hover { background: rgb(226 232 240); }
  .dark .menu-btn:hover { background: rgb(30 41 59); }

  .icon-btn {
    height: 40px;
    width: 40px;
    display: grid;
    place-items: center;
    border-radius: .75rem;
    background: rgb(226 232 240);
  }
  .dark .icon-btn { background: rgb(30 41 59); }

  .icon-inside {
    height: 36px;
    width: 36px;
    display: grid;
    place-items: center;
    border-radius: .5rem;
    color: rgb(100 116 139);
  }
  .icon-inside:hover { background: rgb(226 232 240); }
  .dark .icon-inside:hover { background: rgb(51 65 85); }
  .rWeb{background: rgb(14 165 233); color: white;}
  .rWeb:hover, .dark .rWeb:hover {background: rgb(2 132 199);}

  .send-btn {
    height: 36px;
    width: 36px;
    display: grid;
    place-items: center;
    border-radius: .5rem;
    background: rgb(14 165 233);
    color: white;
  }
  .send-btn:hover { background: rgb(2 132 199); }


  /* ChatGPT-like Code Blocks */
  .code-block-wrapper { background: #1e293b; border-radius: 0.75rem; overflow: hidden; margin: 0.75rem 0; max-width: 100%; }
  .code-block-header { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 1rem; background: #334155; color: #94a3b8; font-size: 0.75rem; flex-wrap: wrap; gap: 0.5rem; }
  .copy-btn-new { display: flex; align-items: center; gap: 0.25rem; padding: 0.25rem 0.5rem; border-radius: 0.375rem; cursor: pointer; transition: all .1s; white-space: nowrap; font-size: 0.75rem; }
  .copy-btn-new:hover { background: rgba(255, 255, 255, 0.1); color: white; }
  .prose pre { background: transparent !important; margin: 0 !important; padding: 0.75rem !important; border-radius: 0 !important; overflow-x: auto; max-width: calc(100vw - 4rem); }
  .prose pre code { font-size: 0.8em; }

  /* Effet de main qui écrit (Curseur) */
  .typing-effect::after {
    content: ' ✍️';
    display: inline-block;
    margin-left: 4px;
    animation: blink 1s step-start infinite;
    vertical-align: middle;
  }
  @keyframes blink { 50% { opacity: 0; } }
  *{
    scrollbar-width: thin;
    scrollbar-color: rgba(2, 81, 192, 0.5) transparent;
  }

  /* Global transition */
  *, *::before, *::after {
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: .1s;
  }
  .fa-spin, .fa-circle-notch { transition: none; }

/**************************************************************/
/*********************** MODE VOCAL ***************************/
.mv-bloc{
  transition: .3s;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
  width: 82%;
  height: 100%;
  left: auto;
  top: 0;
  position: fixed;
  backdrop-filter: blur(20px);
}
.mv-logo{
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: url("http://localhost:3000/medias/transformeia.jpg") no-repeat center center;
  background-size: cover;
  box-shadow: 0px 0px 15px 0px cyan;
}
.mv-effet-Q{

}
.mv-bloc-btn{
  width: 60%;
  height: auto;
  padding: 2%;
  margin-top: 6%;
  /*background: #1e293b;*/
  /*border-radius: 10px;*/
  display: flex;align-items: center;justify-content: center;
}
.mv-bloc button {
  font-size: 1.5em;
  background: #1e293b;
  padding: 2%;
  border-radius: 15px;
  width: 60px;
  height: 60px;
  margin: 0 8%;
}
.mv-bloc .mv-micro{background: rgb(14 165 233);}
.mv-bloc .mv-micro:hover{background: rgb(2 132 199);}
.mv-bloc canvas {
      width: 30%;
      height: 100px;
      background: #111;
      border-radius: 10px;
      margin-top: 1%;
      background: none;
      border-bottom: 1px solid cyan;
    }

.mv-bloc button:nth-child(2):hover{background: darkred;}

.alert-msg{
  position: fixed;
  bottom: -10%;
  opacity: 0;
  left: 5%;
  padding: .8%;
  max-width: 30%;
  background: rgb(2 132 199);
  border-radius: 10px;
  transition: 2s;

}
.alert-msg > div{overflow: hidden;}
.alert-msg button{display: flex;position: absolute;right: 5px;left: auto;top: -18px;}
.disabled{opacity: .7; cursor: no-drop;}
.disabled:hover{background: rgb(14 165 233);}

/* ============================================================ */
/* MEDIA QUERIES - RESPONSIVE MOBILE */
/* ============================================================ */

/* Animations pour le menu mobile */
@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideOutLeft {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

.slide-in-left {
  animation: slideInLeft 0.3s ease-out forwards;
}

.slide-out-left {
  animation: slideOutLeft 0.3s ease-out forwards;
}

#mobileMenu.hidden .bg-white,
#mobileMenu.hidden .dark\:bg-slate-950 {
  animation: slideOutLeft 0.3s ease-out forwards;
}

@media (max-width: 768px) {
  /* Header et Footer FIXED sur mobile */
  header { 
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    z-index: 50;
    height: auto;
    min-height: 50px;
    padding: 0.75rem; 
    gap: 0.5rem;
    width: 100%;
    background: rgba(226, 232, 240, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
  }
  .dark header {
    background: rgba(15, 23, 42, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  footer { 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    z-index: 50;
    width: 100%;
    height: auto;
    min-height: 60px;
    padding: 0;
    background: rgba(226, 232, 240, 0.98);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    overflow: visible;
  }
  .dark footer {
    background: rgba(15, 23, 42, 0.98);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  footer .mx-auto { 
    padding: 0.5rem; 
    width: 100%;
  }
  footer textarea { 
    padding: 0.5rem 0.75rem !important; 
    font-size: 16px;
    min-height: 40px;
  }

  /* Main - le vrai flex-1 pour l'espace restant */
  main.flex-1 { 
    position: fixed;
    top: 50px;
    bottom: 60px;
    left: 0;
    right: 0;
    width: 100%;
    padding: 0.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  /* Chat container */
  main #chat-container { 
    gap: 0.5rem;
    display: flex;
    flex-direction: column;
    /* background-color: #0ea5e9; */
    padding-bottom: 12%;
    padding-top: 4%;
  }

  /* Réduire le padding des messages */
  .bg-sky-500.text-white,
  .bg-slate-200.dark\:bg-slate-800 {
    padding: 0.625rem !important;
    max-width: calc(100vw - 2rem) !important;
  }

  /* Bulles de chat responsive */
  .flex.justify-end > div,
  .flex.justify-start > div {
    max-width: 90vw;
    word-break: break-word;
  }

  /* Réduire taille du texte sur mobile */
  .prose { font-size: 0.95rem; }
  .prose p { margin-bottom: 0.4em; }
  .prose ul, .prose ol { margin-left: 0.75rem; padding-left: 1.25rem; }

  /* Tableaux responsive */
  .prose table { font-size: 0.75rem; margin: 0.75rem 0; }
  .prose th, .prose td { padding: 0.375rem 0.5rem; }
  
  /* Code blocks mobile */
  .code-block-wrapper { margin: 0.5rem 0; }
  .code-block-header { padding: 0.375rem 0.75rem; font-size: 0.65rem; }
  .prose pre { padding: 0.5rem !important; max-width: calc(100vw - 2rem); }
  .prose pre code { font-size: 0.75em; }

  /* Alert message mobile */
  .alert-msg { max-width: 95%; left: 2.5%; bottom: 80px; z-index: 99999999999999;}
  
  /* Icon buttons responsive */
  .icon-btn { height: 36px; width: 36px; }
  .icon-inside { height: 32px; width: 32px; }

  /* Mode vocal adjustments */
  .mv-bloc { width: 100%; }
  .mv-logo { width: 150px; height: 150px; }

  /* Archive */
  #archives-modal{z-index: 999999999;}
}

@media (max-width: 480px) {
  /* Extra small phones */
  .prose { font-size: 0.9rem; }
  .prose ul, .prose ol { margin-left: 0.5rem; padding-left: 1rem; }

  /* Very small code blocks */
  .prose table { font-size: 0.65rem; margin: 0.5rem 0; }
  .prose th, .prose td { padding: 0.25rem 0.375rem; }
  .code-block-header { padding: 0.25rem 0.5rem; font-size: 0.6rem; }
  .copy-btn-new { padding: 0.125rem 0.375rem; font-size: 0.65rem; }
  
  /* Reduce header/footer */
  header { padding: 0.5rem; }
  h2 { font-size: 0.95rem; }
  
  /* Main chat area */
  main #chat-container { gap: 0.25rem; }
  main { padding: 0.25rem; }
}

/**************************************************************/
/***** NOUVEAU SYSTÈME VOCAL AMÉLIORÉ (ChatGPT Style) ********/
/**************************************************************/

/* Conteneur principal du mode vocal */
.voice-panel {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 350px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  z-index: 9999 !important;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  max-height: 500px;
  overflow-y: auto;
}

.dark .voice-panel {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(71, 85, 105, 0.3);
}

/* Canvas avec waveform réaliste */
#waveform-canvas {
  width: 100%;
  height: 120px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  border-radius: 12px;
  margin: 0;
}

/* Indicateur de volume */
.volume-indicator-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.volume-label {
  font-size: 12px;
  color: rgb(100, 116, 139);
  text-transform: uppercase;
  font-weight: 600;
  min-width: 60px;
}

.volume-bar-wrapper {
  flex: 1;
  height: 6px;
  background: rgba(100, 116, 139, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.volume-bar {
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9 0%, #3b82f6 100%);
  border-radius: 3px;
  transition: width 0.05s ease;
  width: 0%;
}

/* Texte de statut */
.voice-status {
  font-size: 13px;
  color: rgb(100, 116, 139);
  text-align: center;
  font-weight: 500;
}

.voice-status.listening {
  color: #ef4444;
  animation: pulse-status 1.5s ease-in-out infinite;
}

@keyframes pulse-status {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Texte transcrit */
.voice-transcript {
  min-height: 40px;
  padding: 12px;
  background: rgba(226, 232, 240, 0.3);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  border-left: 3px solid #0ea5e9;
}

.dark .voice-transcript {
  background: rgba(51, 65, 85, 0.3);
}

/* Bouton de basculement vocal */
#voice-toggle-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.4);
  align-self: center;
  margin-top: 12px;
}

#voice-toggle-btn:hover:not(.text-red-500) {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(14, 165, 233, 0.6);
}

#voice-toggle-btn.text-red-500 {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
  animation: pulse-btn 1.5s ease-in-out infinite;
}

@keyframes pulse-btn {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Boutons d'action vocale */
.voice-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.voice-action-btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid rgba(100, 116, 139, 0.2);
  background: rgba(226, 232, 240, 0.5);
  color: rgb(100, 116, 139);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.dark .voice-action-btn {
  background: rgba(51, 65, 85, 0.5);
}

.voice-action-btn:hover {
  background: rgb(14, 165, 233);
  color: white;
  border-color: rgb(14, 165, 233);
}

/* Responsive pour mobile - FULLSCREEN */
@media (max-width: 768px) {
  .voice-panel {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    padding: 20px;
    z-index: 9999 !important;
    max-width: 100vw !important;
    overflow-y: auto;
  }
}
