/* SIGEDU - Botones globales estilo sidebar activo v17
   Corrección: texto no se sale, evita duplicado de iconos y mejora toolbar.
*/

body.sigedu-global-buttons main.content a:not(.side-nav a):not(.sidebar a),
body.sigedu-global-buttons main.content button,
body.sigedu-global-buttons main.content input[type="submit"],
body.sigedu-global-buttons main.content input[type="button"],
body.sigedu-global-buttons .content a:not(.side-nav a):not(.sidebar a),
body.sigedu-global-buttons .content button,
body.sigedu-global-buttons .content input[type="submit"],
body.sigedu-global-buttons .content input[type="button"] {
  text-decoration: none;
}

/* Botones detectados por JS */
body.sigedu-global-buttons main.content .sigedu-global-btn-ready,
body.sigedu-global-buttons .content .sigedu-global-btn-ready {
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  min-height: 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  padding: 8px 12px !important;
  border-radius: 13px !important;
  background: linear-gradient(135deg, #dce9f7, #edf4fb) !important;
  color: #203854 !important;
  border: 1px solid #b8cfe8 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .8),
    0 10px 22px rgba(84, 111, 145, .12) !important;
  font-weight: 680 !important;
  font-size: 13px !important;
  line-height: 1.12 !important;
  text-decoration: none !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  cursor: pointer !important;
  transform: none !important;
  transition:
    transform .16s ease,
    box-shadow .16s ease,
    border-color .16s ease,
    background .16s ease,
    filter .16s ease !important;
  vertical-align: middle !important;
}

body.sigedu-global-buttons main.content .sigedu-global-btn-ready:hover,
body.sigedu-global-buttons .content .sigedu-global-btn-ready:hover {
  transform: translateX(2px) translateY(-1px) !important;
  border-color: #9fbbd8 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 13px 26px rgba(84, 111, 145, .18) !important;
  filter: saturate(1.03) !important;
}

/* Crear / alta */
body.sigedu-global-buttons main.content .sigedu-btn-intent-create,
body.sigedu-global-buttons .content .sigedu-btn-intent-create {
  background: linear-gradient(135deg, #dff7e8, #eefbf3) !important;
  color: #1f5136 !important;
  border-color: #b8e8c8 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .85),
    0 10px 22px rgba(64, 145, 94, .12) !important;
}

/* Editar / actualizar */
body.sigedu-global-buttons main.content .sigedu-btn-intent-edit,
body.sigedu-global-buttons .content .sigedu-btn-intent-edit {
  background: linear-gradient(135deg, #dce9f7, #edf4fb) !important;
  color: #203854 !important;
  border-color: #b8cfe8 !important;
}

/* Eliminar / baja */
body.sigedu-global-buttons main.content .sigedu-btn-intent-delete,
body.sigedu-global-buttons .content .sigedu-btn-intent-delete,
body.sigedu-global-buttons main.content .sigedu-btn-danger,
body.sigedu-global-buttons .content .sigedu-btn-danger,
body.sigedu-global-buttons main.content .btn-danger,
body.sigedu-global-buttons .content .btn-danger {
  background: linear-gradient(135deg, #fde4e4, #fff0f0) !important;
  color: #7f1d1d !important;
  border-color: #f5b8b8 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .85),
    0 10px 22px rgba(145, 64, 64, .12) !important;
}

/* Ver / revisar */
body.sigedu-global-buttons main.content .sigedu-btn-intent-view,
body.sigedu-global-buttons .content .sigedu-btn-intent-view {
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff) !important;
  color: #075985 !important;
  border-color: #bae6fd !important;
}

/* Descargar / imprimir */
body.sigedu-global-buttons main.content .sigedu-btn-intent-download,
body.sigedu-global-buttons .content .sigedu-btn-intent-download {
  background: linear-gradient(135deg, #ede9fe, #f5f3ff) !important;
  color: #5b21b6 !important;
  border-color: #ddd6fe !important;
}

/* Volver / cancelar / limpiar */
body.sigedu-global-buttons main.content .sigedu-btn-intent-back,
body.sigedu-global-buttons .content .sigedu-btn-intent-back,
body.sigedu-global-buttons main.content .sigedu-btn-intent-clear,
body.sigedu-global-buttons .content .sigedu-btn-intent-clear {
  background: linear-gradient(135deg, #edf1f5, #f8fafc) !important;
  color: #334155 !important;
  border-color: #cbd5e1 !important;
}

/* Guardar */
body.sigedu-global-buttons main.content .sigedu-btn-intent-save,
body.sigedu-global-buttons .content .sigedu-btn-intent-save {
  background: linear-gradient(135deg, #dcfce7, #f0fdf4) !important;
  color: #166534 !important;
  border-color: #bbf7d0 !important;
}

/* Buscar */
body.sigedu-global-buttons main.content .sigedu-btn-intent-search,
body.sigedu-global-buttons .content .sigedu-btn-intent-search {
  background: linear-gradient(135deg, #fef3c7, #fffbeb) !important;
  color: #92400e !important;
  border-color: #fde68a !important;
}

/* Ícono inyectado */
body.sigedu-global-buttons main.content .sigedu-global-btn-icon,
body.sigedu-global-buttons .content .sigedu-global-btn-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255,255,255,.58);
  color: inherit;
  font-size: 12px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
  flex: 0 0 20px;
}

body.sigedu-global-buttons main.content .sigedu-global-btn-text,
body.sigedu-global-buttons .content .sigedu-global-btn-text {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

/* Inputs submit no aceptan icono interno, pero sí deben caber */
body.sigedu-global-buttons main.content input.sigedu-global-btn-ready,
body.sigedu-global-buttons .content input.sigedu-global-btn-ready {
  text-overflow: ellipsis !important;
}

/* Formularios de acciones */
body.sigedu-global-buttons main.content form.sigedu-inline-action-form,
body.sigedu-global-buttons .content form.sigedu-inline-action-form {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin: 2px 3px !important;
  max-width: 100% !important;
  flex-wrap: wrap !important;
}

/* Celdas de acciones: evita EditarEliminar pegado */
body.sigedu-global-buttons main.content td:last-child.sigedu-actions-cell,
body.sigedu-global-buttons .content td:last-child.sigedu-actions-cell,
body.sigedu-global-buttons main.content .acciones.sigedu-actions-cell,
body.sigedu-global-buttons .content .acciones.sigedu-actions-cell,
body.sigedu-global-buttons main.content .actions.sigedu-actions-cell,
body.sigedu-global-buttons .content .actions.sigedu-actions-cell {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  white-space: normal !important;
}

/* Toolbar y encabezados */
body.sigedu-global-buttons main.content .toolbar,
body.sigedu-global-buttons .content .toolbar,
body.sigedu-global-buttons main.content .panel-heading,
body.sigedu-global-buttons .content .panel-heading,
body.sigedu-global-buttons main.content .filter-row,
body.sigedu-global-buttons .content .filter-row,
body.sigedu-global-buttons main.content .filters,
body.sigedu-global-buttons .content .filters,
body.sigedu-global-buttons main.content .busqueda,
body.sigedu-global-buttons .content .busqueda {
  gap: 10px !important;
  flex-wrap: wrap !important;
  align-items: center !important;
}

/* Evitar que un grupo de botones ancho rompa el layout */
body.sigedu-global-buttons main.content .toolbar > *,
body.sigedu-global-buttons .content .toolbar > *,
body.sigedu-global-buttons main.content .panel-heading > *,
body.sigedu-global-buttons .content .panel-heading > * {
  max-width: 100%;
}

/* Links de texto dentro de párrafos no se convierten visualmente si no fueron detectados */
body.sigedu-global-buttons main.content p a:not(.sigedu-global-btn-ready),
body.sigedu-global-buttons .content p a:not(.sigedu-global-btn-ready),
body.sigedu-global-buttons main.content .breadcrumb a:not(.sigedu-global-btn-ready),
body.sigedu-global-buttons .content .breadcrumb a:not(.sigedu-global-btn-ready) {
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  min-height: 0 !important;
  display: inline !important;
}

/* Botones de acciones en tabla: más compactos */
body.sigedu-global-buttons main.content td .sigedu-global-btn-ready,
body.sigedu-global-buttons .content td .sigedu-global-btn-ready {
  padding: 7px 10px !important;
  font-size: 12px !important;
  min-height: 32px !important;
}

/* Responsive */
@media (max-width: 760px) {
  body.sigedu-global-buttons main.content .sigedu-global-btn-ready,
  body.sigedu-global-buttons .content .sigedu-global-btn-ready {
    font-size: 12px !important;
    padding: 8px 10px !important;
  }

  body.sigedu-global-buttons main.content .sigedu-global-btn-icon,
  body.sigedu-global-buttons .content .sigedu-global-btn-icon {
    width: 18px;
    height: 18px;
    min-width: 18px;
    flex-basis: 18px;
  }
}
