:root {
  /* Fieldmind.ai color palette - Green theme */
  --primary-color: #059669;
  --primary-dark: #047857;
  --secondary-color: #2563eb;
  --accent-color: #f59e0b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;

  /* Background colors - Dark theme */
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --surface-color: #37544d;

  /* Text colors - Dark theme */
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  /* Gradients */
  --primary-gradient: linear-gradient(135deg, #059669 0%, #047857 100%);
  --secondary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Spacing */
  --safe-area-top: env(safe-area-inset-top);
  --safe-area-bottom: env(safe-area-inset-bottom);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.chat-container {
  width: 100%;
  height: 100vh;
  background: var(--bg-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.chat-header {
  padding: calc(1rem + var(--safe-area-top)) 1rem 1rem;
  background: var(--primary-gradient);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
  z-index: 10;
}

.chat-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-align: center;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  scroll-behavior: smooth;
  background: var(--surface-color);
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.message {
  margin-bottom: 1rem;
  max-width: 85%;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-content {
  padding: 0.875rem 1rem;
  border-radius: 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
  position: relative;
  box-shadow: var(--shadow-sm);
  word-wrap: break-word;
}

.user-message {
  margin-left: auto;
}

.user-message .message-content {
  background: var(--primary-gradient);
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.other-message .message-content {
  background: #264240;
  color: var(--text-primary);
  border-bottom-left-radius: 0.25rem;
  border: 1px solid #475569;
}

.other-message .message-content ul {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  line-height: 1.8;
}

.other-message .message-content li {
  margin: 1.5rem 0;
  line-height: 1.8;
}

/* Product list styling */
.product-item {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 0.75rem;
  background: #1e293b;
  border: 1px solid #475569;
  box-shadow: var(--shadow-sm);
}

.product-name {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.75rem;
  font-size: 1rem;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
}

.product-detail {
  margin: 0.5rem 0;
  padding-left: 1rem;
  position: relative;
  font-size: 0.9rem;
}

.product-detail:before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-weight: bold;
}

.product-detail strong {
  color: var(--text-primary);
}

[class*="effekt-"] {
  padding: 10px;
  font-weight: bold;
  border-radius: 8px;
  /* Propriétés communes */
}

/* Spécifiques à chaque x */
.effekt-1 {
  background-color: #23781f;
}

.effekt-2 {
  background-color: #57bf38;
}

.effekt-3 {
  background-color: #d1b423;
}

.effekt-4 {
  background-color: #a12727;
}
.effekt-1-2 {
  background: linear-gradient(to right, #23781f, #57bf38);
}

.effekt-2-3 {
  background: linear-gradient(to right, #57bf38, #d1b423);
}

.effekt-3-4 {
  background: linear-gradient(to right, #d1b423, #a12727);
}



.chat-input {
  padding: 1rem;
  padding-bottom: calc(3.25rem + var(--safe-area-bottom));
  background: #1e293b;
  border-top: 1px solid #475569;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.chat-input input {
  flex: 1;
  padding: 0.875rem 1rem;
  border: 2px solid #475569;
  border-radius: 1.5rem;
  outline: none;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: #334155;
  color: #f1f5f9;
  min-height: 48px;
}

.chat-input input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chat-input button {
  padding: 0.875rem 1.5rem;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 1.5rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  min-height: 48px;
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-input button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.chat-input button:active {
  transform: translateY(0);
}

.chat-input button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Authentication styles */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  padding: 1rem;
  background: var(--surface-color);
}

.auth-form {
  background: #1e293b;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  border: 1px solid #475569;
}

.auth-form h2 {
  margin: 0 0 1.5rem;
  color: var(--text-primary);
  font-size: 1.5rem;
  text-align: center;
  font-weight: 600;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid #475569;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: #334155;
  color: #f1f5f9;
}

.form-group input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

.auth-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.auth-button {
  flex: 1;
  padding: 0.875rem 1rem;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.auth-button.secondary {
  background: #334155;
  color: var(--text-primary);
  border: 2px solid #475569;
}

.auth-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.auth-button.secondary:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.auth-button:active {
  transform: translateY(0);
}

.auth-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-error {
  color: var(--error-color);
  font-size: 0.875rem;
  margin-top: 1rem;
  text-align: center;
  padding: 0.75rem;
  background: #064e3b;
  border-radius: 0.5rem;
  border: 1px solid #065f46;
}

.forgot-password {
  text-align: center;
  margin-top: 1rem;
}

.forgot-password a {
  color: #10b981;
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}

.forgot-password a:hover:not(.disabled) {
  color: #059669;
  text-decoration: underline;
}

.forgot-password a.disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  pointer-events: none;
}

.reset-message {
  color: var(--success-color);
  font-size: 0.875rem;
  text-align: center;
  margin-top: 1rem;
  padding: 0.75rem;
  background: #064e3b;
  border-radius: 0.5rem;
  border: 1px solid #065f46;
}

.reset-instructions {
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-align: center;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.back-to-login {
  text-align: center;
  margin-top: 1rem;
}

.back-to-login a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}

.back-to-login a:hover:not(.disabled) {
  color: #f1f5f9;
  text-decoration: underline;
}

.back-to-login a.disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading states */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Message de chargement */
.loading-message {
  animation: fadeIn 0.3s ease-out;
}

.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.loading-dots {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary-color);
  animation: loadingBounce 1.4s ease-in-out infinite both;
}

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

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

.loading-dots span:nth-child(3) {
  animation-delay: 0s;
}

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

.loading-text {
  color: #94a3b8;
  font-size: 0.875rem;
  margin: 0;
  font-style: italic;
}

/* Responsive adjustments */
@media (min-width: 768px) {
  #app {
    max-width: 768px;
    margin: 0 auto;
    height: 100vh;
  }

  .chat-container {
    border-radius: 1rem;
    margin: 1rem;
    height: calc(100vh - 2rem);
    box-shadow: var(--shadow-lg);
  }

  .chat-header {
    border-radius: 1rem 1rem 0 0;
  }

  .chat-input {
    border-radius: 0 0 1rem 1rem;
  }
}



/* Page de sélection */
.selection-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--primary-gradient);
  padding: 20px;
}

.selection-form {
  background: var(--card-bg);
  padding: 40px;
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 600px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.selection-form h2 {
  color: white;
  margin-bottom: 10px;
  font-size: 2.5em;
  font-weight: 600;
}

.selection-form p {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 30px;
  font-size: 1.1em;
}

.corpus-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 30px;
}

.corpus-option {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  padding: 30px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  backdrop-filter: blur(10px);
}

.corpus-option:hover:not(.disabled) {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.corpus-option.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.corpus-option.disabled:hover {
  transform: none;
  box-shadow: none;
}

.corpus-icon {
  font-size: 3em;
  margin-bottom: 15px;
}

.corpus-option h3 {
  color: white;
  margin-bottom: 10px;
  font-size: 1.5em;
  font-weight: 600;
}

.corpus-option p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9em;
  line-height: 1.4;
  margin: 0;
}

/* Header du chat avec bouton de changement */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: #4CAF50;
  color: white;
  border-radius: 10px 10px 0 0;
}

.chat-header h1 {
  margin: 0;
  font-size: 1.5em;
  font-weight: 600;
}

.change-corpus-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.3s ease;
}

.change-corpus-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 768px) {
  .corpus-options {
    grid-template-columns: 1fr 1fr;
    gap: 15px;
  }
  
  .selection-form {
    padding: 20px 15px;
  }
  
  .selection-form h2 {
    font-size: 2em;
  }
  
  .selection-form p {
    font-size: 1em;
    margin-bottom: 20px;
  }
  
  .corpus-option {
    padding: 20px 15px;
  }
  
  .corpus-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
  }
  
  .corpus-option h3 {
    font-size: 1.2em;
    margin-bottom: 8px;
  }
  
  .corpus-option p {
    font-size: 0.8em;
    line-height: 1.3;
  }
  
  .chat-header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  
  .chat-header h1 {
    font-size: 1.3em;
  }
}