/* ============================================================
   LAYOUT-EDITOR.CSS — Estoy Libre Visual Page Builder
   ============================================================ */

/* ── Overlay ── */
#le-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  background: #0d0d0d;
  flex-direction: column;
  font-family: 'Space Mono', monospace;
  color: #f0ece3;
  overflow: hidden;
  cursor: auto; /* restore real cursor inside the editor */
}

/* Suppress ghost trail dots while the editor is open */
body.le-editor-open .ghost-trail { display: none !important; }
/* Don't block pointer-events on interactive elements */
#le-overlay button,
#le-overlay select,
#le-overlay input,
#le-overlay textarea,
#le-overlay label,
#le-overlay .le-palette-item,
#le-overlay .le-layer-row,
#le-overlay .le-align-btn {
  cursor: pointer;
  pointer-events: auto;
}

/* Text inputs get a text cursor */
#le-overlay input[type="text"],
#le-overlay input[type="number"],
#le-overlay textarea {
  cursor: text;
}

/* ── Toolbar ── */
#le-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #111;
  border-bottom: 1px solid #2a2a2a;
  padding: 0 12px;
  height: 44px;
  flex-shrink: 0;
  gap: 8px;
}
#le-toolbar-left, #le-toolbar-center, #le-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
#le-brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 14px;
  letter-spacing: 3px;
  color: #e8ff00;
  margin-right: 10px;
  white-space: nowrap;
}
#le-page-select {
  background: #1a1a1a;
  color: #f0ece3;
  border: 1px solid #2e2e2e;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  padding: 4px 8px;
  height: 28px;
  text-transform: uppercase;
  cursor: pointer !important;
}
.le-tbtn {
  background: #1a1a1a;
  color: #f0ece3;
  border: 1px solid #2e2e2e;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  padding: 4px 10px;
  height: 28px;
  cursor: pointer !important;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.le-tbtn:hover { background: #2a2a2a; color: #e8ff00; border-color: #e8ff00; }
.le-tbtn:disabled { opacity: 0.3; cursor: not-allowed !important; }
.le-save-btn { background: #e8ff00; color: #080808; font-weight: 700; border-color: #e8ff00; }
.le-save-btn:hover { background: #fff; color: #080808; border-color: #fff; }
.le-close-btn { font-size: 13px; padding: 4px 8px; }
#le-preview-btn { border-color: #555; }
#le-preview-btn.le-preview-active { color: #ff3c00 !important; border-color: #ff3c00 !important; }
.le-sep { width: 1px; height: 20px; background: #2e2e2e; margin: 0 2px; }
.le-snap-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  letter-spacing: 1px;
  cursor: pointer !important;
  color: #aaa;
}
.le-snap-label input[type="checkbox"] { margin: 0; accent-color: #e8ff00; cursor: pointer !important; }
#le-zoom-label { font-size: 10px; letter-spacing: 2px; min-width: 42px; text-align: center; color: #aaa; }

/* ── Body ── */
#le-body { display: flex; flex: 1; overflow: hidden; }

/* ── Left: Palette ── */
#le-palette {
  width: 168px;
  flex-shrink: 0;
  background: #111;
  border-right: 1px solid #2a2a2a;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: width 0.2s ease, padding 0.2s ease;
}
#le-palette.le-collapsed {
  width: 36px;
  padding: 10px 4px;
  overflow: hidden;
}
#le-palette.le-collapsed .le-panel-hdr,
#le-palette.le-collapsed .le-palette-item .le-pal-label,
#le-palette.le-collapsed #le-layers,
#le-palette.le-collapsed .le-layer-row .le-layer-name,
#le-palette.le-collapsed .le-layer-row .le-layer-del {
  display: none;
}
#le-palette.le-collapsed .le-palette-item {
  justify-content: center;
  padding: 7px 4px;
}
#le-collapse-btn {
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  color: #e8ff00;
  font-size: 12px;
  width: 100%;
  height: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 6px;
  transition: background 0.15s;
}
#le-collapse-btn:hover { background: #2a2a2a; }
.le-panel-hdr {
  font-size: 8px;
  letter-spacing: 3px;
  color: #666;
  text-transform: uppercase;
  padding: 6px 4px 4px;
  border-bottom: 1px solid #1e1e1e;
  margin-bottom: 4px;
}
.le-palette-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  cursor: grab !important;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.le-palette-item:hover { background: #222; border-color: #e8ff00; }
.le-pal-icon { font-size: 11px; font-weight: 700; color: #e8ff00; min-width: 18px; text-align: center; }
.le-pal-label { font-size: 9px; letter-spacing: 1px; color: #ccc; text-transform: uppercase; }

/* ── Layers panel ── */
#le-layers { display: flex; flex-direction: column; gap: 2px; }
.le-layer-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: #1a1a1a;
  border: 1px solid transparent;
  cursor: pointer !important;
  font-size: 9px;
  letter-spacing: 1px;
  color: #aaa;
  transition: background 0.1s;
}
.le-layer-row:hover { background: #222; color: #f0ece3; border-color: #444; }
.le-layer-row.active { border-color: #e8ff00; color: #f0ece3; background: #1e1e14; }
.le-layer-icon { font-size: 9px; color: #e8ff00; min-width: 14px; }
.le-layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.le-layer-del {
  background: none;
  border: 1px solid transparent;
  color: #ff3c00;
  cursor: pointer !important;
  font-size: 10px;
  padding: 1px 4px;
  opacity: 0;
  transition: opacity 0.1s, background 0.1s;
}
.le-layer-row:hover .le-layer-del { opacity: 1; }
.le-layer-del:hover { background: #ff3c00; color: #fff; border-color: #ff3c00; }

/* ── Center: Canvas area ── */
#le-canvas-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: visible;
  background: #161616;
}
#le-canvas-scroller {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 24px;
}
#le-canvas {
  position: relative;
  width: 1200px;
  min-height: 800px;
  background: #0a0a0a;
  box-shadow: 0 0 60px rgba(0,0,0,0.6);
  flex-shrink: 0;
  transform-origin: top left;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 20px 20px;
}
#le-grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
#le-canvas-hint {
  text-align: center;
  font-size: 8px;
  letter-spacing: 2px;
  color: #333;
  padding: 8px;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ── Blocks ── */
.le-block {
  position: absolute;
  box-sizing: border-box;
  cursor: grab !important;
  /* Always show blocks — dashed outline even when not selected */
  outline: 1px dashed rgba(255,255,255,0.15);
}
.le-block:hover {
  outline: 1px dashed rgba(232,255,0,0.6) !important;
}
.le-block.le-selected {
  outline: 2px solid #e8ff00 !important;
}

/* Drag handle (visual indicator top-left, visible on hover/select) */
.le-drag-handle {
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(232,255,0,0.9);
  color: #080808;
  font-size: 9px;
  padding: 1px 5px;
  z-index: 200;
  display: none;
  line-height: 14px;
  user-select: none;
  pointer-events: none;
}
.le-block:hover .le-drag-handle,
.le-selected .le-drag-handle { display: block; }

/* Block toolbar — show on hover AND on select */
.le-block-toolbar {
  position: absolute;
  bottom: -32px;
  right: 0;
  display: none;
  gap: 2px;
  background: #111;
  border: 1px solid #2a2a2a;
  padding: 2px;
  z-index: 201;
  white-space: nowrap;
}
.le-block:hover .le-block-toolbar,
.le-selected .le-block-toolbar { display: flex; }
.le-block-toolbar button {
  background: #1a1a1a;
  color: #f0ece3;
  border: none;
  font-size: 10px;
  padding: 3px 7px;
  cursor: pointer !important;
  transition: background 0.1s, color 0.1s;
}
.le-block-toolbar button:hover { background: #2e2e2e; color: #e8ff00; }
.le-block-toolbar button[title="Delete"]:hover { background: #ff3c00 !important; color: #fff !important; }

/* Resize handles — only on selected */
.le-resize-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #e8ff00;
  border: 1px solid #080808;
  z-index: 202;
  display: none;
}
.le-selected .le-resize-handle { display: block; }
.le-resize-n  { top: -4px; left: calc(50% - 4px); cursor: n-resize !important; }
.le-resize-s  { bottom: -4px; left: calc(50% - 4px); cursor: s-resize !important; }
.le-resize-e  { right: -4px; top: calc(50% - 4px); cursor: e-resize !important; }
.le-resize-w  { left: -4px; top: calc(50% - 4px); cursor: w-resize !important; }
.le-resize-ne { top: -4px; right: -4px; cursor: ne-resize !important; }
.le-resize-nw { top: -4px; left: -4px; cursor: nw-resize !important; }
.le-resize-se { bottom: -4px; right: -4px; cursor: se-resize !important; }
.le-resize-sw { bottom: -4px; left: -4px; cursor: sw-resize !important; }

/* ── Right: Properties ── */
#le-properties {
  width: 260px;
  flex-shrink: 0;
  background: #111;
  border-left: 1px solid #2a2a2a;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
}
#le-properties.le-collapsed {
  width: 36px;
  overflow: hidden;
}
#le-properties.le-collapsed > *:not(#le-prop-collapse-btn) {
  display: none;
}
#le-prop-collapse-btn {
  background: #1a1a1a;
  border: none;
  border-bottom: 1px solid #2e2e2e;
  color: #e8ff00;
  font-size: 12px;
  width: 100%;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
#le-prop-collapse-btn:hover { background: #2a2a2a; }
#le-properties-inner { padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.le-no-sel {
  font-size: 9px; letter-spacing: 1px; color: #555;
  text-transform: uppercase; text-align: center; padding: 24px 8px; line-height: 1.8;
}
.le-prop-group {
  background: #161616; border: 1px solid #2a2a2a; padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.le-prop-hdr {
  font-size: 8px; letter-spacing: 2px; color: #e8ff00;
  text-transform: uppercase; padding-bottom: 4px;
  border-bottom: 1px solid #2a2a2a; margin-bottom: 2px;
}
.le-prop-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.le-prop-row.le-col { flex-direction: column; align-items: stretch; gap: 3px; }
.le-prop-row label {
  font-size: 8px; letter-spacing: 1px; color: #888;
  text-transform: uppercase; min-width: 50px; flex-shrink: 0;
}
.le-prop-row input[type="text"],
.le-prop-row input[type="number"],
.le-prop-row select,
.le-prop-row textarea {
  background: #1a1a1a; color: #f0ece3; border: 1px solid #2e2e2e;
  font-family: 'Space Mono', monospace; font-size: 9px; padding: 4px 6px;
  flex: 1; min-width: 0; transition: border-color 0.1s;
}
.le-prop-row input[type="text"],
.le-prop-row input[type="number"],
.le-prop-row textarea { cursor: text !important; }
.le-prop-row select,
.le-prop-row input[type="range"],
.le-prop-row input[type="color"],
.le-prop-row input[type="checkbox"],
.le-prop-row input[type="file"] { cursor: pointer !important; }
.le-prop-row input[type="text"]:focus,
.le-prop-row input[type="number"]:focus,
.le-prop-row textarea:focus {
  outline: none; border-color: #e8ff00;
  box-shadow: 0 0 0 2px rgba(232,255,0,0.15);
  caret-color: #e8ff00; color: #fff;
}
.le-prop-row select:focus { outline: none; border-color: #e8ff00; }
.le-prop-row textarea { min-height: 60px; height: auto; resize: vertical; overflow-y: hidden; }
.le-prop-row input[type="range"] { flex: 1; accent-color: #e8ff00; }
.le-prop-btn {
  background: #1a1a1a; color: #f0ece3; border: 1px solid #2e2e2e;
  font-family: 'Space Mono', monospace; font-size: 8px; letter-spacing: 1px;
  padding: 5px 10px; cursor: pointer !important; text-transform: uppercase;
  width: 100%; transition: background 0.1s;
}
.le-prop-btn:hover { background: #2e2e2e; color: #e8ff00; }
.le-prop-btn.le-danger { color: #ff3c00; border-color: #ff3c00; }
.le-prop-btn.le-danger:hover { background: #ff3c00; color: #fff; }
.le-align-btn {
  background: #1a1a1a; color: #f0ece3; border: 1px solid #2e2e2e;
  font-size: 12px; width: 28px; height: 28px;
  cursor: pointer !important;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
}
.le-align-btn:hover { background: #2e2e2e; }
.le-align-btn.active { background: #e8ff00; color: #080808; border-color: #e8ff00; }
.le-img-placeholder { border: 1px dashed #2e2e2e; }
.le-spacer-inner { border: 1px dashed #1e1e1e; }

/* ── Live Preview ── */
#le-preview-pane {
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  background: #0a0a0a;
}
#le-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: #111;
  border-bottom: 1px solid #2a2a2a;
  flex-shrink: 0;
  font-size: 8px;
  letter-spacing: 3px;
  color: #e8ff00;
  text-transform: uppercase;
}
#le-preview-iframe {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Scrollbars ── */
#le-palette::-webkit-scrollbar,
#le-properties::-webkit-scrollbar,
#le-canvas-scroller::-webkit-scrollbar { width: 5px; height: 5px; }
#le-palette::-webkit-scrollbar-track,
#le-properties::-webkit-scrollbar-track,
#le-canvas-scroller::-webkit-scrollbar-track { background: #0d0d0d; }
#le-palette::-webkit-scrollbar-thumb,
#le-properties::-webkit-scrollbar-thumb,
#le-canvas-scroller::-webkit-scrollbar-thumb { background: #2e2e2e; border-radius: 3px; }
