/* ══════════════════════════════════════════════════════════════════════════
 * STK-SHEETS-MOBILE.CSS v1.0.9 — Editor movil de hojas de pegatinas
 *
 * v1.0.9: aviso de resolucion sin rojo: marca "!" y medida siempre en ambar
 *         (tono de consejo, no de error).
 *
 * v1.0.8: tooltip de resolucion sin el punto de color: solo texto.
 *
 * v1.0.7: el aviso de resolucion es un tooltip oscuro con flecha (#stkms-tip),
 *         anclado a la pegatina; sustituye al aviso superior de v1.0.6.
 *
 * v1.0.6: huecos de carga (miniatura + spinner / error), avisos de resolucion
 *         (marca "!", etiqueta de medida en ambar/rojo, aviso superior) y
 *         dialogo de confirmacion. Se oculta el "Procesando..." antiguo.
 *
 * v1.0.5: el boton de anadir imagenes vuelve a la barra inferior (igual que
 *         troqueladas, estilo de stk-mobile-beta.css): se elimina el boton
 *         redondo propio de v1.0.4. Handles: ocultos sin excepcion si la
 *         pegatina no esta seleccionada.
 *
 * v1.0.4: boton redondo "anadir imagenes" con estilos PROPIOS de hojas.
 *         stk-mobile-beta.css v1.8.14 (troqueladas) convirtio .stkmb-change-chip
 *         en un boton de la barra inferior y en hojas quedaba invisible. Ahora
 *         hojas no depende de ese estilo: arriba a la derecha del lienzo.
 *
 * v1.0.3: fuera los estilos del chip de color del lienzo (eliminado).
 *
 * v1.0.2: tarjetas de tamano sin icono (solo el valor, centrado).
 *
 * v1.0.1: fondo gris del editor (sin franja blanca sobre la tira de
 *         pestanas cuando el panel esta plegado).
 *
 * Se carga SOLO en hojas-de-pegatinas, encima de stk-mobile.css y de
 * stk-mobile-beta.css (look aprobado de troqueladas, reutilizado sin tocar).
 * Viste: hoja en el lienzo, pegatinas + handles, tarjetas de tamano,
 * y drawer de color de hoja.
 * ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ── Lienzo: los gestos son nuestros (sin scroll/zoom del navegador) ── */
  .stkms #stkm-editor-stage {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    overflow: hidden;
  }

  /* ── v1.0.1: con el panel plegado no queda franja blanca sobre las pestanas ── */
  body.stkm-editor-open #stk-mobile.stkms #stkm-editor { background: #EDEDF2 !important; }

  /* ── Hoja ── */
  #stkms-sheet {
    position: absolute;
    left: 0; top: 0;
    width: 0; height: 0;
    z-index: 5;
  }
  #stkms-sheet-bg {
    position: absolute;
    inset: 0;
    background: #FFFFFF;
    box-shadow: 0 2px 14px rgba(0,0,0,0.12);
    pointer-events: none;
  }
  #stkms-items { position: absolute; inset: 0; }
  #stkms-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #9a9aa0;
    pointer-events: none;
  }
  #stkms-empty.stkms-hidden { display: none; }

  /* ── Pegatina ── */
  .stkms-item {
    position: absolute;
    transform-origin: 50% 50%;
  }
  .stkms-item > svg,
  .stkms-item > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    overflow: visible;
  }

  /* ── Handles (estetica del editor de hojas desktop) ── */
  .stkms-h { position: absolute; inset: -6px; pointer-events: none; display: none; }
  .stkms-item.stkms-sel .stkms-h { display: block; }
  .stkms-item:not(.stkms-sel) .stkms-h { display: none !important; visibility: hidden !important; }
  .stkms-hb { position: absolute; inset: 0; border: 1.5px solid #6C5CE7; }
  .stkms-rl {
    position: absolute; left: 50%; top: -22px;
    width: 1px; height: 22px; background: #6C5CE7;
  }
  .stkms-c, .stkms-rot, .stkms-del {
    position: absolute;
    pointer-events: auto;
    border-radius: 50%;
    box-sizing: border-box;
  }
  .stkms-c {
    width: 14px; height: 14px;
    background: #fff;
    border: 2px solid #6C5CE7;
  }
  .stkms-c.nw { left: -7px;  top: -7px; }
  .stkms-c.ne { right: -7px; top: -7px; }
  .stkms-c.sw { left: -7px;  bottom: -7px; }
  .stkms-c.se { right: -7px; bottom: -7px; }
  .stkms-rot {
    left: 50%; top: -36px;
    width: 16px; height: 16px;
    margin-left: -8px;
    background: #6C5CE7;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  }
  .stkms-del {
    right: -14px; top: 14px;
    width: 28px; height: 28px;
    background: #fff;
    border: 2px solid #e0e0e0;
  }
  .stkms-del::before, .stkms-del::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    width: 10px; height: 2.5px; background: #ff3b30; border-radius: 1px;
  }
  .stkms-del::before { transform: translate(-50%,-50%) rotate(45deg); }
  .stkms-del::after  { transform: translate(-50%,-50%) rotate(-45deg); }
  /* zona de toque ampliada (44px) para los dedos */
  .stkms-c > i, .stkms-rot > i {
    position: absolute; left: 50%; top: 50%;
    width: 44px; height: 44px; margin: -22px 0 0 -22px;
    border-radius: 50%;
  }
  .stkms-dim {
    position: absolute; left: 50%; bottom: -24px;
    transform: translateX(-50%);
    font-size: 11px; font-weight: 700; color: #6C5CE7;
    white-space: nowrap; pointer-events: none;
  }

  /* ── v1.0.6: hueco de carga ── */
  .stkms #stkm-loading { display: none !important; }
  .stkms-ph {
    position: absolute; z-index: 9000;
    border-radius: 10px; overflow: hidden;
    background: #E9E9EE;
    box-shadow: inset 0 0 0 1.5px rgba(108,92,231,0.35);
  }
  .stkms-ph > img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; opacity: 0.35; pointer-events: none;
  }
  .stkms-ph > img:not([src]) { display: none; }
  .stkms-spin {
    position: absolute; left: 50%; top: 50%;
    width: 30px; height: 30px; margin: -15px 0 0 -15px;
    border-radius: 50%;
    border: 3px solid rgba(108,92,231,0.25); border-top-color: #6C5CE7;
    animation: stkms-spin 0.8s linear infinite;
  }
  @keyframes stkms-spin { to { transform: rotate(360deg); } }
  .stkms-ph-err { display: none; }
  .stkms-ph-fail { box-shadow: inset 0 0 0 1.5px #ff3b30; background: #FDECEC; }
  .stkms-ph-fail > img { opacity: 0.15; }
  .stkms-ph-fail .stkms-spin { display: none; }
  .stkms-ph-fail .stkms-ph-err {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    padding: 6px; text-align: center;
    font-size: 11px; font-weight: 700; color: #c62828;
  }
  .stkms-ph-err b {
    padding: 6px 12px; border-radius: 9px;
    background: #141416; color: #fff; font-size: 11px; font-weight: 700;
  }
  .stkms-ph-err b[data-pa="x"] { background: transparent; color: #141416; padding: 2px 8px; font-weight: 600; text-decoration: underline; }

  /* ── v1.0.6: aviso de resolucion ── */
  .stkms-q {
    display: none;
    position: absolute; left: -8px; top: -8px; z-index: 3;
    width: 20px; height: 20px; border-radius: 50%;
    align-items: center; justify-content: center;
    font: 800 13px/1 system-ui, -apple-system, sans-serif; font-style: normal;
    color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    pointer-events: none;
  }
  .stkms-q-warn > .stkms-q { display: flex; background: #F2A100; }
  .stkms-q-bad  > .stkms-q { display: flex; background: #F2A100; }
  .stkms-item.stkms-sel > .stkms-q { display: none; }
  .stkms-q-warn .stkms-dim { color: #B97A00; }
  .stkms-q-bad  .stkms-dim { color: #B97A00; }
  /* v1.0.7: tooltip de resolucion */
  #stkms-tip {
    display: none;
    position: absolute; left: 0; top: 0; z-index: 27;
    max-width: 216px; box-sizing: border-box;
    padding: 9px 12px 10px;
    border-radius: 12px;
    background: #1F2026; color: rgba(255,255,255,0.86);
    font: 400 11.5px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.01em;
    box-shadow: 0 6px 20px rgba(0,0,0,0.22);
    pointer-events: none;
  }
  #stkms-tip.on { display: block; }
  #stkms-tip b {
    display: block;
    margin-bottom: 2px;
    font-weight: 600; font-size: 12px; color: #fff;
  }
  #stkms-tip > i {
    position: absolute; left: 50%;
    width: 12px; height: 12px; margin-left: -6px;
    background: #1F2026; border-radius: 2px;
    transform: rotate(45deg);
  }
  #stkms-tip.up > i   { bottom: -5px; }
  #stkms-tip.down > i { top: -5px; }
  #stkms-tip.in > i   { display: none; }

  /* ── v1.0.6: confirmacion al anadir con baja resolucion ── */
  #stkms-confirm {
    position: fixed; inset: 0; z-index: 100000;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(0,0,0,0.45);
  }
  .stkms-confirm-box {
    width: 100%; box-sizing: border-box;
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
    background: #fff; border-radius: 18px 18px 0 0;
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  }
  .stkms-confirm-box strong { grid-column: 1 / -1; font-size: 15px; color: #141416; }
  .stkms-confirm-box p { grid-column: 1 / -1; margin: 0 0 6px; font-size: 13px; line-height: 1.4; color: #55555A; }
  .stkms-confirm-box p em { font-style: normal; font-weight: 800; color: #F2A100; }
  .stkms-confirm-box button {
    height: 50px; border: 0; border-radius: 14px;
    font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
    background: #EFEFF1; color: #141416;
  }
  .stkms-confirm-box button[data-r="1"] { background: #18A14A; color: #fff; }

  /* ── Drawer de color de hoja ── */
  .stkms-colors {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px 10px;
    padding: 6px 0 calc(16px + env(safe-area-inset-bottom));
  }
  .stkms-swatch {
    justify-self: center;
    width: 40px; height: 40px;
    padding: 0;
    border-radius: 50% !important;
    border: 1.5px solid #dcdce0 !important;
    cursor: pointer;
  }
  .stkms-swatch.active { box-shadow: 0 0 0 3px #fff, 0 0 0 5px #141416; }

  /* ── Pestana Tamano: 3 tarjetas sobre la banda de Formas ── */
  .stkmb-shapes.stkms-sizes { grid-template-columns: repeat(3, 1fr); }
  .stkms-sizes .stkmb-shape-card { padding: 16px 4px; justify-content: center; }

  /* ── Tirada: una sola fila a todo el ancho ── */
  .stkmb-rows .stkmb-row.stkms-row--full { grid-column: 1 / -1; }
}
