/* ═══════════════════════════════════════════════════════════════════════════ */
/*                    BOTÕES COM EFEITOS DHTML — OOP PATTERN                   */
/*                          Aplicável a Todos os Sistemas                      */
/* ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* EFEITOS */
  --btn-transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --btn-hover-lift: -4px;
  --btn-active-press: 0px;
  --shadow-hover: 0 12px 24px rgba(0, 0, 0, 0.3);
  --shadow-active: 0 2px 4px rgba(0, 0, 0, 0.2);
  --btn-chamfer: inset 0 1px 0 rgba(255,255,255,0.24), inset 0 -2px 0 rgba(0,0,0,0.24);
  --btn-chamfer-hover: inset 0 1px 0 rgba(255,255,255,0.30), inset 0 -3px 0 rgba(0,0,0,0.26);
  --btn-depth: 0 3px 0 rgba(0,0,0,0.30), 0 8px 18px rgba(0,0,0,0.22);
  --btn-depth-hover: 0 5px 0 rgba(0,0,0,0.32), 0 14px 30px rgba(0,0,0,0.30);
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                           BOTÕES BASE (OOP)                                  */
/* ═════════════════════════════════════════════════════════════════════════════ */

button,
a.btn,
.btn,
[role="button"],
input[type="submit"],
input[type="button"],
input[type="reset"] {
  /* LAYOUT */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;

  /* TIPOGRAFIA */
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  letter-spacing: 1pt;
  text-decoration: none;
  text-transform: none;

  /* ESTILO */
  border: none;
  border-radius: 12px;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;

  /* ANIMAÇÃO */
  transition: var(--btn-transition);
  transform: translateY(0);
  box-shadow: var(--btn-chamfer), var(--btn-depth);
  position: relative;
  overflow: hidden;

  /* FOCUS */
  outline: none;
}

button:focus-visible,
a.btn:focus-visible,
.btn:focus-visible,
[role="button"]:focus-visible,
input[type="submit"]:focus-visible,
input[type="button"]:focus-visible,
input[type="reset"]:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                        EFEITO: HOVER & ACTIVE (OOP)                         */
/* ═════════════════════════════════════════════════════════════════════════════ */

button:hover,
a.btn:hover,
.btn:hover,
[role="button"]:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
input[type="reset"]:hover {
  transform: translateY(var(--btn-hover-lift));
  box-shadow: var(--btn-chamfer-hover), var(--btn-depth-hover), var(--shadow-hover);
  filter: brightness(1.08);
}

button:active,
a.btn:active,
.btn:active,
[role="button"]:active,
input[type="submit"]:active,
input[type="button"]:active,
input[type="reset"]:active {
  transform: translateY(var(--btn-active-press));
  box-shadow: var(--btn-chamfer), var(--shadow-active);
}

button:disabled,
a.btn:disabled,
.btn:disabled,
[role="button"][aria-disabled="true"],
input[type="submit"]:disabled,
input[type="button"]:disabled,
input[type="reset"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(30%);
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                     VARIANTES: PRIMARY (OOP)                                */
/* ═════════════════════════════════════════════════════════════════════════════ */

.btn-primary,
button.btn-primary,
input[type="submit"].btn-primary,
a.btn-primary {
  background: linear-gradient(135deg, #3caa6e 0%, #2d8a55 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
}

.btn-primary:hover,
button.btn-primary:hover,
input[type="submit"].btn-primary:hover,
a.btn-primary:hover {
  background: linear-gradient(135deg, #4db876 0%, #2d8a55 100%);
  box-shadow: var(--btn-chamfer-hover), var(--btn-depth-hover), 0 12px 28px rgba(60, 170, 110, 0.4);
}

.btn-primary:active,
button.btn-primary:active,
input[type="submit"].btn-primary:active,
a.btn-primary:active {
  background: linear-gradient(135deg, #2d8a55 0%, #1f5c39 100%);
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                     VARIANTES: SECONDARY (OOP)                              */
/* ═════════════════════════════════════════════════════════════════════════════ */

.btn-secondary,
button.btn-secondary,
input[type="submit"].btn-secondary,
a.btn-secondary {
  background: linear-gradient(135deg, #4b5563 0%, #2f3744 100%);
  color: #d8e0e4;
  border: 1px solid rgba(216, 224, 228, 0.15);
}

.btn-secondary:hover,
button.btn-secondary:hover,
input[type="submit"].btn-secondary:hover,
a.btn-secondary:hover {
  background: linear-gradient(135deg, #5a6574 0%, #3d4654 100%);
  border-color: rgba(216, 224, 228, 0.3);
  box-shadow: var(--btn-chamfer-hover), var(--btn-depth-hover), 0 12px 28px rgba(45, 51, 61, 0.4);
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                     VARIANTES: GHOST (OOP)                                  */
/* ═════════════════════════════════════════════════════════════════════════════ */

.btn-ghost,
button.btn-ghost,
a.btn-ghost {
  background: transparent;
  color: #86d5a9;
  border: 1px solid rgba(134, 213, 169, 0.3);
  box-shadow: inset 0 0 0 2px transparent;
}

.btn-ghost:hover,
button.btn-ghost:hover,
a.btn-ghost:hover {
  background: rgba(134, 213, 169, 0.08);
  border-color: rgba(134, 213, 169, 0.6);
  box-shadow: var(--btn-chamfer-hover), 0 2px 0 rgba(134,213,169,0.25), inset 0 0 8px rgba(134, 213, 169, 0.1);
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                     VARIANTES: DANGER (OOP)                                 */
/* ═════════════════════════════════════════════════════════════════════════════ */

.btn-danger,
button.btn-danger,
input[type="reset"].btn-danger,
a.btn-danger {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
}

.btn-danger:hover,
button.btn-danger:hover,
input[type="reset"].btn-danger:hover,
a.btn-danger:hover {
  background: linear-gradient(135deg, #fb9191 0%, #dc2626 100%);
  box-shadow: var(--btn-chamfer-hover), var(--btn-depth-hover), 0 12px 28px rgba(248, 113, 113, 0.4);
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                     VARIANTES: SUCCESS (OOP)                                */
/* ═════════════════════════════════════════════════════════════════════════════ */

.btn-success,
button.btn-success,
a.btn-success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
}

.btn-success:hover,
button.btn-success:hover,
a.btn-success:hover {
  background: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
  box-shadow: var(--btn-chamfer-hover), var(--btn-depth-hover), 0 12px 28px rgba(34, 197, 94, 0.4);
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                     VARIANTES: WARNING (OOP)                                */
/* ═════════════════════════════════════════════════════════════════════════════ */

.btn-warning,
button.btn-warning,
a.btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
}

.btn-warning:hover,
button.btn-warning:hover,
a.btn-warning:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  box-shadow: var(--btn-chamfer-hover), var(--btn-depth-hover), 0 12px 28px rgba(245, 158, 11, 0.4);
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                     TAMANHOS (OOP)                                          */
/* ═════════════════════════════════════════════════════════════════════════════ */

.btn-sm,
button.btn-sm,
a.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: 6px;
}

.btn-lg,
button.btn-lg,
a.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.05rem;
  border-radius: 10px;
}

.btn-full,
button.btn-full,
a.btn-full {
  width: 100%;
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                     EFEITOS ESPECIAIS (DHTML)                               */
/* ═════════════════════════════════════════════════════════════════════════════ */

/* Efeito: Ripple (Onda) */
.btn-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  to {
    width: 400px;
    height: 400px;
    opacity: 0;
  }
}

/* Efeito: Slide (Deslizar) */
.btn-slide {
  position: relative;
  overflow: hidden;
}

.btn-slide::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  transition: left 0.3s ease;
}

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

/* Efeito: Pulse (Pulsação) */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.btn-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.btn-pulse:hover {
  animation: none;
}

/* Efeito: Rotate (Rotação) */
.btn-rotate:hover {
  transform: translateY(var(--btn-hover-lift)) rotate(2deg);
}

.btn-rotate:active {
  transform: translateY(var(--btn-active-press)) rotate(-2deg);
}

/* Efeito: Scale (Escala) */
.btn-scale:hover {
  transform: translateY(var(--btn-hover-lift)) scale(1.05);
}

.btn-scale:active {
  transform: translateY(var(--btn-active-press)) scale(0.98);
}

/* Efeito: 3D (Perspectiva) */
.btn-3d {
  transform-style: preserve-3d;
  transform: translateZ(0);
}

.btn-3d:hover {
  transform: translateY(var(--btn-hover-lift)) translateZ(20px) rotateX(2deg) rotateY(2deg);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.3),
    inset -2px -2px 4px rgba(0, 0, 0, 0.15);
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                     LOADER (Loading State)                                  */
/* ═════════════════════════════════════════════════════════════════════════════ */

.btn-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                     RESPONSIVE                                              */
/* ═════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  button,
  a.btn,
  .btn,
  [role="button"],
  input[type="submit"],
  input[type="button"],
  input[type="reset"] {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    border-radius: 6px;
  }

  .btn-lg {
    padding: 0.8rem 1.5rem;
  }
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                     ACCESSIBILITY                                           */
/* ═════════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  button,
  a.btn,
  .btn,
  [role="button"],
  input[type="submit"],
  input[type="button"],
  input[type="reset"] {
    transition: none;
  }

  .btn-ripple::after {
    animation: none;
  }

  .btn-pulse {
    animation: none;
  }

  .btn-loading::after {
    animation: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: more) {
  button,
  a.btn,
  .btn,
  [role="button"],
  input[type="submit"],
  input[type="button"],
  input[type="reset"] {
    border-width: 2px;
    border-style: solid;
  }
}
