/* ===== MODO WIX: barra + marco que sigue al elemento agarrado ===== */

/* barra flotante abajo a la izquierda */
.editor-bar {
  position: fixed; left: 18px; bottom: 18px; z-index: 3000;
  display: flex; align-items: center; gap: 10px;
  background: rgba(15, 23, 42, .93); color: #fff;
  border-radius: 999px; padding: 8px 14px;
  font: 13px/1.2 "Segoe UI", system-ui, sans-serif;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
}
.editor-bar button {
  border: none; border-radius: 999px; padding: 8px 14px;
  font: 700 13px "Segoe UI", system-ui, sans-serif;
  background: var(--primary-green, #ACD036); color: #fff; cursor: pointer;
}
.editor-bar button.sec { background: #475569; }
.editor-bar button.on { background: #ef4444; }
.editor-bar .estado { opacity: .85; font-size: 12px; max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* sin mensaje no ocupa NADA (asi la barra no se estira y no tapa la barra de navegacion) */
.editor-bar .estado:empty { display: none; }

/* capa con el marco (no estorba: solo pinta) */
.capa-editor { position: fixed; inset: 0; z-index: 2500; pointer-events: none; }
.capa-editor .marco {
  position: absolute; display: none; pointer-events: none;
  outline: 2px dashed #ffd400; outline-offset: -1px;
  background: rgba(255, 212, 0, .07);
}
/* el elemento ya elegido con clic: marco solido */
.capa-editor .marco.elegido {
  outline: 3px solid var(--primary-green, #ACD036); outline-offset: -1px;
  background: rgba(172, 208, 54, .14);
}
.capa-editor .marco .etiqueta {
  position: absolute; left: 0; top: -19px; white-space: nowrap;
  background: #ffd400; color: #1f2937;
  font: 700 11px "Segoe UI", system-ui, sans-serif;
  padding: 1px 6px; border-radius: 5px;
}
.capa-editor .marco .grip {
  position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px;
  background: var(--primary-green, #ACD036); border: 2px solid #fff; border-radius: 4px;
  cursor: nwse-resize; pointer-events: auto;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}

/* en modo edicion el cursor invita a agarrar */
body.editando, body.editando * { cursor: move !important; }
/* los SVG (onda, iconos) hay que hacerlos agarrables en TODA su caja:
   por defecto solo la parte pintada recibe el clic */
body.editando svg { pointer-events: all !important; }
body.editando img { pointer-events: auto !important; }
/* mientras se escribe un texto, el cursor vuelve a la normalidad */
body.editando [contenteditable="true"], body.editando [contenteditable="true"] * { cursor: text !important; }

/* botones de accion de la barra */
.editor-bar button.acc { background: #334155; }
.editor-bar button.acc:hover { background: #475569; }

/* panel de iconos (se abre desde el boton "+ Icono") */
.editor-bar .panel {
  position: absolute; bottom: 52px; left: 0; width: 370px; display: none;
  background: rgba(15, 23, 42, .97); border: 1px solid #334155; border-radius: 14px;
  padding: 12px 14px 14px; box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
}
.editor-bar .panel.abierto { display: block; }
.editor-bar .panel .fila { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.editor-bar .panel .fila button.acc { font-size: 12px; padding: 7px 11px; }
.editor-bar .panel .muestra {
  width: 24px; height: 24px; border-radius: 6px; cursor: pointer;
  border: 3px solid transparent; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
}
.editor-bar .panel .muestra.activa { border-color: #fff; }
.editor-bar .panel input[type=color] {
  width: 32px; height: 28px; border: none; background: none; cursor: pointer; padding: 0;
}
.editor-bar .panel .titulo { font: 700 12px "Segoe UI", system-ui, sans-serif; color: #cbd5e1; margin-bottom: 8px; }
.editor-bar .panel .rejilla { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.editor-bar .panel .rejilla img {
  width: 100%; height: 36px; background: #fff; border-radius: 8px; padding: 4px;
  cursor: pointer; box-sizing: border-box;
}
.editor-bar .panel .rejilla img:hover { outline: 2px solid var(--primary-green, #ACD036); }
.editor-bar .panel button.sec { width: 100%; }

/* ===== la barra se puede RECOGER (para que no tape la vista) =====
   Recogida queda nada mas el botoncito "Editar" en la esquina, translucido. */
.editor-bar .pestana {
  order: -1;                       /* va primera en la barra cuando esta abierta */
  width: 34px; height: 34px; border-radius: 50%; padding: 0; flex: 0 0 auto;
  font-size: 15px; line-height: 1;
  background: #334155; color: #fff;
}
.editor-bar .pestana:hover { background: var(--primary-green, #ACD036); }
.editor-bar.mini {
  background: none; box-shadow: none; padding: 0; gap: 0; border-radius: 0;
}
.editor-bar.mini > *:not(.pestana) { display: none !important; }
.editor-bar.mini .pestana {
  position: absolute; left: 0; bottom: 0;
  width: 46px; height: 46px; font-size: 19px;
  background: rgba(15, 23, 42, .42);
  border: 1px solid rgba(255, 255, 255, .38);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
}
.editor-bar.mini .pestana:hover { background: rgba(15, 23, 42, .88); }
/* verde cuando el modo mover esta encendido (aunque este recogida) */
.editor-bar .pestana.on, .editor-bar.mini .pestana.on {
  background: var(--primary-green, #ACD036); border-color: #fff;
}

/* los iconos/imagenes que agrega el usuario */
#capaNuevos { position: static; }
#capaNuevos .nuevo-icono { display: block; }
#capaNuevos .nuevo-icono svg { display: block; width: 100%; height: auto; }

/* ===== el panel de iconos: ordenado, con aire y scroll (antes salia apretujado) ===== */
#panelIconos {
  max-height: 64vh;
  overflow-y: auto;
  min-width: 330px;
  padding: 14px 16px;
  box-sizing: border-box;
}
#panelIconos .titulo { margin: 12px 0 8px; display: block; }
#panelIconos .fila {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
#panelIconos .fila > * {
  flex: 0 0 auto;
}
#panelIconos img,
#panelIconos svg {
  width: 34px !important;
  height: 34px !important;
  display: block;
}
#panelIconos button {
  padding: 6px 8px;
  min-width: 0;
  line-height: 1;
}
#panelIconos button img,
#panelIconos button svg { pointer-events: none; }
