/* =========================================================
   Bootcamp TEF·AQ — Editor visual del sitio (estilo "builder")
   Todo lo de aquí solo se activa cuando el modo edición está encendido.
   No afecta la apariencia del sitio para visitantes normales.
   ========================================================= */

.editor-ui { font-family: "Inter", "Segoe UI", system-ui, sans-serif; }

/* ---------- Botón flotante para abrir el editor ---------- */

.editor-launcher {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 9998;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: #004aad;
  color: #fff;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.editor-launcher:hover { transform: scale(1.06); }
.editor-launcher.is-active { background: #e4212e; }

@media (max-width: 680px) {
  .editor-launcher { bottom: 94px; }
}

/* ---------- Barra superior de edición ---------- */

body.is-editing { padding-top: 46px; }
body.is-editing .site-header { top: 46px; }

.editor-toolbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 46px;
  z-index: 9999;
  background: #0f172a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 10px;
  font-size: 0.85rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

.editor-toolbar__title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.editor-toolbar__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ff5a5f;
  animation: editor-pulse 1.4s infinite;
  flex-shrink: 0;
}
@keyframes editor-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.editor-toolbar__status {
  color: rgba(255,255,255,0.6);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.editor-btn {
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}
.editor-btn:hover { background: rgba(255,255,255,0.16); }
.editor-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.editor-btn--primary {
  background: #e4212e;
  border-color: #e4212e;
}
.editor-btn--primary:hover { background: #c31a26; }

.editor-btn--sm { padding: 5px 9px; font-size: 0.74rem; }

/* ---------- Texto editable ---------- */

.is-editing [data-ce-active="true"] {
  outline: 1.5px dashed transparent;
  outline-offset: 3px;
  border-radius: 4px;
  cursor: text;
  transition: outline-color 0.1s ease, background-color 0.1s ease;
}
.is-editing [data-ce-active="true"]:hover {
  outline-color: rgba(0, 74, 173, 0.45);
  background-color: rgba(0, 74, 173, 0.06);
}
.is-editing [data-ce-active="true"]:focus {
  outline: 2px solid #e4212e;
  outline-offset: 3px;
  background-color: rgba(228, 33, 46, 0.06);
}

/* ---------- Imágenes editables ---------- */

.is-editing .editor-img-wrap {
  position: relative;
}
.editor-img-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  border-radius: inherit;
  z-index: 5;
}
.is-editing .editor-img-wrap:hover .editor-img-overlay,
.is-editing .editor-img-wrap.is-open .editor-img-overlay {
  display: flex;
}
.editor-img-overlay button {
  border: none;
  background: #fff;
  color: #0f172a;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
}

/* ---------- Bloques (secciones arrastrables) ---------- */

.is-editing [data-editor-block] {
  position: relative;
  outline: 1px dashed rgba(0, 74, 173, 0.25);
  outline-offset: -1px;
}
.is-editing [data-editor-block].is-dragging { opacity: 0.35; }
.is-editing [data-editor-block].is-dragover-top { box-shadow: inset 0 4px 0 0 #e4212e; }
.is-editing [data-editor-block].is-dragover-bottom { box-shadow: inset 0 -4px 0 0 #e4212e; }

.block-controls {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.block-controls button {
  border: none;
  background: transparent;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.block-controls button:hover { background: rgba(255,255,255,0.18); }
.block-controls button.danger:hover { background: #e4212e; }
.block-controls .drag-handle { cursor: grab; }
.block-controls .drag-handle:active { cursor: grabbing; }

.editor-add-block-row {
  display: none;
}
.is-editing .editor-add-block-row {
  display: flex;
  justify-content: center;
  padding: 10px 0;
}
.editor-add-block-row button {
  border: 1px dashed #94a3b8;
  background: #f8fafc;
  color: #334155;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.editor-add-block-row button:hover { background: #eef2f7; }

/* ---------- Video embebido ---------- */

.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #0f172a;
}
.video-embed iframe,
.video-embed video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ---------- Modales ---------- */

.editor-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.editor-modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 420px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.editor-modal h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  color: #0f172a;
  font-family: "Poppins", sans-serif;
}
.editor-modal p.hint {
  margin: 0 0 16px;
  font-size: 0.85rem;
  color: #64748b;
}
.editor-modal input[type="text"],
.editor-modal input[type="password"],
.editor-modal input[type="url"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 10px;
  box-sizing: border-box;
  font-family: inherit;
}
.editor-modal .error-msg {
  color: #c31a26;
  font-size: 0.82rem;
  margin: -2px 0 10px;
  min-height: 1em;
}
.editor-modal .tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.editor-modal .tabs button {
  flex: 1;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  padding: 8px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: #334155;
}
.editor-modal .tabs button.active {
  background: #004aad;
  border-color: #004aad;
  color: #fff;
}
.editor-modal .tab-panel { display: none; }
.editor-modal .tab-panel.active { display: block; }
.editor-modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}
.editor-modal .modal-actions button {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}
.editor-modal .btn-cancel { background: #f1f5f9; color: #334155; }
.editor-modal .btn-confirm { background: #e4212e; color: #fff; }
.editor-modal .btn-confirm:hover { background: #c31a26; }
.editor-modal small.muted { color: #94a3b8; display: block; margin-top: 8px; }

/* ---------- Toast ---------- */

.editor-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.editor-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.editor-toast.is-error { background: #c31a26; }
.editor-toast.is-success { background: #1a7a3c; }
