body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #D2B48C 0%, #DEB887 100%);
  color: #2d3748;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  line-height: 1.6;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 20% 80%, rgba(210, 180, 140, 0.3) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 800px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 1;
  margin-top: 20px;
  margin-bottom: 20px;
  overflow: hidden;
}

header {
  padding: 1rem;
  text-align: center;
  /* border-bottom: 1px solid #e0e0e0; */ /* Optionnel: séparateur léger */
}

#logo {
  height: 80px; /* Ajustez selon la taille de votre logo */
  margin-bottom: 0.5rem;
}

#chatbox {
  flex-grow: 1;
  padding: 1.5rem 2rem;
  overflow-y: auto;
  background: transparent;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

#chatbox::-webkit-scrollbar {
  width: 6px;
}

#chatbox::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

#chatbox::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

#chatbox::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.message {
  max-width: 75%;
  margin: 0.75rem 0;
  padding: 1rem 1.5rem;
  border-radius: 20px;
  line-height: 1.6;
  word-wrap: break-word;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(0);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #D2B48C 0%, #DEB887 100%);
  color: white;
  border-bottom-right-radius: 6px;
  position: relative;
}

.user::before {
  content: '';
  position: absolute;
  bottom: 0;
  right: -8px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-left: 8px solid #DEB887;
  border-bottom: 0;
}

.agent {
  align-self: flex-start;
  background: rgba(248, 250, 252, 0.8);
  color: #1a202c;
  border-bottom-left-radius: 6px;
  border: 1px solid rgba(226, 232, 240, 0.6);
  position: relative;
}

.agent::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -8px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-right: 8px solid rgba(248, 250, 252, 0.8);
  border-bottom: 0;
}


/* Loading and streaming indicators */
.agent.streaming::after {
  content: '';
  width: 8px;
  height: 8px;
  background: #D2B48C;
  border-radius: 50%;
  display: inline-block;
  margin-left: 0.5em;
  animation: pulse 1.5s infinite;
}

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

.loading-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 8px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  background: rgba(210, 180, 140, 0.6);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

form {
  display: flex;
  gap: 0.75rem;
  padding: 1.5rem 2rem;
  border-top: 1px solid rgba(226, 232, 240, 0.6);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 0 0 24px 24px;
}

#input {
  flex: 1;
  padding: 1rem 1.5rem;
  border-radius: 24px;
  border: 2px solid rgba(226, 232, 240, 0.8);
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  background: rgba(255, 255, 255, 0.9);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

#input:focus {
  outline: none;
  border-color: #D2B48C;
  box-shadow: 0 0 0 4px rgba(210, 180, 140, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

#input::placeholder {
  color: rgba(107, 114, 128, 0.8);
}

button {
  padding: 1rem 1.5rem;
  border: none;
  background: linear-gradient(135deg, #D2B48C 0%, #DEB887 100%);
  color: white;
  border-radius: 24px;
  cursor: pointer;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(210, 180, 140, 0.3);
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(210, 180, 140, 0.4);
}

button:hover::before {
  opacity: 1;
}

button:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(210, 180, 140, 0.3);
}

#micro {
  background: rgba(210, 180, 140, 0.1);
  color: #D2B48C;
  font-size: 1.5rem;
  padding: 0.75rem;
  border: 2px solid rgba(210, 180, 140, 0.2);
  box-shadow: 0 2px 8px rgba(210, 180, 140, 0.15);
}

#micro:hover {
  background: rgba(210, 180, 140, 0.15);
  border-color: rgba(210, 180, 140, 0.3);
  color: #DEB887;
}

#micro::before {
  display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    font-size: 0.95rem;
  }
  
  #chat-container {
    margin: 10px;
    height: calc(100vh - 20px);
    border-radius: 20px;
  }
  
  #chatbox {
    padding: 1rem 1.5rem;
  }
  
  form {
    padding: 1rem 1.5rem;
    gap: 0.5rem;
  }
  
  #input {
    padding: 0.875rem 1.25rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  button {
    padding: 0.875rem 1.25rem;
    min-width: 44px; /* Touch target */
  }
  
  #micro {
    padding: 0.625rem;
    font-size: 1.25rem;
  }
  
  .message {
    max-width: 85%;
    padding: 0.875rem 1.25rem;
    margin: 0.5rem 0;
  }
  
  .user::before,
  .agent::before {
    border-width: 6px;
  }
}

@media (max-width: 480px) {
  #chat-container {
    margin: 5px;
    height: calc(100vh - 10px);
    border-radius: 16px;
  }
  
  #chatbox {
    padding: 0.75rem 1rem;
  }
  
  form {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
  }
  
  #input {
    flex: 1;
    min-width: 0;
  }
  
  .message {
    max-width: 90%;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
}

@media (min-width: 1200px) {
  #chat-container {
    max-width: 900px;
  }
  
  #chatbox {
    padding: 2rem 2.5rem;
  }
  
  form {
    padding: 1.75rem 2.5rem;
  }
}
