/* K'do Perso — éditeur front v0.5 (UI façon designer) */

/* #kdo-perso ne porte plus de style (le canevas part à gauche, les contrôles à droite) */
.kdo-perso { background: transparent; border: 0; padding: 0; margin: 0; }

/* Anti-flash : masquer la galerie d'origine DÈS le CSS (le canevas la remplace),
   tout en gardant le conteneur visible pour héberger le canevas. */
.kdo-perso-active .woocommerce-product-gallery { opacity: 1 !important; }
.kdo-perso-active .woocommerce-product-gallery__wrapper,
.kdo-perso-active .woocommerce-product-gallery__image,
.kdo-perso-active .flex-viewport,
.kdo-perso-active .flex-control-nav,
.kdo-perso-active .woocommerce-product-gallery__trigger,
.kdo-perso-active .woocommerce-product-gallery img.wp-post-image { display: none !important; }
.kdo-perso-active .kdo-canvas-wrap { display: block !important; }

/* ---------- Canevas (colonne gauche, dans la galerie produit) ---------- */
.kdo-canvas-wrap {
  position: relative; width: 100%; margin: 0;
  background: #f4f6f8; border: 1px solid #e5e9ee; border-radius: 12px; padding: 10px;
  box-sizing: border-box;
}
.kdo-canvas-wrap .canvas-container { margin: 0 auto; }
.kdo-canvas-wrap canvas { max-width: 100%; background: transparent; border-radius: 6px; }
.kdo-canvas-wrap .kdo-hint { margin: 10px 4px 2px; font-size: 12.5px; color: #6b7280; text-align: center; }

/* onglets de vues (recto/verso) */
.kdo-views { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.kdo-view-tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px; border: 1px solid #e2e8f0; border-radius: 9px; background: #fff; cursor: pointer; width: 66px; }
.kdo-view-tab img { width: 48px; height: 48px; object-fit: contain; }
.kdo-view-tab span { font-size: 11px; color: #475569; line-height: 1.1; }
.kdo-view-tab.active { border-color: #2b6cb0; box-shadow: 0 0 0 2px rgba(43,108,176,.2); }

/* barre de zoom flottante */
.kdo-zoombar {
  position: absolute; top: 16px; right: 16px; z-index: 5;
  display: flex; align-items: center; gap: 2px;
  background: #fff; border: 1px solid #e5e9ee; border-radius: 8px; padding: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.kdo-zoombar button {
  width: 30px; height: 30px; border: 0; background: transparent; cursor: pointer;
  font-size: 17px; line-height: 1; color: #334155; border-radius: 6px;
}
.kdo-zoombar button:hover { background: #eef2f6; }
.kdo-zoombar .kdo-zoom-level { font-size: 12px; color: #64748b; min-width: 40px; text-align: center; }

/* ---------- Panneau de contrôles (colonne droite) ---------- */
.kdo-controls {
  background: #fff; border: 1px solid #e5e9ee; border-radius: 12px; padding: 4px 18px 18px;
  box-shadow: 0 1px 6px rgba(0,0,0,.05); max-width: 560px;
}
.kdo-panel-title { font-size: 16px; font-weight: 700; color: #1e293b; padding: 16px 0 4px; }

.kdo-section { padding: 14px 0; border-top: 1px solid #eef1f5; }
.kdo-section:first-of-type { border-top: 0; }
.kdo-section-label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #94a3b8; margin-bottom: 10px;
}

/* boutons-outils (Ajouter) */
.kdo-toolbar { display: flex; flex-wrap: wrap; gap: 10px; }
.kdo-tool {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  min-width: 88px; padding: 12px 10px; cursor: pointer;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: #334155; transition: .12s;
}
.kdo-tool span { font-size: 22px; line-height: 1; }
.kdo-tool:hover { border-color: #2b6cb0; background: #eff5fb; color: #1e4e8c; }

/* champ texte */
.kdo-textinput {
  width: 100%; box-sizing: border-box; padding: 12px 14px;
  border: 2px solid #2b6cb0; border-radius: 9px; font-size: 15px;
}
.kdo-textinput:focus { outline: none; border-color: #1e4e8c; box-shadow: 0 0 0 3px rgba(43,108,176,.15); }

/* propriétés élément actif */
.kdo-props { display: none; }
.kdo-props.on { display: block; }
.kdo-props-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.kdo-font { flex: 0 0 auto; max-width: 160px; padding: 7px; border: 1px solid #cbd5e1; border-radius: 8px; }
.kdo-size { flex: 1; }
.kdo-mini-label { font-size: 13px; color: #475569; flex: 0 0 auto; min-width: 74px; }
.kdo-rotate { flex: 1; }
.kdo-rotate-reset { flex: 0 0 auto; border: 1px solid #e2e8f0; background: #fff; border-radius: 7px; width: 30px; height: 28px; cursor: pointer; }
.kdo-rotate-reset:hover { background: #eef2f6; }
.kdo-swatches { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.kdo-swatch {
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(0,0,0,.15); box-shadow: inset 0 0 0 1px rgba(255,255,255,.5);
}
.kdo-swatch:hover { transform: scale(1.15); }
.kdo-swatch.sel { outline: 2px solid #1e4e8c; outline-offset: 2px; }
.kdo-textcolor { width: 36px; height: 28px; padding: 0; border: 1px solid #cbd5e1; border-radius: 7px; cursor: pointer; flex: 0 0 auto; }
.kdo-del {
  background: #fff; border: 1px solid #e2e8f0; color: #b91c1c; cursor: pointer;
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
}
.kdo-del:hover { background: #fef2f2; border-color: #fca5a5; }

/* technique + prix */
.kdo-technique { padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 8px; min-width: 220px; }
.kdo-price-note { margin: 12px 0 0; font-size: 15px; font-weight: 700; color: #0f766e; }

/* calques */
.kdo-layers-list { display: flex; flex-direction: column; gap: 5px; }
.kdo-layer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff;
}
.kdo-layer.active { border-color: #2b6cb0; background: #eff5fb; }
.kdo-layer-name { font-size: 13px; color: #334155; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.kdo-layer-actions { display: flex; gap: 2px; flex: 0 0 auto; }
.kdo-layer-actions button {
  width: 26px; height: 26px; border: 0; background: transparent; cursor: pointer;
  border-radius: 6px; font-size: 12px; line-height: 1; color: #475569;
}
.kdo-layer-actions button:hover { background: #eef2f6; }

/* couleur du support */
.kdo-color-swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.kdo-color-swatch {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(0,0,0,.2); box-shadow: inset 0 0 0 1px rgba(255,255,255,.45); transition: .12s;
}
.kdo-color-swatch:hover { transform: scale(1.12); }
.kdo-color-swatch.sel { outline: 3px solid #2b6cb0; outline-offset: 2px; }

/* galerie de motifs */
.kdo-motif-panel { border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; margin: 0 0 4px; background: #f8fafc; }
.kdo-motif-title { font-weight: 600; margin-bottom: 8px; font-size: 13px; color: #334155; }
.kdo-motif-grid-front { display: flex; flex-wrap: wrap; gap: 8px; }
.kdo-motif-thumb {
  width: 62px; height: 62px; object-fit: contain; border: 1px solid #ddd; border-radius: 8px;
  cursor: pointer; background: #fff; padding: 5px; box-sizing: border-box; transition: .12s;
}
.kdo-motif-thumb:hover { border-color: #2b6cb0; transform: scale(1.05); }
.kdo-motif-empty { color: #64748b; font-size: 13px; margin: 0; }

@media (max-width: 600px) {
  .kdo-controls { padding: 4px 12px 12px; }
  .kdo-tool { min-width: 72px; }
}
