/* Deejay Skin Designer */

/* Variables también en el escenario: en escritorio se mueve fuera de .dsd, al sitio de la galería. */
.dsd, .dsd-stage-wrap {
    --dsd-ink: #111;
    --dsd-ink-2: #555;
    --dsd-ink-3: #8a8a8a;
    --dsd-line: #e6e6e6;
    --dsd-soft: #f6f6f5;
    --dsd-red: #e30613;
    --dsd-radius: 14px;
    --dsd-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .08);
    font-size: 14px;
    line-height: 1.45;
    color: var(--dsd-ink);
}
.dsd { margin: 0 0 20px; }
/* XStore pone cantidad + botón en una fila flexible: el editor ocupa la fila entera y la compra baja debajo. */
.dsd { flex: 0 0 100%; width: 100%; max-width: 100%; }
form.cart:has(> .dsd), .woocommerce-variation-add-to-cart:has(> .dsd) { flex-wrap: wrap; }
.dsd[data-loading] { visibility: hidden; }
.dsd *, .dsd *::before, .dsd *::after,
.dsd-stage-wrap *, .dsd-stage-wrap *::before, .dsd-stage-wrap *::after { box-sizing: border-box; }

/* Botones a prueba del tema: XStore y los navegadores dan estilos propios a <button>. */
.dsd button, .dsd-stage-wrap button {
    -webkit-appearance: none; appearance: none; margin: 0; font: inherit; color: inherit; line-height: 1.2;
    text-transform: none; letter-spacing: normal; text-shadow: none; box-shadow: none; min-width: 0; width: auto; height: auto;
    transition: background-color .15s, border-color .15s, color .15s, opacity .15s;
}
.dsd svg, .dsd-stage-wrap svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ------------------------------------------------------------------
 * Escenario: foto de la prenda + zona de impresión + controles flotantes
 * ---------------------------------------------------------------- */
.dsd-stage-wrap { margin: 0 0 16px; position: relative; z-index: 0; isolation: isolate; } /* los z-index internos no compiten con el header fijo del tema */
.dsd-stage { position: relative; width: 100%; max-width: 640px; aspect-ratio: 1 / 1; margin: 0 auto; background: #fff; border: 1px solid var(--dsd-line); border-radius: var(--dsd-radius); overflow: hidden; user-select: none; touch-action: manipulation; }
.dsd-stage[style*="height"] { aspect-ratio: auto; }
.dsd-area { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.dsd-mockup { display: block; width: 100%; height: 100%; pointer-events: none; }
/* La galería del tema queda invisible pero con su ancho real: con display:none el carrusel de XStore mide 0 px
   y la foto principal y las miniaturas se mandan "click" sin fin (RangeError: Maximum call stack size exceeded). */
.dsd-gallery-col { position: relative; }
.dsd-hidden-gallery { display: block !important; position: absolute !important; left: 0 !important; top: 0 !important; width: 100% !important; height: 0 !important; margin: 0 !important; overflow: hidden !important; visibility: hidden !important; pointer-events: none !important; }
.dsd-hint { margin: 8px 0 0; font-size: 12px; color: var(--dsd-ink-3); text-align: center; }

/* Lienzo de edición: zona + margen alrededor (los tiradores nunca quedan fuera). */
.dsd-canvas-wrap { position: absolute; z-index: 2; }
.dsd-canvas-wrap .canvas-container { position: absolute !important; inset: 0; }
/* Zona de impresión: solo marca visual encima del lienzo; deja pasar los clics salvo en el asa. */
.dsd-zone { position: absolute; z-index: 3; outline: 1px dashed rgba(0, 0, 0, .4); pointer-events: none; }
.dsd-zone .dsd-zone-handle { pointer-events: auto; }
.dsd-stage.is-dark .dsd-zone { outline-color: rgba(255, 255, 255, .55); }
.dsd-zone-size { position: absolute; right: 4px; bottom: 4px; z-index: 4; padding: 1px 6px; border-radius: 4px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 10px; font-weight: 600; letter-spacing: .02em; pointer-events: none; white-space: nowrap; }
.dsd-stage.is-dark .dsd-zone-size { background: rgba(255, 255, 255, .8); color: #111; }
/* Slipmat: disco con la marca del agujero central (se imprime todo y luego se perfora). */
.dsd-zone.is-round { border-radius: 50%; outline: 1px dashed rgba(0, 0, 0, .35); }
.dsd-zone.is-round .dsd-zone-size { display: none; }
.dsd-zone.is-round::after { content: ""; position: absolute; left: 50%; top: 50%; width: 2.4%; height: 2.4%; transform: translate(-50%, -50%); border-radius: 50%; background: #3a3a3a; box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); pointer-events: none; z-index: 5; }

/* Asa para mover la zona por la prenda */
.dsd-stage-wrap .dsd-zone-handle,
.dsd-stage-wrap .dsd-zone-handle:hover,
.dsd-stage-wrap .dsd-zone-handle:focus {
    position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, -6px); z-index: 6;
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px 4px 8px; border: 0; border-radius: 999px;
    background: #111; color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; cursor: grab; touch-action: none;
    box-shadow: var(--dsd-shadow);
}
.dsd-stage-wrap .dsd-zone-handle svg { width: 13px; height: 13px; }
.dsd-stage-wrap .dsd-stage.is-dark .dsd-zone-handle { background: #fff; color: #111; }
.is-dragging .dsd-zone-handle { cursor: grabbing; }
.is-dragging .dsd-zone { outline-style: solid; }

/* Controles flotantes */
.dsd-float { position: absolute; z-index: 10; display: flex; gap: 6px; pointer-events: none; }
.dsd-float > * { pointer-events: auto; }
.dsd-float-tl { top: 10px; left: 10px; }
.dsd-float-tr { top: 10px; right: 10px; }
.dsd-float-br { right: 10px; bottom: 10px; }
.dsd-float-bl { left: 10px; bottom: 10px; }

/* Vista previa: la prenda tal cual, sin guías ni controles */
.dsd-stage-wrap .dsd-preview-btn,
.dsd-stage-wrap .dsd-preview-btn:hover,
.dsd-stage-wrap .dsd-preview-btn:focus {
    display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border: 1px solid var(--dsd-line); border-radius: 999px;
    background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: var(--dsd-shadow);
    color: var(--dsd-ink); font-size: 13px; font-weight: 600; cursor: pointer;
}
.dsd-stage-wrap .dsd-preview-btn:hover { background: #fff; border-color: #111; }
.dsd-stage-wrap .dsd-preview-btn[aria-pressed="true"],
.dsd-stage-wrap .dsd-preview-btn[aria-pressed="true"]:hover { background: #111; border-color: #111; color: #fff; }
.dsd-preview-btn .dsd-pencil, .dsd-preview-btn[aria-pressed="true"] .dsd-eye { display: none; }
.dsd-preview-btn[aria-pressed="true"] .dsd-pencil { display: block; }
.dsd-stage.is-preview .dsd-zone { outline: 0; box-shadow: none; }
.dsd-stage.is-preview .dsd-canvas-wrap { pointer-events: none; }
.dsd-stage.is-preview .dsd-zone-handle,
.dsd-stage.is-preview .dsd-zone-size { display: none !important; }
.dsd-pill, .dsd-sides { display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--dsd-line); border-radius: 999px; background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: var(--dsd-shadow); }
.dsd-sides[hidden] { display: none; }

.dsd-stage-wrap .dsd-side,
.dsd-stage-wrap .dsd-side:hover,
.dsd-stage-wrap .dsd-side:focus { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--dsd-ink-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.dsd-stage-wrap .dsd-side:hover { color: var(--dsd-ink); background: rgba(0, 0, 0, .05); }
.dsd-stage-wrap .dsd-side.is-active,
.dsd-stage-wrap .dsd-side.is-active:hover,
.dsd-stage-wrap .dsd-side.is-active:focus { background: #111; color: #fff; }
.dsd-dot { width: 6px; height: 6px; border-radius: 50%; background: #1a9e4b; display: none; }
.dsd-side.has-design .dsd-dot { display: inline-block; }

/* Botones de icono (flotantes y barra de herramientas) */
.dsd .dsd-ico, .dsd .dsd-ico:hover, .dsd .dsd-ico:focus,
.dsd-stage-wrap .dsd-ico, .dsd-stage-wrap .dsd-ico:hover, .dsd-stage-wrap .dsd-ico:focus {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
    border: 0; border-radius: 999px; background: transparent; color: var(--dsd-ink); cursor: pointer;
}
.dsd .dsd-ico:hover, .dsd-stage-wrap .dsd-ico:hover { background: rgba(0, 0, 0, .06); }
.dsd .dsd-ico:disabled, .dsd-stage-wrap .dsd-ico:disabled { opacity: .3; cursor: default; background: transparent; }
.dsd .dsd-ico[hidden], .dsd-stage-wrap .dsd-ico[hidden] { display: none; }
.dsd .dsd-danger, .dsd .dsd-danger:hover, .dsd .dsd-danger:focus { color: var(--dsd-red); }
.dsd-zoom-level { min-width: 40px; text-align: center; font-size: 11px; font-weight: 600; color: var(--dsd-ink-2); font-variant-numeric: tabular-nums; }

.dsd-stage.is-zoomed { cursor: grab; }
.dsd-stage.is-panning { cursor: grabbing; }

/* Arrastrar y soltar una imagen sobre la prenda */
.dsd-drop-hint { position: absolute; inset: 8px; z-index: 20; display: none; align-items: center; justify-content: center; border: 2px dashed #111; border-radius: 10px; background: rgba(255, 255, 255, .85); font-size: 14px; font-weight: 600; pointer-events: none; }
.dsd-stage.is-dropping .dsd-drop-hint { display: flex; }

/* ------------------------------------------------------------------
 * Panel
 * ---------------------------------------------------------------- */
.dsd-panel { display: flex; flex-direction: column; gap: 14px; }
.dsd-section { display: flex; flex-direction: column; gap: 6px; }
.dsd-placement[hidden] { display: none; }
/* Etiquetas como las del tema ("Talla", "Estilo", "Color"). */
.dsd-label { display: block; margin: 0 0 8px; font-size: 16px; font-weight: 400; color: #444; text-transform: none; letter-spacing: 0; }
.dsd-section > .dsd-label { margin: 0 0 4px; }
.dsd-tools .dsd-label { font-size: 13px; margin-bottom: 6px; }

/* Control segmentado */
.dsd-seg { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--dsd-soft); }
.dsd .dsd-seg-btn, .dsd .dsd-seg-btn:hover, .dsd .dsd-seg-btn:focus {
    flex: 1 1 0; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--dsd-ink-2);
    font-size: 14px; font-weight: 500; cursor: pointer; text-align: center; white-space: nowrap;
}
.dsd .dsd-seg-btn:hover { color: var(--dsd-ink); }
.dsd .dsd-seg-btn.is-active, .dsd .dsd-seg-btn.is-active:hover, .dsd .dsd-seg-btn.is-active:focus { background: #fff; color: var(--dsd-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* Añadir contenido */
.dsd-add { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.dsd .dsd-drop, .dsd .dsd-add-text, .dsd .dsd-add-text:hover, .dsd .dsd-add-text:focus {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 92px; margin: 0; padding: 12px;
    border: 1.5px dashed #c9c9c9; border-radius: 12px; background: #fff; color: var(--dsd-ink); text-align: center; cursor: pointer;
}
.dsd .dsd-add-text, .dsd .dsd-add-text:hover, .dsd .dsd-add-text:focus { border-style: solid; border-color: var(--dsd-line); }
.dsd .dsd-drop:hover, .dsd .dsd-drop.is-dropping { border-color: #111; background: var(--dsd-soft); }
.dsd .dsd-add-text:hover { border-color: #111; background: var(--dsd-soft); }
.dsd .dsd-drop svg, .dsd .dsd-add-text svg { width: 22px; height: 22px; margin-bottom: 2px; }
/* XStore da estilo propio a input[type=file]: mantenerlo oculto (la caja entera es el botón). */
.dsd .dsd-drop input[type="file"] { display: none !important; }
.dsd-drop-title { font-size: 15px; font-weight: 500; }
/* Escenario dentro de la columna de la galería del tema: que ocupe todo su ancho. */
.product-images > .dsd-stage-wrap .dsd-stage { max-width: none; }
.dsd-drop-sub { font-size: 12px; color: var(--dsd-ink-3); }

/* Archivo original y notas */
.dsd-extra { border: 1px solid var(--dsd-line); border-radius: 12px; background: #fff; }
.dsd-extra > summary { display: flex; align-items: center; gap: 8px; padding: 11px 14px; font-size: 14px; font-weight: 500; cursor: pointer; list-style: none; }
.dsd-extra > summary::-webkit-details-marker { display: none; }
.dsd-extra > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .2s; }
.dsd-extra[open] > summary::after { transform: rotate(-135deg); }
.dsd-extra > summary svg { width: 16px; height: 16px; }
.dsd-extra-body { display: flex; flex-direction: column; gap: 8px; padding: 0 14px 14px; }
.dsd .dsd-attach { display: flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; padding: 8px 8px 8px 12px; border: 1.5px dashed #c9c9c9; border-radius: 10px; cursor: pointer; font-size: 13px; }
.dsd .dsd-attach:hover { border-color: #111; background: var(--dsd-soft); }
.dsd .dsd-attach.has-file { border-style: solid; border-color: #1a9e4b; background: #f2fbf5; }
.dsd-attach-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsd .dsd-attach input[type="file"] { display: none !important; }
.dsd .dsd-textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; font-size: 14px; }

/* Herramientas del elemento seleccionado */
.dsd-tools { display: flex; flex-direction: column; gap: 12px; padding: 12px; border: 1px solid var(--dsd-line); border-radius: 12px; background: #fff; box-shadow: var(--dsd-shadow); }
.dsd-tools[hidden], .dsd-text-tools[hidden], .dsd-image-tools[hidden], .dsd-knock-level[hidden] { display: none; }
.dsd-tools-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dsd-tools-title { font-size: 15px; font-weight: 500; }
.dsd-toolbar { display: flex; gap: 2px; }
.dsd-row { display: flex; gap: 8px; }
.dsd-field { display: flex; flex-direction: column; min-width: 0; }
.dsd-field-grow { flex: 1 1 auto; }
.dsd .dsd-input { width: 100%; height: 38px; margin: 0; padding: 0 10px; border: 1px solid var(--dsd-line); border-radius: 8px; background: #fff; color: var(--dsd-ink); font: inherit; font-size: 14px; box-shadow: none; }
.dsd .dsd-input:focus { border-color: #111; outline: none; }
.dsd select.dsd-input { padding-right: 6px; }
.dsd-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.dsd .dsd-color { width: 26px; height: 26px; padding: 0; border: 1px solid rgba(0, 0, 0, .15); border-radius: 50%; cursor: pointer; }
.dsd .dsd-color.is-active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111; }
.dsd .dsd-color-custom { width: 26px; height: 26px; padding: 0; border: 1px solid rgba(0, 0, 0, .15); border-radius: 50%; overflow: hidden; cursor: pointer; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.dsd .dsd-color-custom::-webkit-color-swatch-wrapper { padding: 0; }
.dsd .dsd-color-custom::-webkit-color-swatch { border: 0; opacity: 0; }
.dsd-image-tools { display: flex; flex-direction: column; gap: 0; }
.dsd-image-tools .dsd-seg { margin-bottom: 8px; }
.dsd-knock-level input[type="range"] { width: 100%; margin: 0 0 8px; accent-color: #111; }
.dsd-help { margin: 0; font-size: 12px; color: var(--dsd-ink-3); line-height: 1.45; }

/* Mensajes */
.dsd-quality:empty, .dsd-status:empty, .dsd-summary:empty { display: none; }
.dsd-quality, .dsd-status { padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.dsd-quality.is-warn { background: #fff6dd; color: #6b4e00; }
.dsd-quality.is-bad { background: #fde8e8; color: #8a1010; }
.dsd-status { background: var(--dsd-soft); color: var(--dsd-ink-2); font-weight: 500; }
.dsd-status.is-error { background: #fde8e8; color: #8a1010; }
.dsd-status.is-ok { background: #e7f6ec; color: #17633a; }
.dsd-summary { font-size: 14px; color: var(--dsd-ink-2); }

.dsd :focus-visible, .dsd-stage-wrap :focus-visible { outline: 2px solid #1a73e8; outline-offset: 2px; }

@media (max-width: 480px) {
    .dsd-add { grid-template-columns: 1fr 1fr; }
    .dsd .dsd-drop, .dsd .dsd-add-text { min-height: 84px; }
    .dsd-row { flex-direction: column; gap: 10px; }
}
