/* =====================================================================
   Ruta en GitHub : frontend/css/componentes/botones.css
   Proyecto       : DR ORGANICS - Sistema Administrativo y Financiero
   Descripción    : Botones estándar de la aplicación.

   Cada botón tiene el mismo significado visual en todos los módulos:
     Guardar   -> .boton--primario
     Cancelar  -> .boton--secundario
     Regresar  -> .boton--fantasma
     Editar    -> .boton--secundario (con icono de lápiz)
     Eliminar  -> .boton--peligro
   ===================================================================== */





.boton {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--alto-control);
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radio);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  transition:
    background var(--transicion),
    border-color var(--transicion),
    color var(--transicion);
}





/* ---------------------------------------------------------------------
   Variantes
   --------------------------------------------------------------------- */

.boton--primario {
  background: var(--verde-bosque);
  color: #FFFFFF;
}





.boton--primario:hover:not([disabled]) {
  background: var(--verde-bosque-oscuro);
}





.boton--secundario {
  background: var(--superficie);
  color: var(--texto-fuerte);
  border-color: var(--borde-fuerte);
}





.boton--secundario:hover:not([disabled]) {
  background: #F1F4EC;
  border-color: #AEB7A2;
}





.boton--fantasma {
  padding: 0 10px;
  background: transparent;
  color: var(--texto-suave);
}





.boton--fantasma:hover:not([disabled]) {
  background: var(--hover-verde);
  color: var(--verde-bosque);
}





.boton--peligro {
  background: var(--superficie);
  color: var(--peligro-texto);
  border-color: #E7B3AD;
}





.boton--peligro:hover:not([disabled]) {
  background: var(--peligro-fondo);
}





/* Confirmación de una acción destructiva (por ejemplo, Eliminar). */
.boton--peligro-solido {
  background: var(--peligro);
  color: #FFFFFF;
}





.boton--peligro-solido:hover:not([disabled]) {
  background: #8F1D14;
}





/* ---------------------------------------------------------------------
   Tamaños
   --------------------------------------------------------------------- */

.boton--grande {
  height: var(--alto-control-grande);
}





.boton--enorme {
  height: 48px;
}





.boton--bloque {
  width: 100%;
}





/* ---------------------------------------------------------------------
   Estados
   --------------------------------------------------------------------- */

.boton[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}





/* Mientras se procesa una acción: el texto se oculta y aparece un
   indicador giratorio. Evita también el doble envío. */
.boton[aria-busy="true"] {
  color: transparent;
  cursor: progress;
}





.boton[aria-busy="true"] > * {
  visibility: hidden;
}





.boton[aria-busy="true"]::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: girar 0.7s linear infinite;
}





.boton--secundario[aria-busy="true"]::after,
.boton--peligro[aria-busy="true"]::after,
.boton--fantasma[aria-busy="true"]::after {
  border-color: rgba(30, 77, 20, 0.25);
  border-top-color: var(--verde-bosque);
}





/* ---------------------------------------------------------------------
   Botón compacto solo con icono (acciones de tabla, cerrar, menú)
   --------------------------------------------------------------------- */

.icono-boton {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radio-chico);
  background: transparent;
  color: var(--texto-tenue);
  transition:
    background var(--transicion),
    color var(--transicion);
}





.icono-boton:hover {
  background: #DDE8D0;
  color: var(--verde-bosque);
}





.icono-boton--peligro:hover {
  background: var(--peligro-fondo);
  color: var(--peligro);
}





.icono-boton--grande {
  width: 36px;
  height: 36px;
}





/* En pantallas táctiles los botones de icono son más grandes. */
@media (pointer: coarse) {

  .icono-boton {
    width: 40px;
    height: 40px;
  }

  .icono-boton--grande {
    width: 44px;
    height: 44px;
  }

}
