/* ══════════════════════════════════════════════════
   TUNNEL — style v13 (centré split)
══════════════════════════════════════════════════ */

:root {
  --tnl-accent:      #1abc9c;
  --tnl-accent-soft: rgba(26,188,156,.12);
  --tnl-gold:        #f4c542;
  --tnl-bg:          #0a0a0a;
  --tnl-card-l:      #131313;
  --tnl-card-r:      #0e0e0e;
  --tnl-border:      rgba(255,255,255,.07);
  --tnl-text:        #f0f0f0;
  --tnl-muted:       rgba(255,255,255,.38);
  --tnl-radius:      20px;
  --tnl-radius-sm:   10px;
}

/* ── Page ─────────────────────────────────────── */
.tunnel-page {
  min-height: calc(100vh - var(--header-height, 50px));
  background: var(--tnl-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 32px;
  font-family: var(--font-family-base, 'Inter', sans-serif);
  position: relative;
}

.tunnel-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 40%, rgba(26,188,156,.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Step header (dans le panneau gauche) ────── */
.tnl-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--tnl-border);
}

.tnl-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tnl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  transition: all .3s ease;
}

.tnl-dot--done   { background: rgba(26,188,156,.35); }
.tnl-dot--active { background: var(--tnl-accent); width: 24px; border-radius: 4px; }

.tnl-step-lbl {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--tnl-muted);
}

/* ── Card split ───────────────────────────────── */
.tnl-card {
  width: 100%;
  max-width: 980px;
  min-height: 560px;
  display: flex;
  border-radius: var(--tnl-radius);
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0,0,0,.6), 0 0 0 1px var(--tnl-border);
  position: relative;
  z-index: 1;
}

/* ── Gauche ───────────────────────────────────── */
.tnl-left {
  width: 430px;
  min-width: 360px;
  flex-shrink: 0;
  background: var(--tnl-card-l);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--tnl-border);
}

.tnl-left-body {
  flex: 1;
  padding: 30px 26px 14px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.06) transparent;
}

.tnl-title {
  font-family: var(--font-family-heading, 'Sora', sans-serif);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--tnl-text);
  margin: 0 0 4px;
  line-height: 1.25;
}

.tnl-sub {
  font-size: .78rem;
  color: var(--tnl-muted);
  margin: 0 0 20px;
}

.tnl-body { /* panels wrapper */ }

/* ── Grille produits ──────────────────────────── */
.tnl-pcard-g {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 16px;
}

.tnl-pcard {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--tnl-border);
  border-radius: var(--tnl-radius-sm);
  padding: 10px 5px;
  text-align: center;
  cursor: pointer;
  transition: all .17s ease;
}
.tnl-pcard:hover, .tnl-pcard.sel {
  border-color: var(--tnl-accent);
  background: var(--tnl-accent-soft);
}
.tnl-pcard-img {
  width: 48px; height: 48px;
  object-fit: contain;
  display: block;
  margin: 0 auto 5px;
  border-radius: 6px;
}
.tnl-pcard-name {
  font-size: .67rem;
  font-weight: 600;
  color: var(--tnl-muted);
}
.tnl-pcard.sel .tnl-pcard-name { color: var(--tnl-accent); }
.tnl-pcard-price {
  font-size: .62rem;
  font-weight: 700;
  color: var(--tnl-accent);
  margin-top: 2px;
}

/* ── Variantes ────────────────────────────────── */
.tnl-vblock {
  border-top: 1px solid var(--tnl-border);
  padding-top: 14px;
  margin-top: 4px;
  animation: tnlIn .2s ease both;
}

@keyframes tnlIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.tnl-section-lbl {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--tnl-muted);
  margin-bottom: 8px;
}

.tnl-color-name {
  font-size: .7rem;
  color: var(--tnl-muted);
  margin: 4px 0 10px;
  min-height: 1rem;
}

.tnl-swatch-row { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 4px; }
.tnl-sw {
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .15s;
  flex-shrink: 0;
}
.tnl-sw:hover, .tnl-sw.sel {
  border-color: var(--tnl-accent);
  transform: scale(1.12);
}
.tnl-sw.sel { box-shadow: 0 0 0 3px var(--tnl-card-l), 0 0 0 5px var(--tnl-accent); }
.tnl-sw.light { box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.tnl-sw.light.sel { box-shadow: inset 0 0 0 1px rgba(0,0,0,.2), 0 0 0 3px var(--tnl-card-l), 0 0 0 5px var(--tnl-accent); }

.tnl-size-row { display: flex; gap: 5px; flex-wrap: wrap; }
.tnl-sz {
  padding: 5px 11px;
  border-radius: var(--tnl-radius-sm);
  border: 1px solid var(--tnl-border);
  background: transparent;
  color: var(--tnl-muted);
  font-size: .72rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: all .14s;
}
.tnl-sz:hover, .tnl-sz.sel {
  border-color: var(--tnl-accent);
  color: var(--tnl-accent);
  background: var(--tnl-accent-soft);
}

.tnl-chip-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.tnl-chip {
  padding: .35em .8em;
  border-radius: 999px;
  border: 1px solid var(--tnl-border);
  background: transparent;
  color: var(--tnl-muted);
  font-size: .72rem; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: all .14s;
}
.tnl-chip:hover, .tnl-chip.sel {
  border-color: var(--tnl-accent);
  color: var(--tnl-accent);
  background: var(--tnl-accent-soft);
}

/* ── Select (> 5 options) ─────────────────────── */
.tnl-select {
  width: 100%;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--tnl-border);
  border-radius: var(--tnl-radius-sm);
  color: var(--tnl-text);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 500;
  padding: 10px 36px 10px 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color .15s;
  margin-bottom: 4px;
}
.tnl-select:hover { border-color: rgba(26,188,156,.4); }
.tnl-select:focus { outline: none; border-color: var(--tnl-accent); }
.tnl-select option { background: #1a1a1a; color: var(--tnl-text); }

/* ── Source (étape 2) ─────────────────────────── */
.tnl-src-stack { display: flex; flex-direction: column; gap: 7px; }
.tnl-src {
  border: 1px solid var(--tnl-border);
  border-radius: var(--tnl-radius-sm);
  padding: 13px 14px;
  cursor: pointer;
  display: flex; align-items: center; gap: 11px;
  transition: all .17s;
}
.tnl-src:hover, .tnl-src.sel { border-color: var(--tnl-accent); background: var(--tnl-accent-soft); }
.tnl-src-i { font-size: 1.3rem; flex-shrink: 0; }
.tnl-src-ttl { font-size: .85rem; font-weight: 700; color: var(--tnl-text); }
.tnl-src-sub { font-size: .72rem; color: var(--tnl-muted); margin-top: 1px; }
.tnl-badge {
  margin-left: auto; flex-shrink: 0;
  background: linear-gradient(135deg, #148556, #2bd879);
  color: #fff; font-size: .6rem; font-weight: 800;
  padding: .2em .6em; border-radius: 999px;
}

/* ── Upload (étape 3) ─────────────────────────── */
.tnl-upload-z {
  border: 2px dashed rgba(255,255,255,.09);
  border-radius: var(--tnl-radius-sm);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 12px;
}
.tnl-upload-z:hover { border-color: rgba(26,188,156,.35); background: rgba(26,188,156,.03); }
.tnl-upload-ico { font-size: 1.8rem; margin-bottom: 6px; }
.tnl-upload-ttl { font-size: .82rem; font-weight: 600; color: var(--tnl-text); }
.tnl-upload-link { color: var(--tnl-accent); }
.tnl-upload-hint { font-size: .68rem; color: var(--tnl-muted); margin-top: 3px; }

.tnl-use-mode { display: flex; gap: 5px; margin: 10px 0 14px; }
.tnl-mode-btn {
  flex: 1; padding: .55rem .7rem;
  border-radius: var(--tnl-radius-sm);
  border: 1px solid var(--tnl-border);
  background: transparent; color: var(--tnl-muted);
  font-size: .75rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: all .17s;
}
.tnl-mode-btn--active {
  border-color: var(--tnl-accent);
  color: var(--tnl-accent);
  background: var(--tnl-accent-soft);
}

.tnl-textarea {
  width: 100%;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--tnl-border);
  border-radius: var(--tnl-radius-sm);
  color: var(--tnl-text);
  font-family: inherit; font-size: .82rem;
  padding: .75rem .9rem; resize: none; height: 60px;
  transition: border-color .15s; box-sizing: border-box; margin-top: 6px;
}
.tnl-textarea:focus { outline: none; border-color: rgba(26,188,156,.4); }
.tnl-textarea::placeholder { color: rgba(255,255,255,.18); }

/* ── Génération (étape 4, panneau gauche) ─────── */
.tnl-gen-loader { text-align: center; padding: 16px 0 8px; animation: tnlIn .3s ease both; }
.tnl-gen-ico {
  font-size: 2.2rem; margin-bottom: 10px;
  animation: pulse 2s ease infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.tnl-gen-title { font-family: var(--font-family-heading,'Sora',sans-serif); font-size: 1rem; font-weight: 700; color: var(--tnl-text); margin-bottom: 5px; }
.tnl-gen-sub   { font-size: .76rem; color: var(--tnl-muted); margin-bottom: 16px; }
.tnl-gen-bar-w { width: 100%; height: 3px; background: rgba(255,255,255,.07); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.tnl-gen-bar   { height: 100%; background: linear-gradient(90deg,#148556,#2bd879); border-radius: 999px; width: 0%; transition: width .3s ease; }

.tnl-gen-result { text-align: center; animation: tnlIn .3s ease both; }
.tnl-gen-ok { font-size: 1rem; font-weight: 700; color: var(--tnl-text); margin-bottom: 8px; }
.tnl-gen-preview {
  width: 100px; height: 100px;
  border-radius: var(--tnl-radius-sm);
  overflow: hidden; margin: 0 auto 8px;
  border: 1px solid var(--tnl-border);
  background: rgba(255,255,255,.04);
}
.tnl-gen-preview img { width: 100%; height: 100%; object-fit: contain; }
.tnl-gen-tag { font-size: .75rem; color: var(--tnl-muted); margin-bottom: 10px; }
.tnl-regen-btn {
  background: transparent; border: 1px solid var(--tnl-border); color: var(--tnl-muted);
  border-radius: 999px; padding: .35em .9em; font-size: .75rem; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .14s;
}
.tnl-regen-btn:hover { color: var(--tnl-text); border-color: rgba(255,255,255,.2); }

/* ── Récap (étape 5) ──────────────────────────── */
.tnl-recap {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--tnl-border);
  border-radius: var(--tnl-radius-sm);
  overflow: hidden; margin-bottom: 12px;
  animation: tnlIn .25s ease both;
}
.tnl-recap-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .65rem 1rem; border-bottom: 1px solid var(--tnl-border); gap: .75rem;
}
.tnl-recap-row:last-child { border-bottom: none; }
.tnl-recap-k { font-size: .67rem; font-weight: 700; color: var(--tnl-muted); text-transform: uppercase; letter-spacing: .06em; }
.tnl-recap-v { font-size: .82rem; font-weight: 600; color: var(--tnl-text); text-align: right; }
.tnl-recap-total { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; background: var(--tnl-accent-soft); border-top: 1px solid rgba(26,188,156,.18); }
.tnl-recap-price { font-family: var(--font-family-heading,'Sora',sans-serif); font-size: 1.2rem; font-weight: 800; color: var(--tnl-accent); }
.tnl-trust { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 4px; }
.tnl-trust-item { font-size: .68rem; font-weight: 600; color: var(--tnl-muted); display: flex; align-items: center; gap: 4px; }
.tnl-trust-item i { color: var(--tnl-accent); font-size: .65rem; }

/* ── Footer gauche ────────────────────────────── */
.tnl-ft {
  padding: 14px 22px 20px;
  border-top: 1px solid var(--tnl-border);
  display: flex; gap: 7px;
}

.tnl-btn-main {
  flex: 2;
  background: linear-gradient(135deg, #148556, #2bd879);
  color: #fff; border: none; border-radius: 999px;
  padding: .8rem 1.1rem; font-size: .9rem; font-weight: 800;
  cursor: pointer; font-family: inherit;
  transition: box-shadow .2s, transform .15s;
}
.tnl-btn-main:hover { box-shadow: 0 10px 24px rgba(31,184,108,.38); transform: translateY(-1px); }
.tnl-btn-main:disabled { opacity: .35; cursor: not-allowed; transform: none; box-shadow: none; }

.tnl-btn-ghost {
  flex: 1;
  background: transparent;
  border: 1px solid var(--tnl-border); color: var(--tnl-muted); border-radius: 999px;
  padding: .8rem .9rem; font-size: .82rem; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .14s;
}
.tnl-btn-ghost:hover { color: var(--tnl-text); border-color: rgba(255,255,255,.2); }

.tnl-btn-secondary {
  flex: 1.2;
  background: var(--tnl-accent-soft);
  border: 1px solid rgba(26,188,156,.22); color: var(--tnl-accent); border-radius: 999px;
  padding: .8rem .9rem; font-size: .8rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: all .14s;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.tnl-btn-secondary:hover { background: rgba(26,188,156,.2); }

/* ── Panneau droit ────────────────────────────── */
.tnl-right {
  flex: 1;
  background: var(--tnl-card-r);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.tnl-right::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 50%, rgba(26,188,156,.05), transparent 70%);
  pointer-events: none;
}

.tnl-preview-wrap {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; gap: 12px;
  flex: 1; min-height: 0;
}

#tnl-r-product {
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
  flex: 1; min-height: 0; width: 100%;
}

.tnl-preview-img {
  flex: 1; min-height: 0;
  width: 100%; max-width: 100%;
  object-fit: contain;
  border-radius: 14px;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,.5));
  transition: opacity .4s ease;
}

.tnl-preview-name {
  font-family: var(--font-family-heading,'Sora',sans-serif);
  font-size: .95rem; font-weight: 700; color: var(--tnl-text); text-align: center;
}

.tnl-preview-price { font-size: .75rem; color: var(--tnl-muted); text-align: center; }

.tnl-preview-hint {
  font-size: .7rem; color: rgba(255,255,255,.18);
  text-align: center; line-height: 1.6; max-width: 180px;
}

/* Panneau droit — génération */
#tnl-r-gen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex: 1; min-height: 0; width: 100%;
}

.tnl-right-gen-box {
  width: 100%; max-width: min(340px, 100%);
  border-radius: 14px;
  border: 2px solid rgba(26,188,156,.15);
  background: rgba(26,188,156,.04);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
}
.tnl-right-gen-ico {
  font-size: 2.5rem;
  animation: pulse 2s ease infinite;
}
.tnl-right-gen-badge {
  font-size: .7rem; font-weight: 700; color: var(--tnl-accent);
  background: var(--tnl-accent-soft); border: 1px solid rgba(26,188,156,.2);
  border-radius: 999px; padding: .28em .85em;
  animation: pulse 2s ease infinite;
}
.tnl-right-gen-hint {
  font-size: .7rem; color: rgba(255,255,255,.2);
  text-align: center; line-height: 1.5; max-width: 160px;
}

/* Panneau droit — résultat */
#tnl-r-result {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  flex: 1; min-height: 0; width: 100%;
}

.tnl-right-result-wrap {
  aspect-ratio: 1;
  height: 100%;
  max-height: 100%;
  width: auto;
  max-width: 100%;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(26,188,156,.12);
}

/* Canvas / img dans le résultat */
.tnl-right-result-wrap canvas,
.tnl-right-result-wrap img {
  width: 100%; height: 100%;
  object-fit: contain; display: block;
  border-radius: 14px;
}

.tnl-result-badge {
  font-size: .72rem; font-weight: 700; color: var(--tnl-accent);
  background: var(--tnl-accent-soft); border: 1px solid rgba(26,188,156,.2);
  border-radius: 999px; padding: .3em 1em;
}

/* ── Thumbnail strip (vues multiples) ────────── */
.tnl-thumb-strip {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-shrink: 0;
}
.tnl-thumb-strip:empty { display: none; }

.tnl-thumb {
  width: 64px; height: 64px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--tnl-border);
  background: rgba(255,255,255,.03);
  transition: border-color .15s, transform .15s;
  flex-shrink: 0;
}
.tnl-thumb:hover  { border-color: rgba(26,188,156,.4); transform: scale(1.05); }
.tnl-thumb.sel    { border-color: var(--tnl-accent); }
.tnl-thumb img    { width: 100%; height: 100%; object-fit: contain; display: block; }
.tnl-thumb canvas { width: 100% !important; height: 100% !important; display: block; }

/* ── Responsive mobile ────────────────────────── */
@media (max-width: 768px) {
  .tunnel-page { padding: 16px 12px 24px; justify-content: flex-start; }
  .tnl-card { flex-direction: column; min-height: unset; }
  .tnl-right { order: -1; padding: 20px 16px; min-height: 200px; }
  .tnl-preview-img { max-height: 160px; }
  .tnl-right-gen-box, .tnl-right-result-wrap { max-width: 160px; }
  .tnl-left { width: 100%; min-width: unset; border-right: none; border-top: 1px solid var(--tnl-border); }
  .tnl-left-body { padding: 20px 16px 12px; }
  .tnl-ft { padding: 12px 16px 16px; }
  .tnl-pcard-g { grid-template-columns: repeat(3,1fr); gap: 5px; }
  .tnl-pcard-img { width: 38px; height: 38px; }
  .tnl-title { font-size: 1.05rem; }
}
