html,
body {
  height: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* ========================================
   Variables CSS pour Light / Dark Mode
   ======================================== */

:root[data-theme="light"] {
  --bg-primary: #fafbfc;
  --bg-message-user: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-message-ai: #f5f5f7;
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --text-message-user: #ffffff;
  --text-message-ai: #1d1d1f;
  --bg-input: #f5f5f7;
  --footer-bg: rgba(255, 255, 255, 0.8);
}

:root[data-theme="dark"] {
  --bg-primary: #0d0d0d;
  --bg-message-user: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-message-ai: #1e1e1e;
  --text-primary: #ffffff;
  --text-secondary: #a1a1a6;
  --text-message-user: #ffffff;
  --text-message-ai: #ffffff;
  --bg-input: #1e1e1e;
  --footer-bg: rgba(13, 13, 13, 0.95);
}

/* ========================================
   Reset et Base
   ======================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
  height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========================================
   Layout Principal
   ======================================== */

.container-fluid {
  max-width: 100%;
  padding: 0;
}
.container-fluid {
  max-width: 100%;
  padding: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.col-12.col-lg-8.col-xl-6 {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========================================
   Messages Container
   ======================================== */

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 3rem 2rem 2rem;
  background-color: var(--bg-primary);
  scroll-behavior: smooth;
}
.row.h-100.justify-content-center {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Scrollbar minimaliste */
.messages-container::-webkit-scrollbar {
  width: 4px;
}

.messages-container::-webkit-scrollbar-track {
  background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
  background: var(--text-secondary);
  border-radius: 10px;
  opacity: 0.3;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  opacity: 0.6;
}

/* ========================================
   Welcome Message
   ======================================== */

.welcome-message {
  animation: fadeIn 1.5s ease;
}

.welcome-icon {
  font-size: 5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
  display: inline-block;
}

.welcome-message h2 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.welcome-message p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ========================================
   Message Bubbles
   ======================================== */

.message {
  display: flex;
  margin-bottom: 1.25rem;
  animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  animation-fill-mode: forwards;
}

.message.user {
  justify-content: flex-end;
  padding-left: 10%;
}

.message.ai {
  justify-content: flex-start;
  padding-right: 10%;
}

.message-bubble {
  width: 100%;
  padding: 1.25rem 1.5rem;
  border-radius: 24px;
  word-wrap: break-word;
  transition: all 0.2s ease;
}

.message.user .message-bubble {
  background: var(--bg-message-user);
  color: var(--text-message-user);
  border-radius: 24px 24px 6px 24px;
}

.message.ai .message-bubble {
  background-color: var(--bg-message-ai);
  color: var(--text-message-ai);
  border-radius: 24px 24px 24px 6px;
}

.message-content {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.message-content p {
  margin-bottom: 0.5rem;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content strong {
  font-weight: 600;
}

.message-content em {
  font-style: italic;
}

.message-content ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.message-content li {
  margin-bottom: 0.25rem;
}

.message-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

.message.user .message-time {
  color: rgba(255, 255, 255, 0.7);
}

.copy-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  opacity: 0.6;
}

.copy-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.message.user .copy-btn {
  color: rgba(255, 255, 255, 0.7);
}

.message.user .copy-btn:hover {
  color: #ffffff;
}

/* Effet de typing pour l'IA */
.typing-effect {
  display: inline;
}

/* ========================================
   Loading Indicator
   ======================================== */

.loading-indicator {
  display: flex;
  align-items: center;
  padding: 1rem 2rem;
  background-color: var(--bg-primary);
}

.typing-indicator {
  display: flex;
  gap: 0.35rem;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* ========================================
   Input Zone
   ======================================== */

.input-zone {
  /* background-color: var(--footer-bg);
    padding: 1.5rem 2rem; */
  transition: all 0.3s ease;
  backdrop-filter: blur(20px);
}

.input-container {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.message-input {
  flex: 1;
  resize: none;
  border-radius: 20px;
  padding: 0.875rem 1.25rem;
  border: none;
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: all 0.2s ease;
  max-height: 120px;
  overflow-y: auto;
  font-family: "Inter", sans-serif;
}

.message-input:focus {
  outline: none;
  transform: scale(1.01);
}

.message-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.send-btn {
  min-width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.send-btn:hover:not(:disabled) {
  transform: scale(1.1);
}

.send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

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

/* ========================================
   Footer Controls
   ======================================== */

.footer-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.2rem;
  margin-bottom: 0.5rem;
}

.footer-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.125rem;
  padding: 0.5rem;
  transition: all 0.3s ease;
  opacity: 0.6;
  border-radius: 8px;
}

.footer-btn:hover {
  opacity: 1;
  background-color: var(--bg-input);
  transform: scale(1.1);
}

.footer-btn .theme-icon {
  transition: transform 0.3s ease;
}

.footer-btn:hover .theme-icon {
  transform: rotate(20deg);
}

.char-count {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  opacity: 0.7;
  flex: 1;
  text-align: center;
}

/* ========================================
   Animations
   ======================================== */

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

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

.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

.shake {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
  .messages-container {
    padding: 2rem 1.25rem;
  }

  .message-bubble {
    max-width: 85%;
  }

  .input-zone {
    padding: 1.25rem 1.25rem;
  }

  .welcome-icon {
    font-size: 4rem;
  }

  .welcome-message h2 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .message-bubble {
    max-width: 90%;
    padding: 0.875rem 1rem;
  }

  .send-btn {
    min-width: 44px;
    height: 44px;
  }
}
