/* ========================================
   Variables et Reset
   ======================================== */
:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --secondary-color: #6b7280;
  --success-color: #10b981;
  --error-color: #ef4444;
  --background: #f9fafb;
  --card-background: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  padding: 2rem 1rem;
  min-height: 100vh;
}

/* ========================================
   Container et Layout
   ======================================== */
.container {
  max-width: 700px;
  margin: 0 auto;
  background: var(--card-background);
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  animation: fadeInUp 0.5s ease-out;
}

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

/* ========================================
   Header
   ======================================== */
.form-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color);
}

.form-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

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

/* ========================================
   Progress Bar
   ======================================== */
.progress-container {
  margin-bottom: 2.5rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
  border-radius: 9999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

.progress-text {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

/* ========================================
   Loading State
   ======================================== */
.loading-state {
  text-align: center;
  padding: 3rem 1rem;
}

.spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto 1.5rem;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

/* ========================================
   Error & Success States
   ======================================== */
.error-state,
.success-state {
  text-align: center;
  padding: 3rem 1rem;
}

.error-icon,
.success-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.error-icon {
  color: var(--error-color);
}

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  background: var(--success-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: bold;
  animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

.error-state h2,
.success-state h2 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.error-state p,
.success-state p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* ========================================
   Client Info
   ======================================== */
.client-info {
  background: var(--background);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.client-info h3 {
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

#client-details {
  display: grid;
  gap: 0.5rem;
}

.client-detail {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.client-detail strong {
  color: var(--text-primary);
  margin-right: 0.5rem;
  min-width: 120px;
}

/* ========================================
   Form Steps
   ======================================== */
.form-step {
  display: none;
  animation: slideIn 0.4s ease-out;
}

.form-step.active {
  display: block;
}

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

.section-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.step-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.section-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.step-indicator {
  display: inline-block;
  background: var(--primary-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========================================
   Form Fields
   ======================================== */
.form-field {
  margin-bottom: 1.5rem;
}

.form-field label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.form-field label .required {
  color: var(--error-color);
  margin-left: 0.25rem;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--card-background);
  color: var(--text-primary);
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-field input.error,
.form-field textarea.error,
.form-field select.error {
  border-color: var(--error-color);
}

.form-field input.error:focus,
.form-field textarea.error:focus,
.form-field select.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-field textarea {
  resize: vertical;
  min-height: 100px;
}

.field-error {
  color: var(--error-color);
  font-size: 0.85rem;
  margin-top: 0.375rem;
  display: none;
}

.field-error.visible {
  display: block;
}

/* ========================================
   Buttons
   ======================================== */
.form-navigation {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.btn {
  padding: 0.875rem 1.75rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1;
}

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

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--background);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-color);
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* ========================================
   Utility Classes
   ======================================== */
.hidden {
  display: none !important;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 640px) {
  body {
    padding: 1rem 0.5rem;
  }

  .container {
    padding: 1.5rem;
    border-radius: 0.75rem;
  }

  .form-header h1 {
    font-size: 1.5rem;
  }

  .form-header p {
    font-size: 0.9rem;
  }

  .form-navigation {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  #prev-btn {
    order: 2;
  }

  #next-btn,
  #submit-btn {
    order: 1;
  }
}
