/* ============================================ */
/* MODO CUSTOMIZER (?customize=1 sobre la página) */
/* ============================================ */

.cz-section { position: relative; }

/* Outline naranja al hover (solo en customize mode) */
body.cz-mode .cz-section--editable:hover {
  outline: 3px dashed #FF6B35;
  outline-offset: -3px;
  cursor: pointer;
}
body.cz-mode .cz-section--editable {
  transition: outline 0.15s ease;
}

/* Icono "✎ Editar" flotante (azul circular como el de Mesmerize) */
.cz-section__edit-btn {
  position: absolute;
  top: 16px; left: 16px;
  width: 40px; height: 40px;
  display: none;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  color: white;
  font-size: 16px;
  border: 3px solid white;
  border-radius: 50%;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, background 0.15s ease;
}
body.cz-mode .cz-section--editable:hover > .cz-section__edit-btn {
  display: inline-flex;
  animation: czPulse 1.4s ease-in-out infinite;
}
.cz-section__edit-btn:hover {
  background: #1e40af;
  transform: scale(1.1);
  animation: none;
}
@keyframes czPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(37, 99, 235, 0.4); }
  50%      { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 8px rgba(37, 99, 235, 0); }
}

/* Etiqueta del nombre de la sección (esquina superior derecha) */
body.cz-mode .cz-section--editable::before {
  content: attr(data-section-name);
  position: absolute;
  top: 0; right: 0;
  padding: 4px 10px;
  background: #FF6B35;
  color: white;
  font-family: Inter, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 0 0 0 8px;
  display: none;
  pointer-events: none;
  z-index: 99;
}
body.cz-mode .cz-section--editable:hover::before {
  display: block;
}

/* ─────────────────────────────────────── */
/* CUSTOMIZER PANEL (lado izquierdo)       */
/* ─────────────────────────────────────── */

.cz-app {
  position: fixed;
  inset: 0;
  display: flex;
  background: #f0f0f1;
  font-family: Inter, system-ui, sans-serif;
  z-index: 100;
}
/* Cuando el customizer está montado, ocultar la topbar del admin para dar
   espacio al panel + iframe a pantalla completa. */
body:has(.cz-app) > div > header.border-b { display: none; }

.cz-panel {
  width: 320px;
  flex-shrink: 0;
  background: white;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.08);
  z-index: 10;
}

.cz-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e1e1e1;
  background: #1d2327;
  color: white;
  font-size: 13px;
}
.cz-panel__close {
  width: 32px; height: 32px;
  background: transparent;
  border: 0;
  color: white;
  font-size: 20px;
  cursor: pointer;
  border-radius: 4px;
  line-height: 1;
}
.cz-panel__close:hover { background: rgba(255, 255, 255, 0.1); }
.cz-panel__title {
  flex: 1;
  text-align: center;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #b1b5b8;
}
.cz-panel__publish {
  padding: 6px 14px;
  background: #FF6B35;
  color: white;
  border: 0;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}
.cz-panel__publish:hover { background: #e55620; }
.cz-panel__publish:disabled { opacity: 0.5; cursor: not-allowed; }
.cz-panel__publish--saved { background: #16a34a; }

.cz-panel__breadcrumb {
  padding: 14px 16px;
  border-bottom: 1px solid #e1e1e1;
  font-size: 12px;
  color: #50575e;
}
.cz-panel__breadcrumb-title {
  font-size: 14px;
  font-weight: 600;
  color: #1d2327;
  margin-top: 2px;
}

.cz-panel__body { flex: 1; overflow-y: auto; }

/* Lista de secciones */
.cz-section-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cz-section-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f1;
  background: white;
  transition: background 0.15s;
}
.cz-section-list li:hover { background: #f7f8f9; }
.cz-section-list li.cz-item--hidden {
  opacity: 0.5;
}
.cz-section-list li.cz-item--selected {
  background: #fff7ed;
  border-left: 3px solid #FF6B35;
  padding-left: 9px;
}
.cz-section-list li.cz-dragging {
  opacity: 0.5;
  background: #fff7ed;
}

.cz-drag-handle {
  cursor: grab;
  padding: 0 4px;
  color: #999;
  font-size: 14px;
  line-height: 1;
  user-select: none;
}
.cz-drag-handle:active { cursor: grabbing; }

.cz-item__label {
  flex: 1;
  min-width: 0;
}
.cz-item__name {
  font-size: 13px;
  font-weight: 600;
  color: #1d2327;
  display: block;
}
.cz-item__id {
  font-size: 11px;
  color: #50575e;
  font-family: ui-monospace, Menlo, monospace;
  display: block;
}
.cz-item__locked-badge {
  font-size: 10px;
  color: #999;
  margin-left: 4px;
}

.cz-item-actions {
  display: flex;
  gap: 4px;
}
.cz-item-actions button {
  width: 28px; height: 28px;
  border-radius: 4px;
  border: 0;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f1;
  color: #50575e;
  transition: background 0.15s, color 0.15s;
}
.cz-item-actions button:hover { background: #e0e0e0; }
.cz-item-actions button:disabled { opacity: 0.4; cursor: not-allowed; }
.cz-item-actions .cz-btn-show  { background: #16a34a; color: white; }
.cz-item-actions .cz-btn-hide  { background: #6b7280; color: white; }
.cz-item-actions .cz-btn-edit  { background: #2563eb; color: white; }
.cz-item-actions .cz-btn-del   { background: #dc2626; color: white; }
.cz-item-actions .cz-btn-add   { background: #16a34a; color: white; }
.cz-item-actions .cz-btn-show:hover  { background: #15803d; }
.cz-item-actions .cz-btn-hide:hover  { background: #4b5563; }
.cz-item-actions .cz-btn-edit:hover  { background: #1d4ed8; }
.cz-item-actions .cz-btn-del:hover   { background: #b91c1c; }
.cz-item-actions .cz-btn-add:hover   { background: #15803d; }

/* Sección "+ Añadir" */
.cz-add-section {
  padding: 12px;
  border-top: 1px solid #e1e1e1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fafbfc;
}
.cz-add-section__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  background: #FF6B35;
  color: white;
  border: 0;
  border-radius: 4px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.cz-add-section__btn:hover { background: #e55620; }

/* ─────────────────────────────────────── */
/* IFRAME WRAPPER                          */
/* ─────────────────────────────────────── */
.cz-frame-wrap {
  flex: 1;
  background: #1d2327;
  position: relative;
  overflow: hidden;
}
.cz-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
  display: block;
}

/* Toolbar inferior con device selector */
.cz-devices {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #1d2327;
  color: white;
  padding: 0 16px;
}
.cz-devices button {
  background: transparent;
  border: 1px solid #444;
  color: #ccc;
  width: 36px; height: 32px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}
.cz-devices button:hover { border-color: #777; color: white; }
.cz-devices button.cz-device-active { background: #FF6B35; border-color: #FF6B35; color: white; }

/* Estilos del bloque "Añadir secciones existentes (FAB)" — en customize mode dentro
   del iframe NO mostramos los FABs/overlays viejos para que sólo se vea el panel. */
body.cz-mode .bb-fab,
body.cz-mode .bb-edit-toolbar,
body.cz-mode .bb-edit-label,
body.cz-mode .bb-add {
  display: none !important;
}
