/* ------------------------------------------------------------------------- admin menu ------------------------------------------------------------------------- */
:root {
  --border-main: 8px;
  --color-white: white;
}

#contentAdmin.container-admin {
  max-width: 3000px;
  margin: 0 auto;
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.container-admin {
  background-color: white;
}

@media (width <= 768px) {
  .boton-edit-active {
    transform: translate(1%, -150%) !important;
  }
}
.bton-edit,
.btn-primary-menu,
.btn-success-menu,
.close-btn,
.btn-secondary-menu,
.btn-delete-menu-admin,
.btn-add-main-admin,
#contentAdmin.btn-add {
  cursor: pointer;
}

.bton-edit {
  border: none;
  border-radius: var(--border-main);
}

.controls {
  display: flex;
  margin-top: 20px;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.btn-primary-menu {
  transition: all ease-in;
  background: #007bff;
  color: white;
}

.btn-primary-menu:hover {
  background: #0056b3;
}

.btn-success-menu {
  transition: all ease-in;
  background: #004583;
  border: none;
  border-radius: var(--border-main);
  color: white;
}

.btn-success-menu:hover {
  background: #004583;
}

.btn-secondary-menu {
  transition: all ease-in;
  background: #6c757d;
  border: none;
  border-radius: var(--border-main);
  color: white;
}

.btn-secondary-menu:hover {
  background: #5a6268;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow-y: auto;
}

.modal.active {
  display: block;
}

#editorContainer {
  padding: 25px;
}

.modal-content-nav {
  background: white;
  margin: 50px auto;
  width: 90%;
  max-width: 1000px;
  border-radius: 10px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #eee;
}

.modal-header h2 {
  color: #333;
}

.close-btn {
  background: #dc3545;
  color: white;
  padding: 8px 15px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 18px;
}

.close-btn:hover {
  background: #c82333;
}

/* Asegurar que el botón close del modal no se muestre (si quedara en HTML por error) */
.modal .close-btn {
  display: none !important;
}

/* Formulario de edición */
.item-editor {
  background: #ededed;
  padding: 20px;
  margin-bottom: 15px;
  border-radius: 8px;
  border-left: 4px solid #007bff;
  transition: box-shadow var(--fx-med) var(--fx-ease),
    transform var(--fx-med) var(--fx-ease),
    background var(--fx-med) var(--fx-ease);
}

.item-editor.level-1 {
  border-left-color: #28a745;
}

.item-editor.level-2 {
  border-left-color: #ffc107;
  margin-left: 20px;
}

.item-editor.level-3 {
  border-left-color: #dc3545;
  margin-left: 40px;
}

.item-editor:hover {
  box-shadow: 0 8px 28px rgba(2, 6, 23, 0.08);
  transform: translateY(-1px);
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #555;
}

.form-group input[type="text"],
.form-group input[type="url"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
}

.form-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  color: #007bff;
  margin-bottom: 15px;
  padding: 10px;
  background: white;
  border-radius: 5px;
}

/* Indicador del estado (chevron) */
.item-title::after {
  content: "▸";
  font-size: 35px;
  transition: transform 0.18s ease;
}

.item-editor:not(.is-collapsed) .item-title::after {
  transform: rotate(90deg);
}

.submenu-section {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 2px dashed #ddd;
}

.save-container {
  position: sticky;
  bottom: 0;
  background: white;
  padding: 20px;
  border-top: 2px solid #eee;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.item-actions {
  display: flex;
  gap: 8px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
  flex-wrap: wrap;
}

#contentAdmin.btn-add {
  background: #17a2b8;
  color: white;
  padding: 8px 15px;
  border: none;
  border-radius: var(--border-main);
  cursor: pointer;
  font-size: 13px;
}

#contentAdmin.btn-add:hover {
  background: #138496;
}

.btn-delete-menu-admin {
  background: #dc3545;
  color: white;
  height: fit-content;
  padding: 14px 15px;
  border: none;
  border-radius: var(--border-main);
  cursor: pointer;
  font-size: 13px;
}

.btn-delete-menu-admin:hover {
  background: #c82333;
}

.btn-add-main-admin {
  background: #004583;
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: var(--border-main);
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 20px;
}

.btn-add-main-admin:hover {
  background: #004583;
}
/* ------------------------------------------------------------------------- MODAL ------------------------------------------------------------------------- */

.position-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.position-modal.active {
  display: flex;
}

.position-modal-content {
  background: white;
  padding: 30px;
  border-radius: 10px;
  max-width: 500px;
  width: 90%;
}

.position-modal h3 {
  margin-bottom: 20px;
  color: #333;
}

.position-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.position-option {
  padding: 15px;
  border: 2px solid #ddd;
  border-radius: var(--border-main);
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.position-option:hover {
  border-color: #007bff;
  background: #f0f8ff;
}

.position-option input[type="radio"] {
  width: 20px;
  height: 20px;
}

.position-number {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
}

.position-number input {
  flex: 1;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
}

.position-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.preview {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 5px;
  margin-bottom: 20px;
}

.preview h3 {
  margin-bottom: 10px;
  color: #333;
}

.preview pre {
  background: #fff;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  font-size: 12px;
  border: 1px solid #ddd;
}

/* ------------------------------------------------------------------------- buscador de elementos ------------------------------------------------------------------------- */
.search-box {
  position: sticky;
  top: 0px;
  background: white;
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 30px;
  z-index: 100;
}

.search-controls {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.scope-selector {
  flex: 1;
  min-width: 200px;
}

.scope-selector label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
  font-weight: 600;
}

.scope-select {
  width: 100%;
  padding: 10px 15px;
  font-size: 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  outline: none;
  background: white;
  cursor: pointer;
  transition: all 0.3s;
}

.scope-select:hover {
  border-color: #667eea;
}

.scope-select:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-input-wrapper {
  flex: 2;
  min-width: 300px;
}

.search-input-wrapper label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
  font-weight: 600;
}

.search-input {
  width: 100%;
  padding: 10px 20px;
  font-size: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  outline: none;
  transition: all 0.3s;
}

.search-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.results {
  background: white;
  margin-top: 15px;
  border-radius: 10px;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.results.active {
  display: block;
}

.result-item {
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-item:hover {
  background: #f8f9ff;
  padding-left: 25px;
}

.result-item:last-child {
  border-bottom: none;
}

.result-icon {
  width: 8px;
  height: 8px;
  background: #667eea;
  border-radius: 50%;
}

.no-results {
  padding: 20px;
  text-align: center;
  color: #999;
}

.content-section {
  background: white;
  padding: 40px;
  border-radius: 15px;
  margin-bottom: 20px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  scroll-margin-top: 100px;
}

.content-section h2 {
  color: #667eea;
  margin-bottom: 15px;
  font-size: 28px;
}

.content-section p {
  color: #555;
  line-height: 1.6;
  font-size: 16px;
}

.highlight {
  background: yellow;
  padding: 2px 4px;
  border-radius: 3px;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.results.active {
  animation: slideIn 0.3s ease;
}

/* =======================
   Motion System (tokens) - MEJORADO
   ======================= */
:root {
  --fx-ease: cubic-bezier(0.22, 0.61, 0.36, 1); /* easeOut */
  --fx-snap: cubic-bezier(0.2, 0.8, 0.2, 1); /* standard smooth */
  --fx-bounce: cubic-bezier(0.34, 1.56, 0.64, 1); /* overshoot */
  --fx-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55); /* elastic */
  --fx-fast: 140ms;
  --fx-med: 220ms;
  --fx-slow: 360ms;
  --fx-super-slow: 500ms;

  /* Colores del tema */
  --color-primary: #004583;
  --color-primary-light: #f08b3a;
  --color-primary-dark: #d16b0f;
  --color-secondary: #6c757d;
  --color-success: #28a745;
  --color-danger: #dc3545;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* =======================
   Modal: entrada elegante MEJORADA
   ======================= */
.modal {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all var(--fx-med) var(--fx-ease);
  backdrop-filter: blur(0px);
  background: rgba(0, 0, 0, 0);
}

.modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.6);
}

.modal-content-nav {
  transform: translateY(30px) scale(0.95);
  opacity: 0;
  transition: all var(--fx-super-slow) var(--fx-elastic);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

.modal.active .modal-content-nav {
  transform: translateY(0) scale(1);
  opacity: 1;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
}

/* Position modal MEJORADA */
.position-modal {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all var(--fx-med) var(--fx-ease);
  backdrop-filter: blur(0px);
  background: rgba(0, 0, 0, 0);
}

.position-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  backdrop-filter: blur(6px);
  background: rgba(0, 0, 0, 0.7);
}

.position-modal-content {
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  transition: all var(--fx-super-slow) var(--fx-bounce);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.position-modal.active .position-modal-content {
  transform: translateY(0) scale(1);
  opacity: 1;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* =======================
   Ripple en botones MEJORADO
   ======================= */
.btn-success-menu,
.btn-secondary-menu,
.btn-add-main-admin,
.btn-delete-menu-admin,
#agregar,
#guardarCambios,
#guardarJson,
#editModal,
#collapseAll,
#expandAll,
.cerrarModal {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: all var(--fx-med) var(--fx-ease);
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-success-menu:hover,
.btn-add-main-admin:hover,
#agregar:hover,
#guardarCambios:hover,
#guardarJson:hover,
#editModal:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(231, 121, 24, 0.3);
}

.btn-secondary-menu:hover,
#collapseAll:hover,
#expandAll:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(108, 117, 125, 0.3);
}

.btn-delete-menu-admin:hover,
.cerrarModal:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(220, 53, 69, 0.3);
}

.btn-success-menu::after,
.btn-secondary-menu::after,
.btn-add-main-admin::after,
.btn-delete-menu-admin::after,
#agregar::after,
#guardarCambios::after,
#guardarJson::after,
#editModal::after,
#collapseAll::after,
#expandAll::after,
.cerrarModal::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transform: scale(0);
  opacity: 0;
  background: radial-gradient(
    circle at var(--x, 50%) var(--y, 50%),
    rgba(255, 255, 255, 0.6),
    transparent 50%
  );
  transition: all var(--fx-super-slow) var(--fx-ease);
  pointer-events: none;
  z-index: -1;
}

.btn-success-menu.is-rippling::after,
.btn-secondary-menu.is-rippling::after,
.btn-add-main-admin.is-rippling::after,
.btn-delete-menu-admin.is-rippling::after,
#agregar.is-rippling::after,
#guardarCambios.is-rippling::after,
#guardarJson.is-rippling::after,
#editModal.is-rippling::after,
#collapseAll.is-rippling::after,
#expandAll.is-rippling::after,
.cerrarModal.is-rippling::after {
  transform: scale(8);
  opacity: 1;
}

/* Efectos de carga para botones */
.btn-loading {
  pointer-events: none;
  position: relative;
}

.btn-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  border-radius: inherit;
  opacity: 0.8;
}

.btn-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* =======================
   Items: hover + foco + acordeón MEJORADO
   ======================= */
.item-editor {
  transition: all var(--fx-med) var(--fx-ease);
  border-radius: 12px;
  overflow: hidden;
}

.item-editor:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(2, 6, 23, 0.12);
}

.item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: all var(--fx-fast) var(--fx-ease);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 0;
}

.item-title:hover {
  background: rgba(231, 121, 24, 0.05);
}

.item-title::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 0 0 rgba(231, 121, 24, 0.3);
  transition: all var(--fx-med) var(--fx-bounce);
}

.item-editor:is(:hover, :focus-within) .item-title::before {
  transform: scale(1.3);
  box-shadow: 0 0 0 8px rgba(231, 121, 24, 0.15);
}

/* Indicador del estado (chevron) MEJORADO */
.item-title::after {
  content: "▸";
  font-size: 24px;
  transition: all var(--fx-med) var(--fx-elastic);
  color: var(--color-primary);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.item-editor:not(.is-collapsed) .item-title::after {
  transform: rotate(90deg);
}

/* Acordeón (colapsable con altura animada) MEJORADO */
.item-editor .accordion-body {
  overflow: hidden;
  transition: all var(--fx-super-slow) var(--fx-snap);
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  max-height: 2000px;
}

.item-editor.is-collapsed .accordion-body {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.item-editor .accordion-inner {
  min-height: 0;
  transition: all var(--fx-med) var(--fx-ease);
}

/* Transición más suave al mostrar/ocultar contenido MEJORADA */
.item-editor .form-group,
.item-editor .item-actions,
.item-editor .submenu-section {
  transition: all var(--fx-super-slow) var(--fx-snap);
  transform: translateY(0);
  opacity: 1;
}

.item-editor.is-collapsed .form-group,
.item-editor.is-collapsed .item-actions,
.item-editor.is-collapsed .submenu-section {
  opacity: 0;
  transform: translateY(-8px);
  transition-delay: 0ms;
}

.item-editor:not(.is-collapsed) .form-group,
.item-editor:not(.is-collapsed) .item-actions,
.item-editor:not(.is-collapsed) .submenu-section {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 100ms;
}

/* Animación de entrada escalonada para elementos */
@keyframes slideInStagger {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.item-editor:not(.is-collapsed) .form-group:nth-child(1) {
  animation: slideInStagger var(--fx-med) var(--fx-ease) 0ms both;
}
.item-editor:not(.is-collapsed) .form-group:nth-child(2) {
  animation: slideInStagger var(--fx-med) var(--fx-ease) 50ms both;
}
.item-editor:not(.is-collapsed) .form-group:nth-child(3) {
  animation: slideInStagger var(--fx-med) var(--fx-ease) 100ms both;
}
.item-editor:not(.is-collapsed) .form-group:nth-child(4) {
  animation: slideInStagger var(--fx-med) var(--fx-ease) 150ms both;
}
.item-editor:not(.is-collapsed) .form-group:nth-child(5) {
  animation: slideInStagger var(--fx-med) var(--fx-ease) 200ms both;
}

/* =======================
   MEJORA DE BOTONES ESPECÍFICOS
   ======================= */

/* Botón Agregar (ID: agregar) */
#agregar {
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary-light) 100%
  );
  border: none;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  padding: 14px 24px;
  font-size: 15px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(231, 121, 24, 0.3);
  position: relative;
  overflow: hidden;
}

#agregar:hover {
  background: linear-gradient(
    135deg,
    var(--color-primary-light) 0%,
    var(--color-primary) 100%
  );
  box-shadow: 0 8px 25px rgba(231, 121, 24, 0.4);
}

#agregar:active {
  transform: translateY(-1px) scale(0.98);
}

/* Botones Colapsar/Expandir */
#collapseAll,
#expandAll {
  background: linear-gradient(135deg, var(--color-secondary) 0%, #5a6268 100%);
  border: none;
  border-radius: 10px;
  color: white;
  font-weight: 500;
  padding: 10px 18px;
  font-size: 14px;
  box-shadow: 0 3px 12px rgba(108, 117, 125, 0.3);
  position: relative;
  overflow: hidden;
}

#collapseAll:hover,
#expandAll:hover {
  background: linear-gradient(135deg, #5a6268 0%, var(--color-secondary) 100%);
  box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

/* Botón Cancelar */
.cerrarModal {
  background: linear-gradient(135deg, var(--color-danger) 0%, #c82333 100%);
  border: none;
  border-radius: 10px;
  color: white;
  font-weight: 500;
  padding: 12px 20px;
  font-size: 14px;
  box-shadow: 0 3px 12px rgba(220, 53, 69, 0.3);
  position: relative;
  overflow: hidden;
}

.cerrarModal:hover {
  background: linear-gradient(135deg, #c82333 0%, var(--color-danger) 100%);
  box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

/* Botón Guardar Cambios */
#guardarCambios {
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary-light) 100%
  );
  border: none;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  padding: 14px 28px;
  font-size: 15px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(231, 121, 24, 0.3);
  position: relative;
  overflow: hidden;
}

#guardarCambios:hover {
  background: linear-gradient(
    135deg,
    var(--color-primary-light) 0%,
    var(--color-primary) 100%
  );
  box-shadow: 0 8px 25px rgba(231, 121, 24, 0.4);
}

#guardarCambios:active {
  transform: translateY(-1px) scale(0.98);
}

/* Efecto de pulso para el botón guardar cuando hay cambios */
#guardarCambios.has-changes {
  animation: savePulse 2s var(--fx-ease) infinite;
}

@keyframes savePulse {
  0%,
  100% {
    box-shadow: 0 4px 15px rgba(231, 121, 24, 0.3);
  }
  50% {
    box-shadow: 0 4px 15px rgba(231, 121, 24, 0.3),
      0 0 0 8px rgba(231, 121, 24, 0.2);
  }
}

/* Mejoras adicionales para todos los botones */
.btn-add-main-admin {
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary-light) 100%
  );
  border: none;
  border-radius: 10px;
  color: white;
  font-weight: 500;
  padding: 10px 16px;
  font-size: 13px;
  box-shadow: 0 3px 12px rgba(231, 121, 24, 0.3);
}

.btn-add-main-admin:hover {
  background: linear-gradient(
    135deg,
    var(--color-primary-light) 0%,
    var(--color-primary) 100%
  );
}

.btn-success-menu {
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary-light) 100%
  );
  border: none;
  border-radius: 10px;
  color: white;
  font-weight: 500;
  box-shadow: 0 3px 12px rgba(231, 121, 24, 0.3);
}

.btn-success-menu:hover {
  background: linear-gradient(
    135deg,
    var(--color-primary-light) 0%,
    var(--color-primary) 100%
  );
}

.btn-secondary-menu {
  background: linear-gradient(135deg, var(--color-secondary) 0%, #5a6268 100%);
  border: none;
  border-radius: 10px;
  color: white;
  font-weight: 500;
  box-shadow: 0 3px 12px rgba(108, 117, 125, 0.3);
}

.btn-secondary-menu:hover {
  background: linear-gradient(135deg, #5a6268 0%, var(--color-secondary) 100%);
}

.btn-delete-menu-admin {
  background: linear-gradient(135deg, var(--color-danger) 0%, #c82333 100%);
  border: none;
  border-radius: 10px;
  color: white;
  font-weight: 500;
  box-shadow: 0 3px 12px rgba(220, 53, 69, 0.3);
}

.btn-delete-menu-admin:hover {
  background: linear-gradient(135deg, #c82333 0%, var(--color-danger) 100%);
}

/* Botones de acción con "elevación" mejorada */
.item-actions .btn-add-main-admin,
.item-actions .btn-delete-menu-admin {
  box-shadow: 0 3px 12px rgba(2, 6, 23, 0.08);
  transition: all var(--fx-med) var(--fx-ease);
}
.item-actions .btn-add-main-admin:hover,
.item-actions .btn-delete-menu-admin:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.12);
}

/* =======================

/* =======================
   Buscador: resultados con “pop”
   ======================= */
.results.active {
  animation: slideIn var(--fx-med) var(--fx-ease);
}
.result-item {
  transition: background var(--fx-fast) var(--fx-ease),
    transform var(--fx-fast) var(--fx-ease),
    padding var(--fx-fast) var(--fx-ease);
}
.result-item:hover {
  transform: translateX(4px) scale(1.01);
}

/* Estado de teclado ya agregado antes */
.result-item.is-active {
  background: #eef2ff;
  outline: 2px solid #667eea33;
}

/* =======================
   Drag & Drop visual
   ======================= */
.item-editor[draggable="true"] {
  cursor: grab;
}
.item-editor.dragging {
  opacity: 0.6;
  transform: scale(0.995);
}
.item-editor.drop-target {
  outline: 2px dashed #667eea;
  background: #f8f9ff;
}

/* =======================
   Barra de guardado sticky con pulsación suave
   ======================= */
.save-container {
  box-shadow: 0 -6px 24px rgba(2, 6, 23, 0.06);
  backdrop-filter: saturate(1.2);
}
.btn-save-pulse {
  animation: savePulse 1.8s var(--fx-ease) infinite;
}
@keyframes savePulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.25);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
  }
}

/* Resaltado al saltar desde el buscador (ya propuesto) */
@keyframes jumpGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.5);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(102, 126, 234, 0.35);
  }
  100% {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  }
}
.search-jump {
  animation: jumpGlow 1.2s var(--fx-ease);
  border-radius: 8px;
}

/* --- PRIORIDAD AL MODAL (encima de todo) --- */
.modal {
  position: fixed; /* asegúrate que no lo perdió por cascada */
  z-index: 9999 !important;
}
.modal.active {
  display: block;
} /* mantiene tu lógica de visibilidad */
.position-modal {
  position: fixed;
  z-index: 10000 !important;
}

/* --- Evita que el panel admin quede por debajo/encima de forma ambigua --- */
#contentAdmin {
  position: relative; /* crea stacking context claro */
}

/* --- En móviles, no muevas el panel completo al activar el botón --- */
/* Tu .boton-edit-active mueve el botón, no el panel. Eso está bien,
   pero si por error le cae al contenedor, evita que afecte al modal: */
#contentAdmin.boton-edit-active {
  transform: none !important;
}

.modal {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--fx-med) var(--fx-ease),
    visibility 0s linear var(--fx-med);
}
.modal.active {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
  transition: opacity var(--fx-med) var(--fx-ease);
}

/* Nueva fila para colocar boton - buscador - acciones en una linea */
.search-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.search-row .btn-add-main-admin {
  flex: 0 0 auto;
}

.search-row .search-box {
  flex: 1 1 60%;
  margin: 0;
  width: 100%;
}

.search-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-row .search-box {
    order: 2;
    width: 100%;
  }

  .search-actions {
    order: 3;
    justify-content: flex-end;
  }

  .search-row .btn-add-main-admin {
    order: 1;
    align-self: flex-start;
  }
}

/* Hacer que la fila del buscador sea sticky dentro de la modal-content-nav */
.modal-content-nav {
  position: relative;
}

.search-row {
  position: sticky;
  top: 0;
  background: white;
  z-index: 250; /* encima del editor pero dentro del modal */
  padding: 12px 20px;
  border-bottom: 1px solid #eee;
}

/* Asegurar colapso: si usas la clase is-collapsed, oculta visualmente el contenido */
.item-editor.is-collapsed .accordion-body {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
  height: 0;
  padding: 0;
}

/* Si no existe .accordion-body en el markup, colapsar los hijos directos visibles */
.item-editor.is-collapsed > .form-group,
.item-editor.is-collapsed > .item-actions,
.item-editor.is-collapsed > .submenu-section {
  display: none !important;
}

/* ==========================================================================
   DRAG & DROP - EDITOR DE MENÚ
   ========================================================================== */

.item-editor {
  position: relative;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease,
    box-shadow 0.2s ease;
}

.item-editor-header {
  display: flex;
  align-items: center;
  width: 100%;
}

.item-title {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  background: #f1f1f1;
  color: #777;
  cursor: grab;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.drag-handle:hover {
  background: #e5e5e5;
  color: #333;
}

.drag-handle:active {
  cursor: grabbing;
  transform: scale(0.95);
}

.item-editor.is-dragging {
  opacity: 0.45;
  transform: scale(0.98);
}

.item-editor.drag-over {
  position: relative;
}

.item-editor.drag-over::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -5px;
  height: 4px;
  border-radius: 4px;
  background: #b73792;
  z-index: 10;
  pointer-events: none;
}

.collapse-item-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #555;
  transition: transform 0.25s ease;
}

.item-editor.is-collapsed
  .collapse-item-btn {
  transform: rotate(-90deg);
}

.item-title-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.item-title-content strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-type {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f4f4f4;
  color: #666;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f7f7f7;
  color: #444;
  font-size: 13px;
  font-weight: 700;
}

.section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin-left: auto;
  border-radius: 999px;
  background: #e9e9e9;
  font-size: 11px;
}

.drag-help {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8f8f8;
  color: #555;
  font-size: 13px;
}

.drag-help i {
  color: #b73792;
}

.editor-help-text {
  margin-top: 4px;
  color: #777;
  font-size: 12px;
}

.search-highlight {
  animation: searchHighlightAnimation 1.8s ease;
}

@keyframes searchHighlightAnimation {
  0% {
    box-shadow:
      0 0 0 0 rgba(183, 55, 146, 0);
  }

  20% {
    box-shadow:
      0 0 0 6px rgba(183, 55, 146, 0.35);
  }

  70% {
    box-shadow:
      0 0 0 6px rgba(183, 55, 146, 0.25);
  }

  100% {
    box-shadow:
      0 0 0 0 rgba(183, 55, 146, 0);
  }
}

/* ==========================================================================
   ELEMENTOS COLAPSADOS
   ========================================================================== */

.item-editor.is-collapsed
  > .form-group,
.item-editor.is-collapsed
  > .item-actions,
.item-editor.is-collapsed
  > .submenu-section {
  display: none;
}

.item-editor.is-collapsed
  > .item-editor-header {
  margin-bottom: 0;
}

/* ==========================================================================
   RESULTADOS DE BÚSQUEDA
   ========================================================================== */

.result-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: white;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease;
}

.result-item:hover {
  background: #f7f7f7;
}

.result-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #f4e7f0;
  color: #b73792;
}

.no-results {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 15px;
  color: #777;
  font-size: 13px;
}