/* Projify - Styles globaux */

/* === Reset et base === */
* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, Arial, sans-serif;
  margin: 0;
  background: #f9fafb;
  color: #111827;
  line-height: 1.6;
}

main {
  max-width: 760px;
  margin: 24px auto;
  padding: 16px;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.875rem;
  font-weight: 700;
  color: #111827;
}

h2 {
  margin: 0 0 12px;
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
}

p {
  margin: 0 0 16px;
  color: #4b5563;
}

.desc {
  color: #6b7280;
  margin: 0 0 16px;
}

/* Explications des questions (pédagogie v2.0) */
.explanation {
  font-size: 13px;
  color: #6b7280;
  background: #f9fafb;
  border-left: 3px solid #d1d5db;
  padding: 8px 12px;
  margin: 6px 0 12px;
  border-radius: 4px;
  font-style: italic;
  line-height: 1.4;
}

.legend {
  font-size: 14px;
  color: #9ca3af;
  margin: 0 0 24px;
  font-style: italic;
}

/* === Cartes === */
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

/* Grille pour prénom/nom sur la même ligne */
.card form {
  display: grid;
  gap: 16px;
}

.card .name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .card .name-row {
    grid-template-columns: 1fr;
  }
}

.field {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  margin: 12px 0;
}

/* === Formulaires === */
label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
  color: #374151;
}

.field > label {
  font-weight: 700;
}

/* Style pour les champs obligatoires */
label.required {
  color: #374151;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 16px;
  background: #fff;
  transition: border-color 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

/* Style pour les options placeholder des selects */
select option:disabled {
  color: #9ca3af;
  font-style: italic;
}

.control {
  margin-top: 6px;
  width: 100%;
}

/* === Boutons === */
button {
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn {
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: #374151;
  font-weight: 500;
}

.btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* États désactivés pour boutons de navigation */
.btn:disabled,
.btn.btn-disabled {
  background: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
  cursor: not-allowed;
  opacity: 0.6;
}

.btn:disabled:hover,
.btn.btn-disabled:hover {
  background: #f3f4f6;
  border-color: #e5e7eb;
}

.btn-primary {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.btn-primary:hover {
  background: #1f2937;
  border-color: #1f2937;
}

.btn-primary:disabled,
.btn-primary.btn-disabled {
  background: #9ca3af;
  color: #e5e7eb;
  border-color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-primary:disabled:hover,
.btn-primary.btn-disabled:hover {
  background: #9ca3af;
  border-color: #9ca3af;
}

/* Bouton de démarrage (index.html) */
.btn-start {
  margin-top: 12px;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  font-weight: 600;
  width: 100%;
}

.btn-start:hover:not(:disabled) {
  background: #1f2937;
}

.btn-start:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  opacity: 0.5;
}

/* === Wizard (questionnaire) === */
.wizard-header {
  position: sticky;
  top: 0;
  background: #f9fafb;
  padding: 8px 0;
  z-index: 5;
  margin-bottom: 16px;
}

.progress {
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0 12px;
}

.progress > div {
  height: 100%;
  background: #111827;
  transition: width 0.3s ease;
}

.step {
  color: #6b7280;
  margin: 0;
  font-size: 14px;
}

.wizard-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* === Multi-select pills === */
.checkgroup {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.checkgroup label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.checkgroup label:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.checkgroup input {
  margin: 0;
}

.checkgroup input:checked + label {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}

/* === États de chargement === */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f4f6;
  border-radius: 50%;
  border-top-color: #3b82f6;
  animation: spin 1s ease-in-out infinite;
}

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

/* === Responsive === */
@media (max-width: 768px) {
  main {
    margin: 16px auto;
    padding: 12px;
  }
  
  .card {
    padding: 16px;
  }
  
  .field {
    padding: 12px;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  .wizard-footer {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
    text-align: center;
  }
}

/* === Utilitaires === */
.text-center {
  text-align: center;
}

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

.text-red {
  color: #dc2626;
}

.text-green {
  color: #16a34a;
}

.text-gray {
  color: #6b7280;
}

.hidden {
  display: none;
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

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

/* === Page de résultat === */
.success {
  background: #f0f9ff;
  border: 1px solid #0ea5e9;
  border-radius: 12px;
  padding: 32px;
  margin: 24px 0;
  text-align: left;
}

.success h2 {
  color: #0c4a6e;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 20px;
  line-height: 1.4;
}

.success h3 {
  color: #0c4a6e;
  font-size: 1.25rem;
  font-weight: 600;
  margin: 24px 0 16px;
}

.success p {
  color: #374151;
  margin: 0 0 20px;
  font-size: 1rem;
}

.success ol {
  margin: 16px 0;
  padding-left: 20px;
  color: #374151;
}

.success ol li {
  margin: 12px 0;
  line-height: 1.6;
}

.success ol li strong {
  color: #0c4a6e;
}

.success .tip {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 16px;
  margin: 24px 0 0;
  font-size: 0.95rem;
  color: #92400e;
}

.success .tip strong {
  color: #78350f;
}