/* ==========================================
   FACTBTP.PRO — Styles Générateur
   W2K-Digital 2025
   ========================================== */

/* ==========================================
   BARRE DE PROGRESSION
   ========================================== */
.progress-bar__track {
  height: 4px;
  background-color: var(--border);
  border-radius: 2px;
  margin-top: var(--space-2);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ==========================================
   GRILLE FORMULAIRE
   ========================================== */
.gen-form {
  background-color: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.gen-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

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

.required {
  color: var(--error);
  margin-left: 2px;
}

.optional {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 400;
}

/* ==========================================
   GRILLE TEMPLATES (étape 2)
   ========================================== */
.gen-templates__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.gen-template-card {
  border: 2.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.gen-template-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.gen-template-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249,115,22,.2);
}

.gen-template-card.is-selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background-color: var(--primary);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gen-template-card__img {
  aspect-ratio: 3/4;
  background-color: var(--background-alt);
  overflow: hidden;
}

.gen-template-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gen-template-card__name {
  padding: 6px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================
   TABLEAU PRESTATIONS (étape 5)
   ========================================== */
.gen-meta {
  margin-bottom: var(--space-4);
}

.prestations-table {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.prestations-table__header {
  display: grid;
  grid-template-columns: 3fr 0.8fr 0.8fr 1.2fr 1.2fr 40px;
  gap: var(--space-2);
  padding: 10px var(--space-2);
  background-color: var(--secondary);
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.prestation-ligne {
  display: grid;
  grid-template-columns: 3fr 0.8fr 0.8fr 1.2fr 1.2fr 40px;
  gap: var(--space-2);
  padding: 8px var(--space-2);
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition);
}

.prestation-ligne:last-child {
  border-bottom: none;
}

.prestation-ligne:hover {
  background-color: var(--background-alt);
}

.prestation-ligne input,
.prestation-ligne select {
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  width: 100%;
  transition: border-color var(--transition);
}

.prestation-ligne input:focus,
.prestation-ligne select:focus {
  outline: none;
  border-color: var(--primary);
}

.prestation-ligne input[type="number"] {
  text-align: right;
}

.prestation-ligne__total {
  font-weight: 600;
  color: var(--secondary);
  font-size: 0.9rem;
  text-align: right;
}

.btn-suppr-ligne {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: rgba(239,68,68,.1);
  color: var(--error);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
}

.btn-suppr-ligne:hover {
  background-color: var(--error);
  color: var(--white);
}

.btn-add-ligne {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px var(--space-3);
  border: 1.5px dashed var(--primary);
  border-radius: var(--radius-md);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  background: none;
  transition: all var(--transition);
  margin-bottom: var(--space-4);
}

.btn-add-ligne:hover {
  background-color: rgba(249,115,22,.06);
}

/* Totaux */
.prestations-totaux {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: var(--space-4);
}

.totaux-table {
  min-width: 300px;
  background-color: var(--background-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.totaux-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px var(--space-3);
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.totaux-row:last-child {
  border-bottom: none;
}

.totaux-row--total {
  background-color: var(--secondary);
  color: var(--white);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.05rem;
}

/* Toggle TVA */
.tva-toggle {
  display: flex;
  align-items: center;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.toggle-label input {
  display: none;
}

.toggle-switch {
  width: 44px;
  height: 24px;
  background-color: var(--border);
  border-radius: 12px;
  position: relative;
  transition: background-color var(--transition);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background-color: white;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle-label input:checked + .toggle-switch {
  background-color: var(--accent);
}

.toggle-label input:checked + .toggle-switch::after {
  transform: translateX(20px);
}

/* ==========================================
   PERSONNALISATION (étape 6)
   ========================================== */
.gen-personnalisation {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.perso-section {
  background-color: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.perso-section__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background-color: var(--background-alt);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 600;
  color: var(--secondary);
}

.perso-section__icon {
  font-size: 1.2rem;
}

.perso-section__body {
  padding: var(--space-4);
}

.perso-section__hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

/* Options logo */
.logo-options {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.logo-option {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  flex: 1;
  min-width: 160px;
}

.logo-option:has(input:checked) {
  border-color: var(--primary);
  background-color: rgba(249,115,22,.05);
}

.logo-option input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.logo-option__label strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.logo-option__label small {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Zone upload */
.upload-zone {
  position: relative;
}

.upload-zone__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.upload-zone__content {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-4);
  text-align: center;
  transition: all var(--transition);
  position: relative;
  z-index: 0;
}

.upload-zone__content:hover,
.upload-zone__content.dragover {
  border-color: var(--primary);
  background-color: rgba(249,115,22,.04);
}

.upload-zone__icon {
  font-size: 2rem;
  display: block;
  margin-bottom: var(--space-1);
}

.upload-zone__content p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.upload-zone__content strong {
  color: var(--primary);
}

.upload-zone__content small {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 4px;
}

/* Prévisualisation fichier uploadé */
.upload-zone__preview {
  position: relative;
  display: inline-block;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.upload-zone__preview img {
  max-height: 80px;
  max-width: 200px;
  object-fit: contain;
}

.upload-zone__remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--error);
  color: white;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
}

/* Tampon grid */
.tampon-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-2);
}

.tampon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: var(--space-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  text-align: center;
}

.tampon-card:hover,
.tampon-card.is-selected {
  border-color: var(--primary);
  background-color: rgba(249,115,22,.04);
}

.tampon-card.is-selected {
  box-shadow: 0 0 0 2px rgba(249,115,22,.25);
}

.tampon-card span:last-child {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Aperçus tampons */
.tampon-preview {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  position: relative;
}

.tp-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  padding: 6px;
  width: 100%;
  max-width: 64px;
  box-sizing: border-box;
}

.tp-nom {
  font-size: 0.48rem;
  font-weight: 700;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.2;
  max-width: 100%;
  display: block;
}
.tp-ville {
  font-size: 0.4rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.tampon-preview--rond-bleu {
  border: 3px solid #1E3A5F;
  border-radius: 50%;
  color: #1E3A5F;
  overflow: hidden;
}
.tampon-preview--carre-orange {
  border: 3px solid var(--primary);
  color: var(--primary);
}
.tampon-preview--oval-rouge {
  border: 3px solid #DC2626;
  border-radius: 50%;
  color: #DC2626;
  transform: scaleX(1.3);
}
.tampon-preview--oval-rouge .tp-inner {
  transform: scaleX(0.77);
}
.tampon-preview--diamant-vert {
  border: 3px solid var(--accent);
  color: var(--accent);
  transform: rotate(45deg);
}
.tampon-preview--diamant-vert .tp-inner {
  transform: rotate(-45deg);
}
.tampon-preview--hexagone-marine {
  background-color: #1E3A5F;
  color: white;
  clip-path: polygon(50% 0%,100% 25%,100% 75%,50% 100%,0% 75%,0% 25%);
}
.tampon-preview--double-cercle {
  border: 2px solid #1E3A5F;
  border-radius: 50%;
  color: #1E3A5F;
  box-shadow: inset 0 0 0 6px rgba(30,58,95,.15);
  overflow: hidden;
}
.tampon-preview--rectangle-noir {
  border: 3px solid #1E293B;
  color: #1E293B;
  border-radius: 2px;
}
.tampon-preview--sceau-or {
  border: 3px solid #D97706;
  border-radius: 50%;
  color: #D97706;
  box-shadow: 0 0 0 2px #D97706;
  overflow: hidden;
}
.tampon-preview--badge-premium {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 50%;
  color: white;
  overflow: hidden;
}
.tampon-preview--rectangle-btp {
  border: 3px solid #1E3A5F;
  color: #1E3A5F;
  border-radius: 4px;
}
.tampon-preview--rectangle-rouge {
  border: 3px solid #DC2626;
  color: #DC2626;
  border-radius: 4px;
}
.tampon-preview--none {
  border: 2px dashed var(--border);
  color: var(--text-secondary);
  border-radius: 50%;
  font-size: 1.5rem;
}

/* Signature */
.signature-options {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.signature-btn {
  padding: 10px var(--space-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  background: none;
}

.signature-btn--active,
.signature-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: rgba(249,115,22,.05);
}

/* Canvas signature */
.signature-draw {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

#signatureCanvas {
  display: block;
  width: 100%;
  background-color: #FAFAFA;
  cursor: crosshair;
  touch-action: none;
}

.signature-draw__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) var(--space-2);
  background-color: var(--background-alt);
  border-top: 1px solid var(--border);
}

.signature-draw__hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ==========================================
   APERÇU DOCUMENT (étape 7)
   ========================================== */
.apercu-container {
  max-width: 860px;
  margin: 0 auto;
}

.apercu-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.apercu-controls__info {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.apercu-wrapper {
  background-color: #9CA3AF;
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow: auto;
  max-height: 700px;
}

.apercu-document {
  background-color: var(--white);
  width: 794px;
  min-height: 1123px;
  margin: 0 auto;
  padding: 48px 56px;
  box-shadow: 0 4px 24px rgba(0,0,0,.25);
  border-radius: 2px;
  transform-origin: top center;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
}

.apercu-note {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: var(--space-2);
}

/* Structure interne du document aperçu */
.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 3px solid var(--primary);
}

.doc-logo { max-width: 160px; max-height: 80px; }
.doc-titre { font-size: 24px; font-weight: 700; color: var(--secondary); }
.doc-num { font-size: 11px; color: var(--text-secondary); }

.doc-infos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.doc-infos__bloc h4 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--primary);
  margin-bottom: 6px;
}

.doc-infos__bloc p {
  font-size: 11px;
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 11px;
}

.doc-table th {
  background-color: var(--secondary);
  color: white;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
}

.doc-table th:last-child,
.doc-table td:last-child { text-align: right; }

.doc-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
}

.doc-table tr:nth-child(even) td {
  background-color: var(--background-alt);
}

.doc-totaux {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
}

.doc-totaux__inner {
  min-width: 240px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  font-size: 11px;
}

.doc-totaux__row {
  display: flex;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
}

.doc-totaux__row:last-child {
  background-color: var(--secondary);
  color: white;
  font-weight: 700;
  border-bottom: none;
  font-size: 12px;
}

.doc-footer-doc {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-secondary);
}

.doc-signature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.doc-signature img {
  max-height: 60px;
  max-width: 120px;
  object-fit: contain;
}

.doc-tampon {
  max-height: 80px;
  max-width: 80px;
}

.doc-notes {
  background-color: var(--background-alt);
  border-left: 3px solid var(--primary);
  padding: 10px 14px;
  margin-bottom: 24px;
  font-size: 10px;
  color: var(--text-secondary);
  border-radius: 0 4px 4px 0;
}

/* ==========================================
   PAIEMENT (étape 8)
   ========================================== */
.paiement-container {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.paiement-recap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background-color: var(--background-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
}

.paiement-recap__icon {
  font-size: 2rem;
}

.paiement-recap__info {
  flex: 1;
}

.paiement-recap__info strong {
  display: block;
  font-weight: 600;
  color: var(--secondary);
}

.paiement-recap__info span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.paiement-recap__montant {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
}

.paiement-methodes__title {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: var(--space-2);
}

.methodes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.methode-card input {
  display: none;
}

.methode-card__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--space-2) var(--space-1);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  min-height: 88px;
}

.methode-card:has(input:checked) .methode-card__inner {
  border-color: var(--primary);
  background-color: rgba(249,115,22,.05);
  box-shadow: 0 0 0 2px rgba(249,115,22,.15);
}

.methode-card__inner img {
  max-height: 36px;
  width: auto;
  object-fit: contain;
}

.methode-card__inner span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.methode-card__logos-cb {
  display: flex;
  gap: 6px;
  align-items: center;
}

.paiement-securite {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
}

.paiement-action {
  text-align: center;
}

.paiement-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Spinner chargement */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ==========================================
   TÉLÉCHARGEMENT (étape 9)
   ========================================== */
.telechargement-container {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.telechargement-success__icon {
  font-size: 4rem;
  margin-bottom: var(--space-2);
}

.telechargement-success__title {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.telechargement-success__text {
  font-size: 1.05rem;
  color: var(--text-secondary);
}

.telechargement-recap {
  background-color: var(--background-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: left;
}

.telechargement-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: center;
}

.telechargement-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ==========================================
   FOOTER SIMPLIFIÉ (page générateur)
   ========================================== */
.footer--simple {
  padding: var(--space-3) 0;
  background-color: #0d1b2e;
}

/* ==========================================
   RESPONSIVE — TABLETTE
   ========================================== */
@media (max-width: 1024px) {

  .gen-templates__grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .tampon-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .methodes-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .apercu-document {
    width: 100%;
    min-height: auto;
    padding: 24px 28px;
    font-size: 11px;
  }
}

/* ==========================================
   RESPONSIVE — MOBILE
   ========================================== */
@media (max-width: 768px) {

  .gen-form__grid {
    grid-template-columns: 1fr;
  }

  .gen-templates__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .prestations-table__header {
    display: none;
  }

  .prestation-ligne {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: var(--space-1);
    padding: var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-1);
  }

  .col-desc { grid-column: 1 / -1; }

  .prestations-totaux {
    flex-direction: column;
    align-items: stretch;
  }

  .totaux-table {
    min-width: 0;
    width: 100%;
  }

  .tampon-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .methodes-grid {
    grid-template-columns: 1fr 1fr;
  }

  .logo-options {
    flex-direction: column;
  }

  .apercu-wrapper {
    padding: var(--space-2);
  }

  .apercu-document {
    padding: 16px 18px;
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .tampon-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .methodes-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   SÉLECTION PRINCIPALE (page d'accueil générateur)
   ========================================== */
.gen-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
  padding: var(--space-8) 0;
  max-width: 960px;
  margin: 0 auto;
}

.gen-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.gen-card:hover, .gen-card:focus {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(30,58,95,.12);
  transform: translateY(-2px);
  outline: none;
}
.gen-card__icon { font-size: 2.4rem; flex-shrink: 0; }
.gen-card__content { flex: 1; }
.gen-card__content h3 { margin: 0 0 4px; font-size: 1.05rem; color: var(--primary); }
.gen-card__content p  { margin: 0 0 8px; font-size: .85rem; color: var(--text-secondary); }
.gen-card__prix { display: inline-block; font-size: .8rem; font-weight: 700; background: var(--primary); color: #fff; padding: 2px 10px; border-radius: 20px; }
.gen-card__prix--free { background: #16a34a; }
.gen-card__arrow { font-size: 1.4rem; color: var(--border); transition: color 0.2s; }
.gen-card:hover .gen-card__arrow { color: var(--primary); }
.gen-selection-note { text-align: center; color: var(--text-secondary); font-size: .85rem; padding-bottom: var(--space-8); }

/* ==========================================
   GÉNÉRATEUR — LAYOUT 2 COLONNES
   ========================================== */
.gd-wrap { max-width: 1280px; margin: 0 auto; padding: var(--space-6) var(--space-4); }

.gd-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.gd-back {
  font-size: .9rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.gd-back:hover { border-color: var(--primary); color: var(--primary); }
.gd-title { margin: 0; font-size: 1.5rem; color: var(--primary); flex: 1; }
.gd-badge {
  font-size: .75rem; font-weight: 700;
  background: var(--primary); color: #fff;
  padding: 4px 12px; border-radius: 20px;
  white-space: nowrap;
}
.gd-badge--free { background: #16a34a; }

.gd-body {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: var(--space-6);
  align-items: start;
}

/* FORMULAIRE */
.gd-form { display: flex; flex-direction: column; gap: var(--space-4); }

.gd-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.gd-section__title {
  font-size: 1rem; font-weight: 600; color: var(--primary);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-light);
  user-select: none;
}
.gd-section__title::after { content: '▾'; font-size: .9rem; color: var(--text-secondary); transition: transform .2s; }
.gd-section[open] .gd-section__title::after { transform: rotate(180deg); }
.gd-section__body { padding: var(--space-5); }

.gd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.gd-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
.gd-field { display: flex; flex-direction: column; gap: 4px; }
.gd-field--full { grid-column: 1 / -1; }
.gd-field label { font-size: .85rem; font-weight: 600; color: var(--text-primary); }
.gd-field input, .gd-field select, .gd-field textarea {
  padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: .9rem;
  font-family: inherit; transition: border-color .2s;
  background: var(--white);
}
.gd-field input:focus, .gd-field select:focus, .gd-field textarea:focus {
  outline: none; border-color: var(--primary);
}
.gd-field small { font-size: .75rem; color: var(--text-secondary); }
.req { color: var(--error, #EF4444); }

/* TABLEAU PRESTATIONS */
.gd-table-head {
  display: grid;
  grid-template-columns: 1fr 60px 70px 100px 100px 36px;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-light);
  border-radius: var(--radius);
  font-size: .78rem; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 6px;
}
.gd-ligne {
  display: grid;
  grid-template-columns: 1fr 60px 70px 100px 100px 36px;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.gd-ligne input, .gd-ligne select {
  padding: 7px 8px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: .85rem; font-family: inherit;
  transition: border-color .2s;
}
.gd-ligne input:focus, .gd-ligne select:focus { outline: none; border-color: var(--primary); }
.gl-total { font-size: .85rem; font-weight: 600; color: var(--primary); text-align: right; }
.gl-suppr {
  width: 32px; height: 32px; border: 1px solid var(--border);
  border-radius: var(--radius); background: none; cursor: pointer;
  font-size: 1.1rem; color: #EF4444; transition: background .2s;
}
.gl-suppr:hover { background: #FEF2F2; }
.gd-btn-add {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 1.5px dashed var(--border);
  border-radius: var(--radius); background: none; cursor: pointer;
  font-size: .85rem; color: var(--primary); transition: border-color .2s, background .2s;
  margin-top: var(--space-2);
}
.gd-btn-add:hover { border-color: var(--primary); background: var(--bg-light); }

.gd-totaux { margin-top: var(--space-4); }
.gd-totaux__row {
  display: flex; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.gd-totaux__row--total { font-weight: 700; color: var(--primary); font-size: 1rem; border-bottom: none; }
.gd-toggle { display: flex; align-items: center; gap: 8px; margin-top: var(--space-3); font-size: .85rem; cursor: pointer; }
.gd-toggle input { display: none; }
.gd-toggle__sw {
  width: 40px; height: 22px; background: var(--border); border-radius: 11px;
  position: relative; transition: background .2s; flex-shrink: 0;
}
.gd-toggle__sw::after {
  content: ''; position: absolute; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; top: 3px; left: 3px;
  transition: left .2s;
}
.gd-toggle input:checked ~ .gd-toggle__sw { background: var(--primary); }
.gd-toggle input:checked ~ .gd-toggle__sw::after { left: 21px; }

/* PERSONNALISATION */
.gd-perso-group { margin-bottom: var(--space-5); }
.gd-perso-label { font-size: .9rem; font-weight: 600; color: var(--primary); margin: 0 0 10px; }
.gd-logo-opts { display: flex; flex-direction: column; gap: 8px; margin-bottom: var(--space-3); }
.gd-logo-opt { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
.gd-drop {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: var(--space-4); text-align: center;
  cursor: pointer; position: relative; transition: border-color .2s;
}
.gd-drop:hover, .gd-drop.dragover { border-color: var(--primary); background: var(--bg-light); }
.gd-drop p { margin: 0; font-size: .85rem; color: var(--text-secondary); }
.gd-drop__input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.gd-tampon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: var(--space-2);
}
.gd-sig-opts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: var(--space-3); }
.gd-sig-btn {
  padding: 7px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius); background: none; cursor: pointer;
  font-size: .82rem; transition: border-color .2s, background .2s;
}
.gd-sig-btn--active { border-color: var(--primary); background: var(--bg-light); color: var(--primary); font-weight: 600; }
#g-canvas {
  width: 100%; border: 1.5px solid var(--border);
  border-radius: var(--radius); cursor: crosshair; touch-action: none;
}
.gd-btn-sm {
  padding: 5px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: none; cursor: pointer;
  font-size: .8rem; transition: border-color .2s;
}
.gd-btn-sm:hover { border-color: var(--primary); color: var(--primary); }

/* PAIEMENT */
.gd-paiement {
  background: var(--white);
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-top: var(--space-4);
}
.gd-paiement__title { margin: 0 0 var(--space-1); color: var(--primary); font-size: 1.1rem; }
.gd-paiement__prix  { margin: 0 0 var(--space-4); color: var(--text-secondary); font-size: .9rem; }
.gd-methodes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-2);
  margin: var(--space-4) 0;
}
.gd-methode { cursor: pointer; }
.gd-methode input { display: none; }
.gd-methode__inner {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: .78rem; text-align: center;
  transition: border-color .2s, background .2s;
}
.gd-methode input:checked + .gd-methode__inner {
  border-color: var(--primary); background: var(--bg-light);
}
.gd-btn-pay {
  display: block; width: 100%;
  padding: 14px; background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius); font-size: 1rem;
  font-weight: 700; cursor: pointer; transition: background .2s;
  font-family: inherit;
}
.gd-btn-pay:hover { background: var(--primary-dark); }
.gd-btn-outline {
  display: block; width: 100%; margin-top: var(--space-2);
  padding: 12px; background: none; color: var(--primary);
  border: 2px solid var(--primary); border-radius: var(--radius);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: background .2s; font-family: inherit;
}
.gd-btn-outline:hover { background: var(--bg-light); }
.gd-loader { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); font-size: .9rem; margin-top: var(--space-2); }
.gd-err { color: #EF4444; font-size: .85rem; margin: var(--space-2) 0 0; }

/* SUCCÈS */
.gd-success {
  background: #F0FDF4; border: 2px solid #16a34a;
  border-radius: var(--radius-lg); padding: var(--space-6);
  text-align: center; margin-top: var(--space-4);
}
.gd-success__icon { font-size: 3rem; margin-bottom: var(--space-2); }
.gd-success h3 { margin: 0 0 var(--space-1); color: #15803d; }
.gd-success p  { margin: 0 0 var(--space-4); color: var(--text-secondary); }

/* APERÇU */
.gd-preview { position: relative; }
.gd-preview__sticky {
  position: sticky;
  top: 100px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.gd-preview__label {
  padding: 12px 16px; margin: 0;
  background: var(--bg-light); border-bottom: 1px solid var(--border);
  font-size: .82rem; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .05em;
}
.gd-preview-doc {
  padding: 20px;
  font-size: 11px;
  line-height: 1.5;
  overflow: auto;
  max-height: 70vh;
}
.gd-preview-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-10); color: var(--text-secondary); text-align: center;
}
.gd-preview-placeholder span { font-size: 3rem; margin-bottom: var(--space-2); }
.gd-preview-placeholder p { margin: 0; font-size: .9rem; }

/* STYLES SÉLECTION LOGO/TAMPON */
.gd-style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--space-2);
}
.gd-style-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px; border: 1.5px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  transition: border-color .2s; font-size: .75rem; text-align: center;
}
.gd-style-card:hover, .gd-style-card.is-selected { border-color: var(--primary); }
.gd-style-card.is-selected { background: var(--bg-light); }
.gd-style-preview {
  width: 72px; height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 6px; gap: 2px;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .gd-body { grid-template-columns: 1fr; }
  .gd-preview { order: -1; }
  .gd-preview__sticky { position: static; }
  .gd-preview-doc { max-height: 50vw; }
  .gd-grid--3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .gd-grid { grid-template-columns: 1fr; }
  .gd-grid--3 { grid-template-columns: 1fr; }
  .gd-table-head { display: none; }
  .gd-ligne { grid-template-columns: 1fr 50px 50px 80px; }
  .gd-ligne .gl-unit, .gd-ligne .gl-total { display: none; }
  .gd-methodes { grid-template-columns: 1fr 1fr; }
  .gen-selection-grid { grid-template-columns: 1fr; }
  .tmpl-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================
   GALERIE DE SÉLECTION DES TEMPLATES
   ========================================== */
.tmpl-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
}

.tmpl-card {
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.2s ease;
  outline: none;
}

.tmpl-card:hover,
.tmpl-card:focus {
  border-color: var(--primary);
  box-shadow: 0 6px 24px rgba(30,58,95,0.18);
  transform: translateY(-3px);
}

.tmpl-card__img-wrap {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: #f3f4f6;
}

.tmpl-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.tmpl-card:hover .tmpl-card__img-wrap img {
  transform: scale(1.04);
}

.tmpl-card__overlay {
  position: absolute;
  inset: 0;
  background: rgba(30,58,95,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tmpl-card:hover .tmpl-card__overlay,
.tmpl-card:focus .tmpl-card__overlay {
  opacity: 1;
}

.tmpl-card__btn {
  background: var(--primary-accent, #F5A623);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.tmpl-card__nom {
  padding: 8px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-primary, #1E3A5F);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bouton "Changer" dans le header */
.gd-badge--btn {
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-size: 0.8rem;
  padding: 5px 14px;
  transition: opacity 0.2s;
}

.gd-badge--btn:hover { opacity: 0.85; }

@media (max-width: 1024px) {
  .tmpl-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
  .tmpl-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 500px) {
  .tmpl-grid { grid-template-columns: repeat(2, 1fr); }
}
