/* ==========================================================================
   LIVE CUSTOMIZER & SANDBOX DRAWER (6-TAB ARCHITECTURE)
   ========================================================================== */

/* Botón flotante para abrir el personalizador */
.btn-live-editor-trigger {
  position: fixed;
  bottom: calc(18px + var(--safe-bottom));
  left: 18px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(15, 18, 26, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  z-index: 60;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-live-editor-trigger:active {
  transform: scale(0.9);
}

.btn-live-editor-trigger:hover {
  border-color: var(--primary);
  box-shadow: 0 0 18px var(--primary-glow);
  transform: rotate(30deg);
}

/* Modal Drawer Bottom-Sheet */
.live-editor-drawer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 120;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.live-editor-drawer.open {
  opacity: 1;
  pointer-events: auto;
}

.live-editor-content {
  width: 100%;
  max-width: 460px;
  height: 88vh;
  background: #0d1017;
  border-top-left-radius: 30px;
  border-top-right-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: none;
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.live-editor-drawer.open .live-editor-content {
  transform: translateY(0);
}

/* Header del Drawer */
.live-editor-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.live-editor-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-editor-title i {
  color: var(--primary);
}

.live-editor-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.live-editor-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

/* ==========================================================================
   Barra de Pestañas (Tab Navigation)
   ========================================================================== */
.editor-nav-tabs {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  scrollbar-width: none;
}
.editor-nav-tabs::-webkit-scrollbar { display: none; }

.editor-nav-tab {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.editor-nav-tab.active {
  background: rgba(236, 72, 153, 0.18);
  color: var(--primary);
  border: 1px solid rgba(236, 72, 153, 0.35);
}

/* ==========================================================================
   Cuerpo con Paneles Tab
   ========================================================================== */
.live-editor-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
}

.editor-tab-pane {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fadeInPane 0.25s ease forwards;
}

.editor-tab-pane.active {
  display: flex;
}

@keyframes fadeInPane {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.editor-section-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.editor-group-title {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   Carga de Archivos e Imágenes (Image Upload Dropzone)
   ========================================================================== */
.image-upload-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 10px 14px;
}

.upload-preview-box {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: cover;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.upload-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-file-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 7px 12px;
  border-radius: 10px;
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-file-upload:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--primary);
}

/* ==========================================================================
   Campos de Formulario
   ========================================================================== */
.editor-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.editor-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #cbd5e1;
}

.editor-input, .editor-textarea {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 9px 12px;
  color: white;
  font-family: var(--font-body);
  font-size: 12.5px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.editor-input:focus, .editor-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

.editor-textarea {
  resize: vertical;
  min-height: 60px;
}

/* ==========================================================================
   Interruptores Toggle Switch
   ========================================================================== */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.toggle-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 999px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--primary);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* ==========================================================================
   Color Pickers
   ========================================================================== */
.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.color-picker-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: 12px;
}

.color-picker-box span {
  font-size: 11.5px;
  color: #cbd5e1;
  font-weight: 600;
}

.color-input-native {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: none;
}
.color-input-native::-webkit-color-swatch-wrapper { padding: 0; }
.color-input-native::-webkit-color-swatch { border: 2px solid rgba(255,255,255,0.4); border-radius: 50%; }

/* ==========================================================================
   Listas Dinámicas (Roles, Redes, Galería)
   ========================================================================== */
.dynamic-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dynamic-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px 12px;
}

.dynamic-item-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn-icon-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon-danger:hover {
  background: rgba(239, 68, 68, 0.3);
}

.btn-add-item {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: #f1f5f9;
  padding: 9px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add-item:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--primary);
  color: var(--primary);
}

/* ==========================================================================
   Footer con Acciones Principales
   ========================================================================== */
.live-editor-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 13, 20, 0.95);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-save-master {
  flex: 2;
  background: var(--grad-vcard);
  color: white;
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4);
  transition: all 0.2s ease;
}

.btn-save-master:active {
  transform: scale(0.96);
}

.btn-editor-secondary {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px 10px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-editor-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

.btn-crop-apply {
  background: var(--grad-vcard);
  color: white;
  border: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.btn-crop-apply:active {
  transform: scale(0.96);
}
