:root {
  --gold: #B8860B;
  --gold-light: #D4A44B;
  --gold-bg: rgba(184,134,11,0.06);
  --gold-border: rgba(184,134,11,0.2);
  --cyan: #0891B2;
  --cyan-light: #E0F7FA;
  --green: #16A34A;
  --green-bg: #F0FDF4;
  --red: #DC2626;
  --red-bg: #FEF2F2;
  --orange: #EA580C;
  --orange-bg: #FFF7ED;
  --bg: #F8F7F4;
  --white: #FFFFFF;
  --card: #FFFFFF;
  --border: #E8E4DE;
  --border-focus: var(--cyan);
  --text: #1C1917;
  --text2: #57534E;
  --text3: #A8A29E;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --font: -apple-system, 'SF Pro Display', 'Segoe UI', sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ─── HEADER ─── */
.app-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.app-header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-logo {
  height: 32px;
  width: auto;
}

.app-header-pro {
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--white);
  background: var(--gold);
  padding: 2px 8px;
  border-radius: 6px;
}

.sync-status {
  font-size: 0.6875rem;
  padding: 4px 12px;
  border-radius: 100px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sync-status.online { background: var(--green-bg); color: var(--green); }
.sync-status.offline { background: var(--red-bg); color: var(--red); }
.sync-status.syncing { background: var(--cyan-light); color: var(--cyan); }

/* ─── FORM ─── */
.form-container {
  max-width: 560px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

/* ─── FORM HERO ─── */
.form-hero {
  text-align: center;
  padding: 1.5rem 0 1rem;
}

.form-hero-logo {
  height: 90px;
  width: auto;
  margin-bottom: 0.625rem;
}

.form-hero-sub {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 0.875rem;
  box-shadow: var(--shadow-sm);
}

.form-section-title {
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 2px solid var(--gold-bg);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3125rem;
  margin-bottom: 0.75rem;
}

.field:last-child { margin-bottom: 0; }

.field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text2);
}

.field input,
.field select,
.field textarea {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.875rem;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  width: 100%;
  transition: all 0.2s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(8,145,178,0.1);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text3);
}

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

.field select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23B8860B' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* ─── TOGGLE (Pro/Particulier) ─── */
.toggle-group {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.toggle-group label {
  flex: 1;
  text-align: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

.toggle-group input { display: none; }

.toggle-group input:checked + label {
  background: var(--white);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ─── CHECK ROW + SWITCH ─── */
.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 0;
}

.check-row + .check-row {
  border-top: 1px solid var(--border);
}

.check-row label {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
}

/* Sous-champs conditionnels */
.sub-section {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
  padding: 0 0.75rem;
  margin: 0 -0.25rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.sub-section.open {
  max-height: 500px;
  opacity: 1;
  padding: 0.875rem 0.75rem;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
  display: block;
  cursor: pointer;
}

.switch input { display: none; }

.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.25s;
}

.switch-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background: var(--white);
  border-radius: 50%;
  transition: all 0.25s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.switch input:checked + .switch-slider {
  background: var(--gold-light);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(22px);
}

/* ─── SLIDER ─── */
.slider-field { margin-bottom: 0.75rem; }

.slider-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text2);
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.slider-field label span:last-child {
  color: var(--gold);
  font-weight: 700;
}

.slider-field input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  background: linear-gradient(90deg, var(--red) 0%, var(--orange) 50%, var(--green) 100%);
  border-radius: 4px;
  outline: none;
  border: none;
  padding: 0;
  opacity: 0.7;
}

.slider-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  background: var(--white);
  border: 3px solid var(--gold-light);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--text3);
  margin-top: 0.375rem;
  font-weight: 500;
}

/* Complexity slider (single color) */
.slider-field.complexity input[type="range"] {
  background: linear-gradient(90deg, var(--green) 0%, var(--orange) 50%, var(--red) 100%);
}

/* ─── PHOTO UPLOAD ─── */
.photo-upload { margin-bottom: 0.75rem; }

.photo-upload label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text2);
  display: block;
  margin-bottom: 0.375rem;
}

.photo-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
}

.photo-drop:hover,
.photo-drop.dragover {
  border-color: var(--gold-light);
  background: var(--gold-bg);
}

.photo-drop-icon { font-size: 1.5rem; }
.photo-drop-text {
  font-size: 0.8125rem;
  color: var(--text3);
  margin-top: 0.125rem;
}

.photo-drop input { display: none; }

.photo-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.photo-preview {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview .remove-photo {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 0.8125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

/* ─── SUBMIT ─── */
.submit-btn {
  display: block;
  width: 100%;
  padding: 1rem;
  background: var(--gold);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0.25rem;
  margin-bottom: 2rem;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(184,134,11,0.25);
  letter-spacing: -0.01em;
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.submit-btn:hover:not(:disabled) {
  background: #9A7209;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(184,134,11,0.3);
}

.submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

/* ─── TOAST ─── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease;
  z-index: 100;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error { border-color: var(--red); color: var(--red); }

/* ─── CONDITIONAL ─── */
.hidden { display: none !important; }

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}
