/* ============================================================
   MON ENSEIGNE — Configurateur de visuels
   Style moderne, responsive, mobile-first
   ============================================================ */

:root {
  --primary: #1e3a8a;
  --primary-dark: #172554;
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* HEADER */
.app-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.logo span { color: var(--accent); font-weight: 400; }
.header-steps { display: flex; gap: 8px; }
.step {
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.15);
  font-size: 13px;
  font-weight: 600;
}
.step.active { background: var(--accent); color: var(--primary-dark); }

/* MAIN */
.app-main {
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* PANNEAU CONFIG */
.config-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.config-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.config-section h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* INPUTS */
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
  background: white;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
}
.select-lg { font-size: 16px; font-weight: 600; padding: 12px 14px; }
.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 10px 0 4px;
}
.product-desc { font-size: 13px; color: var(--text-light); margin-top: 8px; }
.quality-note {
  font-size: 12px;
  color: var(--text-light);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 8px;
}

/* DIMENSIONS DIBON */
.size-row { display: flex; gap: 12px; }
.size-row > div { flex: 1; }
.size-label { font-size: 12px; color: var(--text-light); display: block; margin-bottom: 4px; }
.warning-note {
  font-size: 12px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 8px;
  color: #92400e;
}

/* TEMPLATES */
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.template-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}
.template-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.template-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.template-preview { height: 60px; }
.template-name {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  padding: 6px 4px;
}

/* FICHIER LOGO */
.file-input {
  padding: 8px;
  font-size: 13px;
  background: #f9fafb;
}

/* COULEURS PERSONNALISÉES */
.color-row { display: flex; gap: 12px; margin-bottom: 8px; }
.color-item { flex: 1; text-align: center; }
.color-input {
  width: 100%;
  height: 44px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
  background: white;
}
.color-hint { font-size: 12px; color: var(--text-light); margin-top: 8px; }

/* PRIX */
.price-section { border-top: 3px solid var(--accent); }
.price-display {
  font-size: 34px;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
}
.price-detail {
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
  margin: 4px 0 16px;
}
.btn-validate {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}
.btn-validate:hover { transform: translateY(-2px); }
.btn-export {
  width: 100%;
  padding: 10px;
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s;
}
.btn-export:hover { background: var(--primary); color: white; }

/* RÉCAP */
.order-recap, .export-summary {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 16px;
  font-size: 14px;
}
.order-recap h3, .export-summary h3 { color: #166534; margin-bottom: 8px; font-size: 15px; }
.order-recap p, .export-summary p { margin: 4px 0; }
.note { font-size: 12px; color: var(--text-light); margin-top: 8px; }

/* APERÇU */
.preview-panel {
  position: sticky;
  top: 80px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.preview-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
  text-align: center;
}
.preview-status {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  background: #dcfce7;
  color: #166534;
  border-radius: 20px;
  padding: 4px 12px;
  margin: 0 auto 12px;
  display: inline-block;
  width: auto;
}
.preview-title-wrap { text-align: center; }
.canvas-wrap {
  display: flex;
  justify-content: center;
}
#preview-canvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.preview-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 12px;
}
.gabarit-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding: 10px 14px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-light);
}
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-red { background: rgba(239, 68, 68, 0.5); border: 1.5px dashed #dc2626; }
.legend-green { background: rgba(16, 185, 129, 0.3); border: 1.5px dashed #10b981; }

/* BOUTON GABARIT */
.gabarit-toggle-wrap { text-align: center; margin-bottom: 10px; }
.gabarit-toggle {
  background: white;
  border: 2px solid var(--primary);
  color: var(--primary);
  padding: 8px 18px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.gabarit-toggle:hover { background: var(--primary); color: white; }
.gabarit-toggle.active { background: var(--primary); color: white; }

/* AVERTISSEMENT TEXTE LONG */
.text-warning {
  font-size: 12px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 4px;
  color: #92400e;
}

/* TEXTES SUPPLÉMENTAIRES */
.btn-add {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-add:hover { opacity: 0.9; }
.extra-text-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}
.extra-text-row .input { flex: 1; }
.extra-pos { flex: 0 0 90px; }
.btn-remove {
  flex: 0 0 32px;
  height: 36px;
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.btn-remove:hover { background: #fecaca; }

/* GALERIE BADGES */
.badge-count {
  background: var(--primary);
  color: white;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  margin-left: 6px;
}
.badge-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.badge-card svg {
  width: 28px;
  height: 28px;
}
.badge-card .badge-label {
  font-size: 10px;
  color: var(--text-light);
  line-height: 1.2;
}
.badge-card:hover { border-color: var(--primary); }
.badge-card.active {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}
.badge-card.active .badge-label { color: var(--primary); font-weight: 600; }

/* FOOTER */
.app-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-light);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .app-main { grid-template-columns: 1fr; }
  .preview-panel { position: static; order: -1; }
  .template-grid { grid-template-columns: repeat(2, 1fr); }
  .header-steps { display: none; }
}
