.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 600px;
  // Le contenu peut dépasser la hauteur de l'écran (formulaire long) :
  // on borne la modale et on fait scroller l'intérieur en flex-column.
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header { flex-shrink: 0; }

form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  // Marge interne pour que la scrollbar ne colle pas aux inputs.
  margin-right: -0.5rem;
  padding-right: 0.5rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;

  h2 { color: white; font-size: 1.25rem; font-weight: 600; }
}

.btn-close {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  display: flex;
  transition: color 0.2s;

  &:hover { color: white; }
}

.field {
  margin-bottom: 1.5rem;

  label {
    display: block;
    font-size: 0.875rem;
    color: #d1d5db;
    margin-bottom: 0.5rem;
  }

  input, textarea {
    width: 100%;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: white;
    font-size: 0.9rem;
    outline: none;
    resize: none;
    transition: border-color 0.2s;

    &::placeholder { color: #4b5563; }
    &:focus { border-color: #6c63ff; }
    &.invalid { border-color: #ef4444; }
  }

  input[type="number"] { width: 120px; }
}

.inline-create {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.875rem;
  background: #1a2233;
  border: 1px solid #2d3748;
  border-left: 3px solid #6c63ff;
  border-radius: 8px;

  input {
    width: 100%;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 6px;
    padding: 0.6rem 0.875rem;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;

    &::placeholder { color: #4b5563; }
    &:focus { border-color: #6c63ff; }
  }
}

.inline-create-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-inline-primary {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  background: #6c63ff;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;

  &:hover:not(:disabled) { background: #5b52e0; }
  &:disabled { opacity: 0.4; cursor: not-allowed; }
}

.btn-inline-secondary {
  padding: 0.5rem 0.875rem;
  background: transparent;
  color: #9ca3af;
  border: 1px solid #374151;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;

  &:hover { background: #1f2937; color: white; }
}

.hint-warning {
  margin-top: 0.5rem;
  background: rgba(234, 179, 8, 0.08);
  border-left: 3px solid #eab308;
  border-radius: 4px;
  padding: 0.625rem 0.875rem;
  color: #fbbf24;
  font-size: 0.8rem;
  line-height: 1.5;

  strong { color: #fde68a; }
}

.info-box {
  background: #1f2937;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: #9ca3af;
  line-height: 1.8;

  ul {
    margin: 0.5rem 0 0 1.25rem;
    li strong { color: #d1d5db; }
  }
}

.modal-actions {
  display: flex;
  gap: 1rem;
  // Actions collées en bas du scroll : visibles même si on n'a pas défilé
  // jusqu'en bas du formulaire.
  position: sticky;
  bottom: 0;
  background: #111827;
  padding-top: 1rem;
  margin-top: auto;
  flex-shrink: 0;
}

.btn-primary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #6c63ff;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;

  &:hover:not(:disabled) { background: #5b52e0; }
  &:disabled { opacity: 0.4; cursor: not-allowed; }
}

.btn-secondary {
  padding: 0.75rem 1.5rem;
  background: #1f2937;
  color: #d1d5db;
  border: 1px solid #374151;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;

  &:hover { background: #374151; }
}
