/* Handshake UI Design System Tokens & Shared Component Primitives */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --border: #e2e8f0;
  --card-bg: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --success-bg: #d1fae5;
  --success-text: #065f46;
  --error-bg: #fee2e2;
  --error-text: #991b1b;
  --code-bg: #0f172a;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f8fafc;
  color: #0f172a;
}

/* Shared Button Primitives */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2.25rem;
  padding: 0 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.15s ease-in-out;
}
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary { background-color: #2563eb; color: #ffffff; }
.btn-primary:hover:not(:disabled) { background-color: #1d4ed8; }
.btn-outline { background-color: #ffffff; color: #334155; border-color: #cbd5e1; }
.btn-outline:hover:not(:disabled) { background-color: #f1f5f9; border-color: #94a3b8; }
.btn-success { background-color: #10b981; color: #ffffff; }
.btn-success:hover:not(:disabled) { background-color: #059669; }
.btn-danger { background-color: #ef4444; color: #ffffff; }
.btn-danger:hover:not(:disabled) { background-color: #dc2626; }
.btn-sm { height: 1.875rem; padding: 0 0.625rem; font-size: 0.75rem; border-radius: 0.375rem; gap: 0.3125rem; }
.btn-xs { height: 1.5rem; padding: 0 0.5rem; font-size: 0.75rem; border-radius: 0.375rem; gap: 0.25rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 0.9375rem; height: 0.9375rem; flex-shrink: 0; }
.btn-sm svg { width: 0.8125rem; height: 0.8125rem; flex-shrink: 0; }
.btn-xs svg { width: 0.75rem; height: 0.75rem; flex-shrink: 0; }

/* Shared Badge Primitives */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3125rem;
  height: 1.5rem;
  padding: 0 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 9999px;
  white-space: nowrap;
  user-select: none;
  box-sizing: border-box;
}
.badge-sm {
  height: 1.25rem;
  padding: 0 0.5rem;
  font-size: 0.6875rem;
}
.badge-live { background-color: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-test { background-color: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-active { background-color: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-revoked { background-color: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.badge-scope { background-color: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; font-family: monospace; font-size: 0.7rem; }
.badge-purple { background-color: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }
.badge-amber { background-color: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* Health Pulse Indicator */
.health-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 1.5rem;
  padding: 0 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  white-space: nowrap;
  user-select: none;
  box-sizing: border-box;
}
.health-online {
  background-color: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.pulse-dot {
  width: 0.4375rem;
  height: 0.4375rem;
  background-color: #10b981;
  border-radius: 9999px;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-ring 1.8s infinite;
  flex-shrink: 0;
}
@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Filter & Pill Controls */
.filter-pill {
  display: inline-flex; align-items: center; justify-content: center;
  height: 1.5rem; padding: 0 0.625rem; font-size: 0.75rem; font-weight: 600; line-height: 1;
  border-radius: 9999px; cursor: pointer; white-space: nowrap; user-select: none;
  transition: all 0.15s ease-in-out; border: 1px solid transparent;
}
.filter-pill.active { background-color: #2563eb; color: #ffffff; border-color: #2563eb; }
.filter-pill:not(.active) { background-color: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.filter-pill:not(.active):hover { background-color: #e2e8f0; color: #1e293b; }

/* Form Controls */
.form-input, .form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background-color: #ffffff;
  color: #0f172a;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-backdrop.active {
  display: flex;
}
.modal-box {
  background-color: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
}

/* Code Display */
.code-box {
  background-color: #0f172a;
  color: #e2e8f0;
  border-radius: 0.5rem;
  font-family: "Fira Code", Consolas, Monaco, monospace;
  font-size: 0.8125rem;
  overflow-x: auto;
  padding: 1rem;
}
