/* =========================================================
   GRUPO FIBRATEX — Diseñador de prendas
   Complementa styles.css. Escritorio: tres columnas
   (herramientas · lienzo · propiedades). Móvil: lienzo arriba
   y paneles como hojas inferiores.
   ========================================================= */

body.dz-body { overflow: hidden; height: 100dvh; display: flex; flex-direction: column; }
body.dz-body .site-header { flex: none; }
.dz-header .header-bar { min-height: 62px; }
.dz-header .brand img { height: 34px; }
.dz-header-title { display: flex; flex-direction: column; line-height: 1.15; }
.dz-header-title strong { font-size: 0.95rem; }
.dz-header-title small { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.dz-header-actions { display: flex; align-items: center; gap: 0.5rem; }
.dz-header-actions .btn { padding: 0.55rem 1rem; font-size: 0.76rem; }
@media (max-width: 720px) {
  .dz-header-title { display: none; }
  .dz-header-actions .btn--texto { display: none; }
}

.dz {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 76px 320px minmax(0, 1fr) 300px;
  grid-template-areas: "tools panel stage props";
  background: var(--fondo-2);
}

/* ---------- Barra de herramientas ---------- */
.dz-tools {
  grid-area: tools; display: flex; flex-direction: column; gap: 0.25rem; padding: 0.6rem 0.4rem;
  background: var(--white); border-right: 1px solid var(--line); overflow-y: auto;
}
.dz-tool {
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
  padding: 0.6rem 0.2rem; border: 0; background: none; border-radius: 10px; cursor: pointer;
  font-size: 0.66rem; font-weight: 600; color: var(--muted); letter-spacing: 0.02em;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.dz-tool svg { width: 22px; height: 22px; }
.dz-tool:hover { background: var(--fondo); color: var(--ink); }
.dz-tool[aria-pressed="true"] { background: var(--azul-suave); color: var(--azul); }
.dz-tool { position: relative; }

/* ---------- Panel de herramienta ---------- */
.dz-panel {
  grid-area: panel; background: var(--white); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.dz-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.9rem 1rem 0.6rem; }
.dz-panel-head h2 { font-size: 0.95rem; }
.dz-panel-head p { font-size: 0.78rem; color: var(--muted); }
.dz-panel-body { flex: 1; overflow-y: auto; padding: 0 1rem 1.2rem; }
.dz-panel-close { display: none; }
.dz-seccion { display: none; }
.dz-seccion.is-active { display: block; }

.dz-bloque { margin-top: 1rem; }
.dz-bloque > h3, .dz-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.5rem;
}
.dz-nota { font-size: 0.78rem; color: var(--muted); line-height: 1.45; }
.dz-nota a { color: var(--azul); text-decoration: underline; }

/* Prendas */
.dz-prendas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.dz-prenda {
  border: 1px solid var(--line); border-radius: 10px; background: var(--fondo); padding: 0.45rem 0.3rem 0.4rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem; cursor: pointer; font-size: 0.72rem; font-weight: 600;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.dz-prenda img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.dz-prenda:hover { border-color: var(--azul); }
.dz-prenda[aria-pressed="true"] { border-color: var(--azul); background: var(--azul-suave); color: var(--azul); }

.dz-colores { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.dz-color {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--white); box-shadow: 0 0 0 1px var(--line); cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.dz-color:hover { transform: scale(1.1); }
.dz-color[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--azul); }

.dz-producto { background: var(--fondo); border-radius: 10px; padding: 0.8rem 0.9rem; font-size: 0.85rem; display: grid; gap: 0.25rem; }
.dz-producto strong { font-size: 0.95rem; }
.dz-producto .price { font-size: 1.15rem; }

/* Texto */
.dz-textarea, .dz-input, .dz-select {
  width: 100%; padding: 0.6rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--fondo); font-size: 0.9rem;
}
.dz-textarea:focus, .dz-input:focus, .dz-select:focus { outline: none; border-color: var(--azul); background: var(--white); }
.dz-textarea { resize: vertical; min-height: 64px; }
.dz-fuentes { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.dz-fuente {
  border: 1px solid var(--line); background: var(--white); border-radius: 8px; padding: 0.45rem 0.6rem; cursor: pointer; text-align: left;
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.4rem; min-height: 46px;
}
.dz-fuente:hover { border-color: var(--azul); }
.dz-fuente[aria-pressed="true"] { border-color: var(--azul); background: var(--azul-suave); }
.dz-fuente .muestra { font-size: 1.35rem; line-height: 1; }
.dz-fuente .nombre { font-size: 0.62rem; color: var(--muted); text-align: right; line-height: 1.2; }

/* Subir */
.dz-drop {
  display: block; border: 2px dashed var(--fondo-3); border-radius: 12px; padding: 1.4rem 1rem; text-align: center; background: var(--fondo);
  cursor: pointer; transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.dz-drop.is-over, .dz-drop:hover { border-color: var(--azul); background: var(--azul-suave); }
.dz-drop svg { width: 34px; height: 34px; color: var(--azul); margin: 0 auto 0.5rem; }
.dz-drop strong { display: block; font-size: 0.9rem; }
.dz-drop span { font-size: 0.76rem; color: var(--muted); }
.dz-drop input { display: none; }

.dz-galeria { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; }
.dz-galeria button {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; background: var(--white); cursor: pointer; padding: 0.45rem;
  display: grid; place-items: center; transition: border-color 0.15s var(--ease), transform 0.15s var(--ease); overflow: hidden;
}
.dz-galeria button:hover { border-color: var(--azul); transform: translateY(-2px); }
.dz-galeria button img, .dz-galeria button svg { width: 100%; height: 100%; object-fit: contain; }
.dz-galeria--emoji button { font-size: 1.5rem; padding: 0.2rem; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.dz-galeria--imagenes button { position: relative; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 14px 14px; }

/* Formas */
.dz-formas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; }
.dz-formas button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; background: var(--white); cursor: pointer; display: grid; place-items: center; }
.dz-formas button svg { width: 60%; height: 60%; }
.dz-formas button:hover { border-color: var(--azul); }

/* IA */

/* Capas */
.dz-capas { list-style: none; padding: 0; display: grid; gap: 0.3rem; }
.dz-capa {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--white);
  font-size: 0.8rem; cursor: pointer;
}
.dz-capa.is-active { border-color: var(--azul); background: var(--azul-suave); }
.dz-capa .ico { width: 18px; height: 18px; color: var(--muted); flex: none; }
.dz-capa .nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-capa .mini { display: flex; gap: 0.15rem; }
.dz-capa .mini button { width: 24px; height: 24px; border: 0; background: none; border-radius: 5px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.dz-capa .mini button:hover { background: var(--fondo-2); color: var(--ink); }
.dz-capa .mini button svg { width: 14px; height: 14px; }
.dz-capa.is-hidden .nombre { opacity: 0.45; text-decoration: line-through; }

/* Pedido */
.dz-tallas-tabla { display: grid; gap: 0.35rem; }
.dz-talla-fila { display: grid; grid-template-columns: 1fr 100px; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.dz-talla-fila input { width: 100%; padding: 0.4rem 0.5rem; border: 1px solid var(--line); border-radius: 8px; text-align: center; font-size: 0.9rem; }
.dz-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.dz-total strong { font-size: 1.2rem; color: var(--azul); }
.dz-total small { color: var(--muted); font-size: 0.75rem; }
.dz-total small.dz-nota-falta { color: var(--aviso); font-weight: 700; }

/* ---------- Escenario ---------- */
.dz-stage { grid-area: stage; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.dz-stage-top, .dz-stage-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.55rem 0.9rem; flex-wrap: wrap;
}
.dz-stage-top { border-bottom: 1px solid var(--line); background: rgba(255,255,255,0.7); }
.dz-stage-bottom { font-size: 0.76rem; color: var(--muted); }
.dz-vistas { display: flex; gap: 0.3rem; background: var(--white); border: 1px solid var(--line); border-radius: 999px; padding: 0.2rem; }
.dz-vista { border: 0; background: none; padding: 0.4rem 0.9rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 0.35rem; }
.dz-vista[aria-pressed="true"] { background: var(--azul); color: var(--white); }
.dz-vista .punto { width: 7px; height: 7px; border-radius: 50%; background: var(--verde); display: none; }
.dz-vista.has-items .punto { display: inline-block; }
.dz-vista[aria-pressed="true"] .punto { background: var(--verde); }
.dz-mini-btns { display: flex; gap: 0.25rem; }
.dz-mini-btn {
  width: 34px; height: 34px; border: 1px solid var(--line); background: var(--white); border-radius: 8px; cursor: pointer; display: grid; place-items: center; color: var(--ink);
}
.dz-mini-btn:hover { border-color: var(--azul); color: var(--azul); }
.dz-mini-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.dz-mini-btn svg { width: 17px; height: 17px; }
.dz-mini-btn--texto { width: auto; padding: 0 0.6rem; font-size: 0.74rem; font-weight: 700; }
.dz-zoom { min-width: 3.2rem; text-align: center; font-size: 0.76rem; color: var(--muted); }

.dz-canvas-wrap {
  flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; padding: 0.8rem;
  background:
    radial-gradient(circle at 1px 1px, rgba(27,36,48,0.08) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--fondo-2);
}
.dz-canvas-box { position: relative; width: min(100%, calc(100dvh - 240px), 900px); aspect-ratio: 1; box-shadow: var(--shadow-md); border-radius: 14px; background: var(--white); }
.dz-canvas-box canvas { border-radius: 14px; }
.dz-canvas-box .canvas-container { border-radius: 14px; overflow: hidden; }
.dz-vacio {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; text-align: center; padding: 2rem;
}
.dz-vacio > div { background: rgba(255,255,255,0.86); backdrop-filter: blur(6px); border-radius: 12px; padding: 0.9rem 1.2rem; font-size: 0.85rem; color: var(--muted); max-width: 32ch; box-shadow: var(--shadow-sm); }
.dz-vacio strong { display: block; color: var(--ink); margin-bottom: 0.2rem; }

.dz-toast {
  position: absolute; left: 50%; bottom: 3.4rem; transform: translateX(-50%) translateY(10px); z-index: 30;
  background: var(--ink); color: var(--white); padding: 0.6rem 1rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity 0.2s var(--ease), transform 0.2s var(--ease); max-width: calc(100% - 2rem); text-align: center;
}
.dz-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.dz-toast--error { background: var(--error); }
.dz-toast--ok { background: var(--ok); }

/* ---------- Propiedades ---------- */
.dz-props { grid-area: props; background: var(--white); border-left: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.dz-props-head { padding: 0.9rem 1rem 0.5rem; display: flex; align-items: center; justify-content: space-between; }
.dz-props-head h2 { font-size: 0.95rem; }
.dz-props-body { padding: 0 1rem 1.2rem; }
.dz-props-vacio { font-size: 0.8rem; color: var(--muted); padding: 0.4rem 0 1rem; line-height: 1.5; }
.dz-grupo { display: none; }
.dz-grupo.is-on { display: block; }

.dz-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; margin-top: 0.5rem; }
.dz-fila--3 { grid-template-columns: 1fr 1fr 1fr; }
.dz-fila--4 { grid-template-columns: repeat(4, 1fr); }
.dz-campo { display: grid; gap: 0.2rem; font-size: 0.72rem; color: var(--muted); }
.dz-campo input[type="number"], .dz-campo select, .dz-campo input[type="text"] {
  width: 100%; padding: 0.4rem 0.5rem; border: 1px solid var(--line); border-radius: 7px; font-size: 0.84rem; color: var(--ink); background: var(--fondo);
}
.dz-campo input[type="range"] { width: 100%; accent-color: var(--azul); }
.dz-campo input[type="color"] { width: 100%; height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 2px; background: var(--white); cursor: pointer; }
.dz-iconos { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.5rem; }
.dz-iconos .dz-mini-btn[aria-pressed="true"] { background: var(--azul); color: var(--white); border-color: var(--azul); }
.dz-btn-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; margin-top: 0.5rem; }
.dz-btn-fila .btn { padding: 0.5rem 0.6rem; font-size: 0.72rem; }
.dz-btn-fila .btn--block { grid-column: 1 / -1; }
.dz-swatches { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.dz-swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,0.12); cursor: pointer; }
.dz-swatch:hover { transform: scale(1.12); }
.dz-alerta { margin-top: 0.6rem; font-size: 0.75rem; padding: 0.5rem 0.7rem; border-radius: 8px; background: var(--aviso-suave); color: var(--aviso); border: 1px solid #e8d3a4; line-height: 1.4; }
.dz-alerta--ok { background: var(--ok-suave); color: var(--ok); border-color: #b8e2c6; }

/* ---------- Diálogos ---------- */
.dz-dialogo { margin: auto; max-width: 100%; border: 0; padding: 0; width: min(560px, calc(100vw - 2rem)); border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow-md); }
.dz-dialogo::backdrop { background: rgba(27,36,48,0.5); backdrop-filter: blur(3px); }
.dz-dialogo-inner { padding: 1.5rem; display: grid; gap: 0.9rem; }
.dz-dialogo h2 { font-size: var(--step-2); }
.dz-dialogo p { color: var(--muted); font-size: 0.9rem; }
.dz-compartir { display: flex; gap: 0.4rem; }
.dz-compartir input { flex: 1; }
.dz-preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.dz-preview-grid img { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: var(--fondo); }

/* ---------- Móvil / tablet ---------- */
@media (max-width: 1100px) {
  .dz { grid-template-columns: 76px 300px minmax(0, 1fr); grid-template-areas: "tools panel stage"; }
  .dz-props {
    position: fixed; right: 0; bottom: 0; top: auto; left: 76px; z-index: 40; max-height: 55dvh; border-top: 1px solid var(--line); border-left: 0;
    box-shadow: 0 -8px 30px rgba(27,36,48,0.12); transform: translateY(100%); transition: transform 0.25s var(--ease);
  }
  .dz-props.is-open { transform: translateY(0); }
  .dz-props-close { display: inline-grid; }
}
@media (min-width: 1101px) { .dz-props-close { display: none; } }

@media (max-width: 860px) {
  body.dz-body { height: auto; overflow: auto; }
  .dz {
    grid-template-columns: 1fr; grid-template-rows: auto auto; grid-template-areas: "stage" "tools"; min-height: calc(100dvh - 62px);
  }
  .dz-tools {
    position: sticky; bottom: 0; z-index: 45; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); padding: 0.3rem 0.2rem;
    overflow-x: auto; overflow-y: hidden;
  }
  .dz-tool { padding: 0.45rem 0.35rem; min-width: 58px; }
  .dz-panel {
    position: fixed; left: 0; right: 0; bottom: 66px; z-index: 44; max-height: 62dvh; border-right: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 30px rgba(27,36,48,0.14); transform: translateY(110%); transition: transform 0.25s var(--ease);
  }
  .dz-panel.is-open { transform: translateY(0); }
  .dz-panel-close { display: inline-grid; }
  .dz-props { left: 0; bottom: 66px; max-height: 60dvh; border-radius: 16px 16px 0 0; }
  .dz-canvas-box { width: min(100%, 92vw); }
  .dz-canvas-wrap { padding: 0.5rem; }
  .dz-stage-bottom { padding-bottom: 0.4rem; }
  .dz-fuentes, }
