:root {
  /* Modern AI Chatbot Color Palette */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --secondary: #8b5cf6;
  --accent: #ec4899;
  
  /* Background & Surfaces */
  --bg-gradient-start: #0f172a;
  --bg-gradient-end: #1e293b;
  --surface: rgba(30, 41, 59, 0.8);
  --surface-light: rgba(51, 65, 85, 0.6);
  
  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  /* Message Bubbles */
  --user-bubble: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --bot-bubble: rgba(51, 65, 85, 0.8);
  
  /* Shadows & Effects */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --glow: 0 0 20px rgba(99, 102, 241, 0.3);
  
  /* Animations */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Animated background particles */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(236, 72, 153, 0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Modern Header */
.hero {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg), var(--glow);
  transition: all var(--transition-normal);
}

.hero:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.4);
}

.eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--primary-light);
  margin-bottom: 8px;
  font-weight: 600;
}

h1 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.intro {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Messages Container */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

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

#messages::-webkit-scrollbar-track {
  background: transparent;
}

#messages::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

/* Message Bubbles */
.message {
  max-width: 80%;
  animation: slideIn var(--transition-slow);
  position: relative;
}

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

.message.user {
  align-self: flex-end;
}

.message.assistant {
  align-self: flex-start;
}

.message-content {
  padding: 16px 20px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.6;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
}

.message.user .message-content {
  background: var(--user-bubble);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
  background: var(--bot-bubble);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}

.message-content p {
  margin: 0 0 12px 0;
}

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

/* Links in messages */
.message-content a {
  color: var(--primary-light);
  text-decoration: none;
  border-bottom: 1px dashed var(--primary-light);
  transition: all var(--transition-fast);
}

.message-content a:hover {
  color: white;
  border-bottom-style: solid;
}

.message.user .message-content a {
  color: white;
  border-bottom-color: rgba(255, 255, 255, 0.5);
}

/* CV Download Button */
.cv-download-link {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding: 10px 18px !important;
  background: linear-gradient(135deg, var(--accent) 0%, #f472b6 100%) !important;
  color: white !important;
  border-radius: 12px !important;
  border: none !important;
  font-weight: 600 !important;
  margin-top: 8px;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
  transition: all var(--transition-fast);
}

.cv-download-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.6);
  border-bottom: none !important;
}

/* Confidence Badge */
.confidence-badge {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid var(--primary);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--primary-light);
  margin-top: 8px;
  font-weight: 500;
}

/* Typing Indicator */
.typing .message-content {
  padding: 20px 24px;
}

.typing-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 2px;
  background: var(--primary-light);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* Input Form */
#chat-form {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  margin-top: 20px;
}

#message-input {
  flex: 1;
  background: var(--surface-light);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 18px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

#message-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

#message-input::placeholder {
  color: var(--text-muted);
}

#send-button {
  background: var(--user-bubble);
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
}

#send-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--glow);
}

#send-button:active:not(:disabled) {
  transform: translateY(0);
}

#send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Suggestions Chips */
.suggestions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.suggestion-chip {
  padding: 8px 16px;
  background: var(--surface-light);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.suggestion-chip:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* Responsive Design */

/* Tablettes (768px et moins) */
@media (max-width: 768px) {
  .app-shell {
    padding: 12px;
  }
  
  .hero {
    padding: 20px;
    border-radius: 16px;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  .message {
    max-width: 90%;
  }
  
  #chat-form {
    padding: 12px 16px;
    flex-direction: column;
    gap: 10px;
  }
  
  #message-input {
    padding: 12px 16px;
    font-size: 16px; /* Empêche le zoom iOS */
    width: 100%;
  }
  
  #send-button {
    padding: 12px 20px;
    width: 100%;
    justify-content: center;
  }
}

/* Mobile standard (480px et moins) */
@media (max-width: 480px) {
  .app-shell {
    padding: 8px;
  }
  
  .hero {
    padding: 16px;
    margin-bottom: 12px;
  }
  
  .hero h1 {
    font-size: 1.5rem;
  }
  
  .hero p {
    font-size: 0.9rem;
  }
  
  .chat-card {
    border-radius: 12px;
  }
  
  .messages {
    padding: 12px;
  }
  
  .message {
    max-width: 95%;
    margin: 8px 0;
  }
  
  .message-content {
    padding: 12px 16px;
    font-size: 0.9rem;
  }
  
  #chat-form {
    padding: 10px 12px;
    border-radius: 12px;
  }
  
  #message-input {
    padding: 10px 14px;
    font-size: 16px; /* Toujours 16px pour éviter le zoom iOS */
    min-height: 44px; /* Hauteur tactile minimum */
  }
  
  #send-button {
    padding: 10px 16px;
    font-size: 0.9rem;
    min-height: 44px; /* Hauteur tactile minimum */
  }
  
  /* Suggestions chips plus petits sur mobile */
  .suggestion-chip {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}

/* Très petits écrans (360px et moins) */
@media (max-width: 360px) {
  .app-shell {
    padding: 6px;
  }
  
  .hero {
    padding: 12px;
  }
  
  .hero h1 {
    font-size: 1.3rem;
  }
  
  #message-input {
    padding: 8px 12px;
  }
  
  #send-button {
    padding: 10px 14px;
  }
  
  .messages {
    padding: 8px;
  }
  
  .message-content {
    padding: 10px 14px;
    font-size: 0.85rem;
  }
}

/* Mode paysage sur mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    padding: 12px 16px;
    margin-bottom: 8px;
  }
  
  .hero h1 {
    font-size: 1.2rem;
  }
  
  .hero p {
    font-size: 0.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  .messages {
    max-height: 40vh;
  }
  
  #chat-form {
    padding: 8px 12px;
  }
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible pour navigation clavier */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
