/* =========================================== */
/* ===== SISTEMA DE BOTONES PRO (FUSIÓN) ===== */
/* =========================================== */

/* ----- BASE (Centralizada y heredable) ----- */
.btn {
  /* Estilos base reducidos 15% */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.34rem; /* 0.4 * 0.85 */
  padding: 0.51rem 0.85rem; /* 0.6 * 0.85, 1 * 0.85 */
  border-radius: 8.5px; /* 10 * 0.85 */
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  font-size: 0.723rem; /* 0.85 * 0.85 */
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  min-height: 34px; /* 40 * 0.85 */
  min-width: auto;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2.55px 6.8px rgba(0,0,0,0.2); /* 3 * 0.85, 8 * 0.85 */
  width: auto;
  white-space: nowrap;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

/* --- EFECTO HOVER CENTRALIZADO --- */
.btn:hover {
  transform: translateY(-1.7px); /* -2 * 0.85 */
  box-shadow: 0 5.1px 13.6px rgba(0,0,0,0.3); /* 6 * 0.85, 16 * 0.85 */
}

.btn:active {
  transform: translateY(0);
  transition: transform 0.1s;
}

/* ----- BOTONES DESHABILITADOS (Unificado y robusto) ----- */
.btn:disabled,
.btn[disabled],
.btn-edit:disabled,
.btn-delete:disabled,
.btn-pag:disabled {
  background: #e5e7eb !important;
  border-color: #d1d5db !important;
  color: #9ca3af !important;
  cursor: not-allowed !important;
  opacity: 0.6;
  transform: none !important;
  box-shadow: none !important;
  pointer-events: none;
}

/* ----- ÍCONOS (Estilo base) ----- */
.btn i {
  font-size: 0.765rem; /* 0.9 * 0.85 */
  width: 13.6px; /* 16 * 0.85 */
  text-align: center;
}

/* ----- VARIANTES DE COLOR (Solo colores, hover se hereda de .btn:hover) ----- */
.btn-primary,
.btn-success {
  background: linear-gradient(135deg, #008c3a 0%, #00b050 100%);
  color: #fff;
  box-shadow: 0 2.55px 6.8px rgba(0, 140, 58, 0.25); /* 3 * 0.85, 8 * 0.85 */
}

.btn-primary:hover,
.btn-success:hover {
  background: linear-gradient(135deg, #006e2e 0%, #008c3a 100%);
}

.btn-outline {
  background: transparent;
  border: 1.7px solid #008c3a; /* 2 * 0.85 */
  color: #008c3a;
  box-shadow: 0 1.7px 5.1px rgba(0, 140, 58, 0.1); /* 2 * 0.85, 6 * 0.85 */
}

.btn-outline:hover {
  background: #008c3a;
  color: white;
}

.btn-info,
.btn-mantenimiento {
  background: linear-gradient(135deg, #5b5b5b 0%, #7a7a7a 100%);
  color: #ffffff;
  box-shadow: 0 2.55px 6.8px rgba(91, 91, 91, 0.25);
}

.fa .fa-file {
  color: #d1d5db;
}

.btn-mantenimiento:hover {
  background: linear-gradient(135deg, #4a4a4a 0%, #666666 100%);
}

/* ----- BOTONES DE TABLA (Heredan de .btn y tienen su propia especificidad) ----- */
.btn-edit,
.btn-delete,
.btn-guardar,
.btn-cancelar,
.btn-guardar-nueva,
.btn-cancelar-nueva {
  background: linear-gradient(135deg, #0d6efd 0%, #3d8bfd 100%);
  color: #fff;
  border: none;
  padding: 0.34rem 0.68rem; /* 0.4 * 0.85, 0.8 * 0.85 */
  border-radius: 6.8px; /* 8 * 0.85 */
  display: inline-flex;
  align-items: center;
  gap: 0.34rem; /* 0.4 * 0.85 */
  font-size: 0.638rem; /* 0.75 * 0.85 */
  font-weight: 600;
  min-height: 28.9px; /* 34 * 0.85 */
  max-width: 42.5px; /* 50 * 0.85 */
  min-width: 38.25px; /* 45 * 0.85 */
  justify-content: center;
  box-sizing: border-box;
  box-shadow: 0 1.7px 5.1px rgba(13, 110, 253, 0.2); /* 2 * 0.85, 6 * 0.85 */
  flex: 1 1 auto;
}

.btn-edit:hover {
  background: linear-gradient(135deg, #094bb3 0%, #0d6efd 100%);
}

.btn-delete {
  background: linear-gradient(135deg, #dc3545 0%, #e35d6a 100%);
  box-shadow: 0 1.7px 5.1px rgba(220, 53, 69, 0.2);
}

.btn-delete:hover {
  background: linear-gradient(135deg, #c82333 0%, #dc3545 100%);
}

.btn-guardar,
.btn-guardar-nueva {
  background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
  box-shadow: 0 1.7px 5.1px rgba(40, 167, 69, 0.2);
}

.btn-guardar:hover,
.btn-guardar-nueva:hover {
  background: linear-gradient(135deg, #218838 0%, #28a745 100%);
}

/* ----- BOTÓN CANCELAR (Contextos Específicos) ----- */
.btn-cancelar {
  background: linear-gradient(135deg, #6c757d 0%, #8a939b 100%);
  box-shadow: 0 2.55px 6.8px rgba(108, 117, 125, 0.25);
}

.btn-cancelar:hover {
  background: linear-gradient(135deg, #5a6268 0%, #727b84 100%);
}

/* Botón cancelar en formularios (más grande) */
.acciones-formulario .btn-cancelar {
  padding: 0.51rem 0.85rem !important; /* 0.6 * 0.85, 1 * 0.85 */
  font-size: 0.723rem !important; /* 0.85 * 0.85 */
  min-width: 93.5px; /* 110 * 0.85 */
  min-height: 34px; /* 40 * 0.85 */
  max-width: none;
}

/* ----- BOTONES ESPECIALES ----- */
#btnAgregarFila {
  background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%);
  color: #fff;
  box-shadow: 0 2.55px 6.8px rgba(23, 162, 184, 0.25);
}

#btnAgregarFila:hover {
  background: linear-gradient(135deg, #138496 0%, #17a2b8 100%);
}

/* ----- BOTONES DE PAGINACIÓN ----- */
.btn-pag {
  background: linear-gradient(135deg, #008c3a 0%, #00b050 100%);
  color: white;
  border: none;
  padding: 0.51rem 0.85rem; /* 0.6 * 0.85, 1 * 0.85 */
  border-radius: 8.5px; /* 10 * 0.85 */
  cursor: pointer;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  transition: all 0.25s;
  min-height: 34px; /* 40 * 0.85 */
  max-width: 34px; /* 40 * 0.85 */
  box-sizing: border-box;
  box-shadow: 0 2.55px 6.8px rgba(0, 140, 58, 0.25);
}

.btn-pag:hover:not(:disabled) {
  background: linear-gradient(135deg, #006e2e 0%, #008c3a 100%);
}

/* =========================================== */
/* ===== MEDIA QUERIES (Responsive PRO) ===== */
/* =========================================== */

/* Tablet - 768px */
@media (max-width: 768px) {
  .btn {
    padding: 0.425rem 0.68rem; /* 0.5 * 0.85, 0.8 * 0.85 */
    min-height: 30.6px; /* 36 * 0.85 */
    font-size: 0.68rem; /* 0.8 * 0.85 */
  }

  .btn i {
    font-size: 0.765em; /* 0.9 * 0.85 */
  }

  .btn-edit,
  .btn-delete,
  .btn-guardar,
  .btn-cancelar,
  .btn-guardar-nueva,
  .btn-cancelar-nueva {
    padding: 0.298rem 0.51rem; /* 0.35 * 0.85, 0.6 * 0.85 */
    min-height: 27.2px; /* 32 * 0.85 */
    max-width: 42.5px; /* 50 * 0.85 */
    min-width: 38.25px; /* 45 * 0.85 */
    font-size: 0.595rem; /* 0.7 * 0.85 */
    gap: 0.255rem; /* 0.3 * 0.85 */
  }

  .btn-pag {
    padding: 0.468rem 0.765rem; /* 0.55 * 0.85, 0.9 * 0.85 */
    min-height: 32.3px; /* 38 * 0.85 */
  }
}

/* Móvil - 526px */
@media (max-width: 526px) {
  .btn {
    padding: 0.383rem 0.595rem; /* 0.45 * 0.85, 0.7 * 0.85 */
    min-height: 28.9px; /* 34 * 0.85 */
    font-size: 0.638rem; /* 0.75 * 0.85 */
  }

  /* Botones de acción ocupan 50% */
  .acciones > div:not(.acciones-formulario) .btn {
    width: calc(50% - 0.2125rem); /* 0.25 * 0.85 */
  }

  /* Botones de tabla en móvil - solo íconos */
  .btn-edit span,
  .btn-delete span,
  .btn-guardar span,
  .btn-cancelar span,
  .btn-guardar-nueva span,
  .btn-cancelar-nueva span {
    display: none;
  }

  .btn-edit,
  .btn-delete,
  .btn-guardar,
  .btn-cancelar,
  .btn-guardar-nueva,
  .btn-cancelar-nueva {
    width: 100% !important;
    max-width: 42.5px; /* 50 * 0.85 */
    min-width: 38.25px; /* 45 * 0.85 */
    padding: 0.255rem 0.34rem; /* 0.3 * 0.85, 0.4 * 0.85 */
    min-height: 25.5px; /* 30 * 0.85 */
    font-size: 0.553rem; /* 0.65 * 0.85 */
    margin: 0;
  }

  .btn i {
    font-size: 0.68rem; /* 0.8 * 0.85 */
    width: 11.9px; /* 14 * 0.85 */
  }

  .btn-pag {
    width: 100%;
  }
}

/* Móvil pequeño - 360px */
@media (max-width: 360px) {
  .btn {
    padding: 0.34rem 0.51rem; /* 0.4 * 0.85, 0.6 * 0.85 */
    min-height: 27.2px; /* 32 * 0.85 */
    font-size: 0.595rem; /* 0.7 * 0.85 */
  }

  .acciones > div:not(.acciones-formulario) .btn {
    width: 100%;
  }

  .btn-edit,
  .btn-delete,
  .btn-guardar,
  .btn-cancelar,
  .btn-guardar-nueva,
  .btn-cancelar-nueva {
    padding: 0.213rem 0.298rem; /* 0.25 * 0.85, 0.35 * 0.85 */
    min-height: 23.8px; /* 28 * 0.85 */
    max-width: 42.5px; /* 50 * 0.85 */
    min-width: 38.25px; /* 45 * 0.85 */
    font-size: 0.51rem; /* 0.6 * 0.85 */
  }

  .btn i {
    font-size: 0.638rem; /* 0.75 * 0.85 */
    width: 10.2px; /* 12 * 0.85 */
  }

  .btn-pag {
    min-height: 30.6px; /* 36 * 0.85 */
    font-size: 0.68rem; /* 0.8 * 0.85 */
  }
}

/* ----- ACCESIBILIDAD ----- */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn-edit,
  .btn-delete,
  .btn-pag,
  .btn-guardar,
  .btn-cancelar {
    transition: none;
    transform: none !important;
  }

  .btn::before {
    display: none;
  }
}

