/* ============================================================
   CADRE FIXE (ne zoome jamais)
============================================================ */
.ec-frame {
  width: 500px;
  height: 500px;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid #ddd;
  background: none;
}

/* ============================================================
   MOCKUP (FULL SIZE)
============================================================ */
.ec-layer-mockup {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.ec-mockup {
  position: absolute;
  inset: 0;
}

#ec-mockup-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform-origin: center center;
  pointer-events: none;
  z-index: 1;
}

/* ============================================================
   WRAPPER QUI ZOOME VISUELLEMENT
============================================================ */
.ec-visual-zoom-wrapper {
  position: absolute;
  inset: 0;
  transform-origin: center center;
  z-index: 5;

  /* ⭐ centre le canvas ET la print-area */
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ============================================================
   CANVAS (Fabric.js)
============================================================ */
.ec-canvas-layer {
  position: relative;
  pointer-events: auto;

  /* ⭐ centre le canvas-container */
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ⭐ Fabric.js container NON CENTRÉ PAR CSS
   → Fabric garde ses coordonnées propres
   → Le flex parent le centre visuellement */
.ec-canvas-layer .canvas-container {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  z-index: 5;
}

/* ⭐ Les vrais canvas Fabric */
.ec-canvas-layer .upper-canvas,
.ec-canvas-layer .lower-canvas {
  width: 100% !important;
  height: 100% !important;
}

#ec-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  background: transparent;
}

/* ============================================================
   PRINT AREA (taille dynamique)
============================================================ */
.ec-printarea-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;

  /* ⭐ centrée comme le canvas */
  display: flex;
  justify-content: center;
  align-items: center;
}

.ec-print-area {
  position: relative;
  border: 2px dashed rgba(200,200,200,1);
  border-radius: 4px;

  width: 350px;
  height: 400px;
}

/* ============================================================
   ZOOM UI
============================================================ */
.ec-zoom-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 9999;
}

.ec-zoom-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  cursor: pointer;
  font-size: 20px;
  font-weight: bold;
  line-height: 32px;
  text-align: center;
  padding: 0;
}

/* ============================================================
   GUIDES BLEUS
============================================================ */
.ec-guide-line {
  position: absolute;
  background: #4da3ff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease-out;
}

.ec-guide-center-x {
  width: 2px;
  height: 100%;
  left: 50%;
  top: 0;
  transform: translateX(-1px);
}

.ec-guide-center-y {
  height: 2px;
  width: 100%;
  top: 50%;
  left: 0;
  transform: translateY(-1px);
}

.ec-guide-left {
  width: 2px;
  height: 100%;
  left: 0;
  top: 0;
}

.ec-guide-right {
  width: 2px;
  height: 100%;
  right: 0;
  top: 0;
}

.ec-guide-top {
  height: 2px;
  width: 100%;
  top: 0;
  left: 0;
}

.ec-guide-bottom {
  height: 2px;
  width: 100%;
  bottom: 0;
  left: 0;
}

.ec-guide-visible {
  opacity: 1;
}

/* ============================================================
   LAYER EDITOR
============================================================ */
.ec-layer-editor {
  display: flex;
  flex-direction: column;
  margin-top: 15px;
  gap: 10px;
  width: 100%;
  max-width: 500px;
  justify-content: center;
  position: relative;
  z-index: 99999;
}

.ec-layer-editor button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: #dbdcdc;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  border-radius: 4px;

  /* ⭐ AJOUT pour icône + texte */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
}

.ec-layer-editor button:hover {
  background: rgba(0,0,0,0.2);
}

/* ⭐ AJOUT pour les images */
.ec-layer-editor button img {
  width: 20px;
  height: 20px;
  display: block;
}

/* ⭐ AJOUT pour le texte */
.ec-layer-editor button span {
  font-size: 10px;
  line-height: 1.1;
  text-align: center;
}

.ec-layer-editor-row1,
.ec-layer-editor-row2,
.ec-layer-editor-row3,
.ec-layer-editor-row4,
.ec-layer-editor-row5 {
  display: grid;
  gap: 8px;
}

.ec-layer-editor-row1 { grid-template-columns: repeat(4, 1fr); }
.ec-layer-editor-row2 { grid-template-columns: repeat(2, 1fr); }
.ec-layer-editor-row3 { grid-template-columns: repeat(4, 1fr); }
.ec-layer-editor-row4 { grid-template-columns: repeat(4, 1fr); }
.ec-layer-editor-row5 { grid-template-columns: repeat(2, 1fr); }
