:root {
  --blue: #0a356a;
  --ink: #0f172a;
  --muted: #475569;
  --bg: #f6f9ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #eaf3ff, #fff);
}

header {
  background: var(--blue);
  color: #fff;
  padding: 18px 20px;
  text-align: center;
}

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 22px 20px;
}

form {
  background: #fff;
  border: 1px solid #e6eefc;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 6px 20px rgba(42, 120, 255, 0.06);
}

label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin: 12px 0 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d7e6ff;
  border-radius: 12px;
}

.no-gap {
  display: inline-flex;
  gap: 0;
  align-items: center;
  flex-wrap: wrap;
}

fieldset {
  border: 1px solid #d7e6ff;
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
}

legend {
  font-weight: 700;
  color: #334155;
}

.btn {
  display: inline-block;
  background: #2a78ff;
  color: #fff;
  font-weight: 700;
  padding: 12px 16px;
  border-radius: 999px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  border: 2px solid #2a78ff;
}

.btn.outline {
  background: transparent;
  color: #2a78ff;
  border: 2px solid #2a78ff;
}

.hint {
  color: #64748b;
  font-size: 12px;
  margin-top: 6px;
}

.hint-no-margin {
  margin-top: 0;
}

.inline-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-group > input[type="text"] {
  max-width: 280px;
}

/* Ronds harmonisés */
input[type="radio"],
input[type="checkbox"] {
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: #fff;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
  position: relative;
  cursor: pointer;
  flex: 0 0 auto;
}

input[type="radio"]:checked,
input[type="checkbox"]:checked {
  background: var(--ink);
}

.alert {
  display: none;
  background: #fff5f5;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 12px;
  padding: 10px;
  margin-top: 6px;
  font-size: 13px;
}

/* Header du formulaire */
.form-header-content {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  max-width: 780px;
  margin: 0 auto;
}

.form-header-logo {
  height: 160px;
  width: auto;
  display: block;
  margin: 0 auto;
}

.form-header-title {
  color: #3DA6DB;
  margin: 12px 0 0;
  font-size: 22px;
  text-align: center;
}

/* File input styles */
.file-input-wrapper {
  position: relative;
  width: 100%;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-input-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  min-height: 48px;
}

.file-input-label:hover {
  background: #f1f5f9;
  border-color: #2a78ff;
  border-style: solid;
}

.file-input-label:active {
  transform: scale(0.98);
}

.file-input-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.file-input-text {
  color: #475569;
  font-weight: 500;
  flex: 1;
}

.file-input-name {
  color: #2a78ff;
  font-weight: 600;
  font-size: 14px;
  display: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.file-input-name.has-file {
  display: block;
}

.file-upload-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.file-upload-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: start;
}

/* Wrapper pour le champ personnalisé */
.custom-file-wrapper {
  position: relative;
  width: 100%;
  display: block;
}

/* Masquer l'input file natif mais le garder fonctionnel - couvre exactement le label */
.custom-file-wrapper input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 48px;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  font-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
  box-sizing: border-box;
}

/* Label personnalisé avec bordures pointillées */
.custom-file-label {
  display: block;
  padding: 10px 14px;
  background: #fff;
  border: 2px dashed #3DA6DB;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  color: #3DA6DB;
  text-align: center;
  font-weight: 500;
  position: relative;
  z-index: 0;
  width: 100%;
  box-sizing: border-box;
}

.custom-file-label:hover {
  background: #f0f9ff;
  border-color: #2a8bc4;
}

.custom-file-label:active {
  transform: scale(0.98);
}

/* Texte du nom de fichier en dessous */
.custom-file-name {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
  text-align: center;
  min-height: 16px;
  position: relative;
  z-index: 0;
}

.custom-file-name.has-file {
  color: #3DA6DB;
  font-weight: 500;
}

.file-preview {
  margin-top: 0;
  display: block;
}

.file-preview .preview-container {
  display: block;
  width: 100%;
  max-width: 100%;
}

.file-error {
  margin-top: 8px;
  padding: 10px 12px;
  background: #fff5f5;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

.preview-container {
  position: relative;
  display: block;
  max-width: 100%;
  width: 100%;
}

.preview-image {
  max-width: 100%;
  max-height: 150px;
  border-radius: 8px;
  border: 1px solid #d7e6ff;
  display: block;
}

.preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: background 0.2s;
}

.preview-remove:hover {
  background: #dc2626;
}

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

.label-medium {
  font-weight: 500;
}

.domaine-wrapper {
  display: flex;
  flex-direction: column;
}

.hint-box {
  background: #f4f7ff;
  border: 1px dashed #cfe0ff;
  padding: 10px;
  border-radius: 10px;
}

.actions-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.flex-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

@media (max-width: 768px) {
  .actions-row {
    justify-content: center;
  }
}