/**
 * stk-sheets.css — Editor de Láminas de Pegatinas v2.1
 * Estilos para el modo hojas-de-pegatinas.
 * Solo aplica cuando .stks-active está presente en #stk-stage y #stk-editor.
 */

/* ═══ OCULTAR ELEMENTOS DE TROQUELADAS EN MODO LÁMINAS ═══ */
/* El tilt-wrapper, preview y efectos de stk-desktop no aplican en láminas */
#stk-stage.stks-active #stk-tilt-wrapper  { display: none !important; }
#stk-stage.stks-active #stk-preview       { display: none !important; }
#stk-stage.stks-active .stk-shine         { display: none !important; }
#stk-stage.stks-active .stk-glare         { display: none !important; }
#stk-stage.stks-active .stk-sparkle       { display: none !important; }
#stk-stage.stks-active #stk-border-controls { display: none !important; }
#stk-stage.stks-active .stk-vinyl-colors  { display: none !important; }
/* Botones flotantes de troqueladas — ocultamos los que NO reutilizamos.
   Reutilizamos: borde (color del vinilo), clipart, texto. */
#stk-stage.stks-active ~ #stk-edit-float-btn   { display: none !important; }
#stk-stage.stks-active ~ #stk-grosor-float-btn { display: none !important; }
/* #stk-borde-float-btn, #stk-text-float-btn, #stk-clipart-float-btn — VISIBLES en láminas */
/* #stk-fondo-float-btn — VISIBLE solo en láminas (oculto por defecto en PHP) */
#stk-stage.stks-active ~ #stk-fondo-float-btn { display: flex !important; }

#stk-fondo-float-btn {
  position: absolute;
  top: 430px;
  right: 80px;
  left: auto;
  z-index: 30;
  width: 50px;
  height: 50px;
  background: #1f1f21 !important;
  border: none !important;
  border-radius: 10px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 16px 48px rgba(0,0,0,0.55), 0 0 0 0.5px rgba(255,255,255,0.09);
  transition: box-shadow .15s;
  padding: 0 !important;
  gap: 0 !important;
  color: #fff !important;
}
#stk-fondo-float-btn:hover svg path { fill: #f5c518 !important; }
#stk-fondo-float-btn svg { display: block; width: 22px; height: 22px; min-width: 22px; flex-shrink: 0; }

/* ═══ PANEL FONDO — igual que stk-borde-panel ═══ */
#stk-fondo-panel {
  display: none;
  position: absolute !important;
  right: 148px !important;
  left: auto !important;
  top: 418px !important;
  z-index: 60 !important;
  width: 260px !important;
  height: auto;
  background: #2a2a2c;
  border: none;
  border-radius: 18px;
  padding: 0 0 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  box-shadow: 0 16px 48px rgba(0,0,0,0.55), 0 0 0 0.5px rgba(255,255,255,0.09);
  cursor: default;
  user-select: none;
  overflow: visible;
}
#stk-fondo-panel.open { display: block; }
#stk-fondo-panel::before {
  content: "";
  position: absolute;
  top: 31px;
  right: -10px;
  left: auto;
  width: 0; height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 10px solid #2a2a2c;
  filter: drop-shadow(2px 0 3px rgba(0,0,0,0.2));
  z-index: 1;
}

/* Botón cerrar — idéntico a #stk-borde-close */
#stk-fondo-close {
  border: none !important; background: none !important; font-size: 18px !important;
  cursor: pointer !important; color: rgba(255,255,255,0.42) !important;
  padding: 10px !important; margin: -10px !important; line-height: 1 !important;
  border-radius: 0 !important; width: auto !important; height: auto !important;
  min-width: 0 !important;
}
#stk-fondo-close:hover { color: rgba(255,255,255,0.55) !important; }

/* Grid de colores — idéntico a .stk-borde-colors */
.stk-fondo-colors {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  row-gap: 12px;
  padding: 0;
}

/* Swatches — idénticos a .stk-borde-swatch */
.stk-fondo-swatch {
  width: 100%;
  max-width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  justify-self: center;
  align-self: center;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
  transition: transform .12s, box-shadow .12s;
}
.stk-fondo-swatch:hover { transform: scale(1.1); }
.stk-fondo-swatch.active { box-shadow: 0 0 0 3px #2a2a2c, 0 0 0 5px rgba(255,255,255,0.6); }
.stk-fondo-swatch[data-white="1"] { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
.stk-fondo-swatch[data-white="1"].active { box-shadow: 0 0 0 3px #2a2a2c, 0 0 0 5px rgba(255,255,255,0.6); }

/* ═══ HOJA ═══ */
#stks-sheet-bg {
  position: absolute;
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  pointer-events: none;
  z-index: 0;
}

#stks-sheet {
  position: absolute;
  z-index: 1;
  overflow: hidden;
}

/* ═══ PLACEHOLDER ═══ */
#stks-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #999;
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
  z-index: 2;
}
#stks-placeholder.stks-hidden { display: none !important; }

/* ═══ STICKER ITEM ═══ */
.stks-item {
  position: absolute;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.stks-item:active { cursor: grabbing; }

.stks-item img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  object-fit: contain;
}

/* ═══ LOADING SPINNER ═══ */
.stks-loading {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.6);
  border-radius: 4px;
}
.stks-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e0e0e0;
  border-top-color: #1a73e8;
  border-radius: 50%;
  animation: stks-spin 0.7s linear infinite;
}
@keyframes stks-spin { to { transform: rotate(360deg); } }

/* ═══ HANDLES — misma estética que stk-handles.js ═══ */
/* Colores: #6C5CE7 activo, #ff3b30 delete, #fff corners */
.stks-handles {
  position: absolute;
  inset: -8px;
  pointer-events: none;
}
.stks-item.stks-selected .stks-handles { display: block; }
.stks-item:not(.stks-selected) .stks-handles { display: none; }

/* Borde activo — mismo color que stk-handles.js STYLES.ACTIVE */
.stks-handles-border {
  position: absolute;
  inset: 0;
  border: 1.5px solid #6C5CE7;
  pointer-events: none;
}

/* Línea al handle de rotación */
.stks-rotate-line {
  position: absolute;
  top: -20px;
  left: 50%;
  width: 1px;
  height: 20px;
  background: #6C5CE7;
  transform: translateX(-50%);
  pointer-events: none;
}

/* Handles genéricos — mismo estilo que corners de stk-handles.js */
.stks-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid #6C5CE7;
  border-radius: 50%;
  pointer-events: all;
}

/* Ocultar handles laterales — solo corners activos (resize proporcional) */
.stks-handle-n,
.stks-handle-s,
.stks-handle-e,
.stks-handle-w { display: none !important; }

/* Posiciones resize */
.stks-handle-nw { top: -5px;  left: -5px;  cursor: nw-resize; }
.stks-handle-ne { top: -5px;  right: -5px; cursor: ne-resize; }
.stks-handle-sw { bottom: -5px; left: -5px;  cursor: sw-resize; }
.stks-handle-se { bottom: -5px; right: -5px; cursor: se-resize; }

/* Hit area ampliado a 44x44 para que sea fácil agarrar las esquinas */
.stks-handle-nw::after,
.stks-handle-ne::after,
.stks-handle-sw::after,
.stks-handle-se::after {
  content: '';
  position: absolute;
  width: 44px;
  height: 44px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  cursor: inherit;
}

.stks-handle-n  { top: -5px;  left: 50%; transform: translateX(-50%); cursor: n-resize; }
.stks-handle-s  { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.stks-handle-w  { top: 50%; left: -5px;  transform: translateY(-50%); cursor: w-resize; }
.stks-handle-e  { top: 50%; right: -5px; transform: translateY(-50%); cursor: e-resize; }

/* Rotación — círculo sólido #6C5CE7 igual que corners activos */
.stks-handle-rotate {
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  cursor: grab;
  background: #6C5CE7;
  border: 2px solid #fff;
  width: 12px;
  height: 12px;
}
.stks-handle-rotate:active { cursor: grabbing; }

/* Hit area ampliado para rotar — mismo que corners */
.stks-handle-rotate::after {
  content: '';
  position: absolute;
  width: 44px;
  height: 44px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  cursor: inherit;
}

/* Borrar — 30×30 fondo blanco, icono rojo — separado 15px de la esquina */
.stks-handle-delete {
  top: 15px;
  right: -14px;
  bottom: auto;
  left: auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #e0e0e0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stks-handle-delete::before,
.stks-handle-delete::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 10px; height: 2.5px;
  background: #ff3b30;
  border-radius: 1px;
}
.stks-handle-delete::before { transform: translate(-50%,-50%) rotate(45deg); }
.stks-handle-delete::after  { transform: translate(-50%,-50%) rotate(-45deg); }

/* Duplicar — oculto */
.stks-handle-duplicate { display: none !important; }

/* ═══ DIMENSIONES ═══ */
.stks-dimensions {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  color: #1a73e8;
  white-space: nowrap;
  pointer-events: none;
}

/* ═══ BOTÓN ORIENTACIÓN ═══ */
#stks-orient-btn {
  display: none !important;
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.12s;
}
#stks-orient-btn:hover { background: #f0f0f0; }
#stks-orient-btn:disabled { opacity: 0.4; cursor: not-allowed; }
/* ═══ ICON STATE — panel abierto → icono rojo (igual que stk-desktop.css) ═══ */
.stk-canvas-area:has(#stk-fondo-panel.open) #stk-fondo-float-btn svg path { fill: #ff3b30 !important; }

/* ═══ BOTÓN COLOR — siempre visible en láminas (material es global de la hoja) ═══ */

/* ═══ SWATCH TRANSPARENTE — círculo blanco con línea roja diagonal ═══ */
.stk-borde-swatch--transparent {
  background: #ffffff !important;
  position: relative;
  overflow: hidden;
}
.stk-borde-swatch--transparent::after {
  content: '';
  position: absolute;
  top: 50%;
  left: -10%;
  width: 120%;
  height: 2px;
  background: #ff3b30;
  transform: rotate(-45deg);
  transform-origin: center;
  pointer-events: none;
}

/* ═══ TOOLBAR RESPONSIVE — [T] [Clipart] --- espacio --- [AÑADIR IMAGEN] ═══ */
#stks-editor-layout { display: flex; flex-direction: column; align-items: stretch; position: relative; }
#stks-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
#stks-toolbar-left { display: flex; gap: 8px; }
#stks-toolbar-right { display: flex; }
#stks-toolbar #stk-text-float-btn,
#stks-toolbar #stk-clipart-float-btn {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
}

/* ═══ BOTÓN AÑADIR IMAGEN — esquina derecha del toolbar ═══ */
.stks-active .stk-topbar-change {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  height: 50px !important;
  background: #1f1f21 !important;
  border: none !important;
  border-radius: 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 24px !important;
  gap: 6px !important;
  box-shadow: 0 16px 48px rgba(0,0,0,0.55), 0 0 0 0.5px rgba(255,255,255,0.09) !important;
  cursor: pointer !important;
}
.stks-active .stk-topbar-change svg {
  display: block !important;
  width: 20px !important;
  height: 20px !important;
}
.stks-active .stk-topbar-change svg,
.stks-active .stk-topbar-change svg path,
.stks-active .stk-topbar-change svg line { stroke: #f5c518 !important; }
.stks-active .stk-topbar-change span {
  color: #f5c518 !important;
  display: block !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  text-transform: uppercase !important;
  font-family: "Inter Tight", sans-serif !important;
}
.stks-active .stk-topbar-change .stk-sidebar-label { display: none !important; }
.stks-active .stk-topbar-change input {
  position: absolute !important;
  inset: 0 !important;
  opacity: 0 !important;
  cursor: pointer !important;
}
.stks-active .stk-topbar-change:hover svg,
.stks-active .stk-topbar-change:hover svg path,
.stks-active .stk-topbar-change:hover svg line { stroke: #ff3b30 !important; }
.stks-active .stk-topbar-change:hover span { color: #ff3b30 !important; }

/* ═══ OCULTAR EDITAR y GROSOR en láminas — no afecta troqueladas ═══ */
.stks-active #stk-edit-float-btn { display: none !important; }
.stks-active #stk-grosor-float-btn { display: none !important; }

/* ═══ LABELS DE CM — debajo y al lado del stage ═══ */
#stks-label-width {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #000;
  font-family: "Inter Tight", sans-serif;
  margin-top: 8px;
  pointer-events: none;
}
#stks-label-height {
  position: absolute;
  font-size: 13px;
  font-weight: 600;
  color: #000;
  font-family: "Inter Tight", sans-serif;
  transform: rotate(-90deg);
  white-space: nowrap;
  pointer-events: none;
}

/* ═══ OCULTAR CONTENIDO WP DEBAJO DEL EDITOR ═══ */
body.stk-editor-open .entry-content > *:not(.stk-desktop-widget) { display: none !important; }



/* ── Botón AÑADIR IMAGEN en toolbar láminas v3 ── */
#stks-toolbar-right .stk-topbar-change {
  display: flex !important;
  align-items: center;
  gap: 6px;
  height: 50px;
  padding: 0 16px;
  background: #1f1f21;
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  border: none;
  text-transform: uppercase;
  white-space: nowrap;
  box-sizing: border-box;
  position: relative;
}
#stks-toolbar-right .stk-topbar-change:hover { background: #e53935; }
#stks-toolbar-right .stk-topbar-change svg { stroke: #fff; flex-shrink: 0; }
#stks-toolbar-right .stk-topbar-change span { color: #fff; }
#stks-toolbar-right .stk-topbar-change input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
/* ── Hover botón AÑADIR IMAGEN — texto e icono rojos ── */
#stks-toolbar-right .stk-topbar-change:hover {
  background: #1f1f21 !important;
}
#stks-toolbar-right .stk-topbar-change:hover span {
  color: #ff3b30 !important;
}
#stks-toolbar-right .stk-topbar-change:hover svg {
  stroke: #ff3b30 !important;
}

/* ═══ TOPBAR PADDING PARA SUBTITULO ═══ */
.stk-topbar { padding-top: 60px !important; }

body.stk-editor-open .entry-content > .elementor { display: block !important; }
body.stk-editor-open .entry-content > .elementor > .elementor-element:not(:has(.stk-desktop-widget)) { display: none !important; }
body.stk-editor-open .entry-content > .elementor > .elementor-element:has(.stk-desktop-widget) { padding: 0 !important; }
