:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

/* Override Chrome autofill styles in dark mode */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0px 1000px #0f172a inset !important;
  -webkit-text-fill-color: #e2e8f0 !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* ── Common components ───────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
  border: none;
  cursor: pointer;
}

.btn:focus {
  outline: none;
}

.btn-primary {
  background-color: #6366f1;
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #4f46e5;
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid #475569;
  color: #cbd5e1;
}

.btn-secondary:hover {
  background-color: #334155;
  color: #ffffff;
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.2);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1rem;
}

.card {
  background-color: rgba(30, 41, 59, 0.5);
  backdrop-filter: blur(4px);
  border: 1px solid #334155;
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.card-accent {
  border-top-width: 4px;
  border-top-color: #6366f1;
}

.input {
  width: 100%;
  padding: 0.625rem 1rem;
  background-color: #0f172a;
  border: 1px solid #334155;
  border-radius: 0.5rem;
  color: #e2e8f0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.input::placeholder {
  color: #64748b;
}

.input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.input-group {
  position: relative;
}

.input-group .input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
}

.input-group .input {
  padding-left: 2.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  border-width: 1px;
}

.badge-green {
  background-color: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.2);
}

.badge-red {
  background-color: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.2);
}

.badge-amber {
  background-color: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.2);
}

/* ── Decorative background ───────────────────────────────── */

.hero-glow {
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.15), transparent);
}

/* ── Toggle switch ───────────────────────────────────────── */

.toggle-switch {
  position: relative;
  display: inline-flex;
  height: 1.5rem;
  width: 2.75rem;
  align-items: center;
  border-radius: 9999px;
  background-color: #334155;
  transition: background-color 150ms ease;
  cursor: pointer;
}

.toggle-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  height: 1.25rem;
  width: 1.25rem;
  border-radius: 9999px;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  transition: transform 150ms ease;
}

.toggle-switch:has(input:checked) {
  background-color: #6366f1;
}

.toggle-switch:has(input:checked)::after {
  transform: translateX(1.25rem);
  border-color: #ffffff;
}

/* ── Animations ──────────────────────────────────────────── */

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

.animate-spin {
  animation: spin 1s linear infinite;
}

@keyframes fade-in-down {
  from {
    opacity: 0;
    transform: translateY(-0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-down {
  animation: fade-in-down 0.3s ease-out;
}

/* ── Table ───────────────────────────────────────────────── */

.data-table {
  width: 100%;
  font-size: 0.875rem;
  line-height: 1.25rem;
  text-align: left;
}

.data-table thead {
  font-size: 0.75rem;
  line-height: 1rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #334155;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
}

.data-table tbody tr {
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  transition: background-color 150ms ease;
}

.data-table tbody tr:hover {
  background-color: rgba(51, 65, 85, 0.3);
}

/* ── Utilities ───────────────────────────────────────────── */

.text-gradient {
  background-image: linear-gradient(to right, #818cf8, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.code-block {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #e2e8f0;
  background-color: #0f172a;
  padding: 0.75rem;
  border-radius: 0.5rem;
  word-break: break-all;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 3rem;
  padding-bottom: 3rem;
  color: #64748b;
}
