* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  color: #172033;
}

header {
  background: #111827;
  color: white;
  padding: 22px;
}

.header-inner {
  max-width: 1150px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

header h1 { margin: 0; font-size: 28px; }
header p { margin: 6px 0 0; color: #cbd5e1; }

.stats {
  background: #1f2937;
  border-radius: 12px;
  padding: 10px 16px;
  text-align: center;
}

.stats-number { display: block; font-size: 24px; font-weight: bold; }
.stats-label { font-size: 12px; color: #cbd5e1; }

.container { max-width: 1150px; margin: 30px auto; padding: 0 18px; }

.card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, .06);
}

h2 { margin-top: 0; }

.dropzone {
  display: block;
  border: 2px dashed #94a3b8;
  border-radius: 14px;
  padding: 35px;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
}

.dropzone:hover, .dropzone.dragover { border-color: #2563eb; background: #eff6ff; }

#preview { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.preview-wrapper { position: relative; }

.preview {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #ddd;
}

.remove-photo {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  background: #dc2626;
  color: white;
  font-size: 16px;
}

label.field { display: block; margin-top: 18px; margin-bottom: 7px; font-weight: bold; }

input, textarea, select {
  width: 100%;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font-size: 15px;
  font-family: inherit;
}

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

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
}

button:disabled { opacity: .55; cursor: not-allowed; }

.primary {
  background: #2563eb;
  color: white;
  width: 100%;
  margin-top: 22px;
  font-size: 16px;
  padding: 14px;
}

.primary:hover:not(:disabled) { background: #1d4ed8; }

.secondary { background: #e2e8f0; }

.platform {
  margin-top: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px;
}

.platform h3 { margin-top: 0; }
.result-title { font-weight: bold; font-size: 18px; margin-bottom: 10px; }
.result-description { white-space: pre-wrap; line-height: 1.5; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.copy { background: #e2e8f0; }
.edit { background: #fef3c7; }
.regenerate { background: #dbeafe; }
.prepare { background: #dcfce7; color: #166534; }
.prepare:hover:not(:disabled) { background: #bbf7d0; }

#status { margin-top: 15px; text-align: center; font-weight: bold; }
.success { color: #15803d; }
.error { color: #dc2626; }
.loading { color: #2563eb; }

.edit-input, .edit-textarea { background: #fff; line-height: 1.5; }
.edit-input { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }
.edit-textarea { min-height: 180px; }

.edit-input:focus, .edit-textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.save { background: #16a34a; color: white; }
.cancel { background: #e5e7eb; color: #374151; }

.field-label {
  font-size: .78rem;
  font-weight: 700;
  color: #64748b;
  margin: 10px 0 5px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

#history-list { margin-top: 12px; }

.history-item {
  padding: 12px;
  margin-top: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.history-item .actions { margin-top: 8px; }
.danger { background: #fee2e2; color: #991b1b; }
.muted { color: #64748b; font-size: .9rem; }

@media (max-width: 700px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .stats { width: 100%; }
}

/* Copie champ par champ */
.field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 14px 0 6px;
}

.field-head .field-label { margin: 0; }

.copy-field {
  background: #e2e8f0;
  padding: 6px 10px;
  font-size: 13px;
}

.result-price { font-weight: bold; font-size: 18px; }

/* Message flottant */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  max-width: min(560px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  font-weight: bold;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 1000;
  cursor: pointer;
}

.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast.success { border-left: 6px solid #22c55e; }
.toast.error { border-left: 6px solid #ef4444; }
.toast.loading { border-left: 6px solid #3b82f6; }
