/* PGAIN.AI design-system components — W3.4 + W3.5. Powered by Cowork v1.
   Complements the Tailwind CDN already loaded on every page. Classes here give
   a single source of truth for buttons/cards/inputs/badges/toasts + loading
   states, so new pages stay visually consistent with the slate/blue brand. */

/* ── Buttons ── */
.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.25rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, opacity 0.15s ease;
  min-height: 44px; /* W4.6.2 touch target */
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary { background: var(--color-bg-elev); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: #2b3a52; }
.btn-danger { background: var(--color-error); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Cards ── */
.card { background: var(--color-bg-card); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--color-border); font-weight: 700; }
.card-body { padding: 1.5rem; }

/* ── Inputs ── */
.input {
  width: 100%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  color: var(--color-text);
  font-size: 0.875rem;
}
.input:focus { outline: none; border-color: var(--color-primary); }
.input-error { border-color: var(--color-error); }

/* ── Badges ── */
.badge-success,
.badge-warning,
.badge-info {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: rgba(34,197,94,0.15); color: var(--color-success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--color-warning); }
.badge-info { background: rgba(37,99,235,0.15); color: #60a5fa; }

/* ── Toast (Alpine-controllable, fixed bottom-right) ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--color-bg-elev);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
  z-index: 50;
}

/* ── W3.5 Loading states ── */
.skeleton {
  background: linear-gradient(90deg, #1e293b 0%, #334155 50%, #1e293b 100%);
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite;
  border-radius: 4px;
}
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid #334155;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
