@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --background: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --error: #ef4444;
  --success: #10b981;
  --radius: 12px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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);
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  background-color: var(--background);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem 1rem;
}

.wrapper {
  width: 100%;
  max-width: 600px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
}

/* ── Header ── */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header-eyebrow {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

.header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--primary);
  margin-bottom: 8px;
}

.header p {
  font-size: 14px;
  color: var(--text-muted);
}

/* ── Fieldsets ── */
fieldset {
  border: none;
  background: var(--surface);
  margin-bottom: 2rem;
}

legend {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

legend .legend-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #eff6ff;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* ── Grid layouts ── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.full {
  grid-column: 1 / -1;
}

/* ── Fields ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="password"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: var(--surface);
  transition: all 0.2s ease;
  outline: none;
  -webkit-appearance: none;
  box-shadow: var(--shadow-sm);
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

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

/* ── Validation states ── */
.error-msg {
  font-size: 12px;
  color: var(--error);
  display: none;
  margin-top: 4px;
}

.field.has-error .error-msg {
  display: block;
}

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

.field.is-valid input,
.field.is-valid select,
.field.is-valid textarea {
  border-color: var(--success);
}

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* ── Radio & Checkbox pills ── */
.radio-group,
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.radio-pill input[type="radio"],
.check-pill input[type="checkbox"] {
  display: none;
}

.radio-pill label,
.check-pill label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s ease;
  background: var(--surface);
  user-select: none;
}

.radio-pill input:checked+label,
.check-pill input:checked+label {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.radio-pill label:hover,
.check-pill label:hover {
  border-color: var(--text-muted);
}

/* ── Photo upload ── */
.photo-upload {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  background: #f8fafc;
}

.photo-upload:hover {
  border-color: var(--accent);
  background: #eff6ff;
}

.photo-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

.upload-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 18px;
  box-shadow: var(--shadow-sm);
}

.photo-upload p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.photo-upload strong {
  color: var(--primary);
  font-weight: 500;
}

#photo-name {
  font-size: 12px;
  color: var(--success);
  margin-top: 8px;
  font-weight: 500;
}

/* ── Password toggle ── */
.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 40px;
}

.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px;
}

.toggle-pw:hover {
  color: var(--primary);
}

/* ── Password strength ── */
.strength-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-top: 8px;
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.strength-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── CGU row ── */
.cgu-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-top: 0.5rem;
}

.cgu-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}

.cgu-row span {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.cgu-row a {
  color: var(--accent);
  text-decoration: underline;
}

.cgu-row a:hover {
  text-decoration: none;
}

/* ── Submit button ── */
.submit-btn {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 1.5rem;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.submit-btn:hover {
  background: var(--primary-hover);
}

.submit-btn:active {
  transform: translateY(1px);
}

.submit-btn::after {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -10px;
  margin-left: -10px;
  animation: spin 0.6s linear infinite;
  opacity: 0;
  transition: opacity 0.2s;
}

.submit-btn.loading {
  color: transparent;
  pointer-events: none;
}

.submit-btn.loading::after {
  opacity: 1;
}

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

/* ── Success banner ── */
.success-banner {
  display: none;
  text-align: center;
  padding: 2rem;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  margin-top: 1rem;
}

.success-banner .check {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 12px;
}

.success-banner h2 {
  font-size: 1.5rem;
  color: #065f46;
  margin-bottom: 8px;
  font-weight: 600;
}

.success-banner p {
  font-size: 14px;
  color: #047857;
}

/* ── Bio counter ── */
.bio-counter {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

/* ── Spacing helpers ── */
.mt-1 {
  margin-top: 1rem;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .wrapper {
    padding: 1.5rem;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  body {
    padding: 0;
    background: var(--surface);
    align-items: flex-start;
  }
}