/*
  Button 05 — Action State Button — standalone HTML/CSS/JS implementation.
  No build step, no framework, no external dependency: copy index.html,
  this file, and script.js into any project as-is. `--button-accent` is a
  plain custom property — override it wherever this button is used.
*/

:root {
  --button-accent: #39ff14;
  --button-foreground: #0f172a;
  --button-foreground-hover: #262f3d;
}

.action-btn {
  display: inline-flex;
  height: 2.75rem;
  min-width: 11rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 9999px;
  border: 1px solid var(--button-foreground);
  background-color: var(--button-foreground);
  padding: 0 1.5rem;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: #ffffff;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.action-btn:hover {
  background-color: var(--button-foreground-hover);
  border-color: var(--button-foreground-hover);
}

.action-btn:active {
  transform: scale(0.98);
}

.action-btn:focus-visible {
  outline: 2px solid var(--button-accent);
  outline-offset: 2px;
}

.action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.action-btn__face {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  animation: action-btn-fade-in 200ms ease;
}

@keyframes action-btn-fade-in {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.action-btn__spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  border-radius: 9999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: action-btn-spin 700ms linear infinite;
}

.action-btn[data-state="loading"] .action-btn__spinner {
  display: inline-block;
}

@keyframes action-btn-spin {
  to {
    transform: rotate(360deg);
  }
}

.action-btn__check {
  display: none;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.action-btn[data-state="success"] .action-btn__check {
  display: inline-flex;
}

@media (prefers-reduced-motion: reduce) {
  .action-btn {
    transition: background-color 150ms ease, border-color 150ms ease;
    transform: none;
  }

  .action-btn:active {
    transform: none;
  }

  .action-btn__face {
    animation: none;
  }

  .action-btn__spinner {
    animation: action-btn-pulse 1200ms ease-in-out infinite;
    border-top-color: rgba(255, 255, 255, 0.35);
  }
}

@keyframes action-btn-pulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

/*
  Page layout — the canvas this resource is presented on. Adjust or drop it
  when placing the resource inside your own layout.
*/

body {
  margin: 0;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(to bottom, #fafafa, #f4f4f5);
}
.button05-layout {
  display: flex;
  min-height: 20rem;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.button05-layout__panel {
  display: flex;
  width: 100%;
  max-width: 42rem;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background-color: #ffffff;
  padding: 2rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 16px 40px -16px rgba(0, 0, 0, 0.14);
}
@media (min-width: 640px) {
  .button05-layout__panel {
    padding: 3rem;
  }
}
