/* ============================================================
   COMPONENTS — Buttons, Inputs, Cards, Tags
   ============================================================ */

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-5);
  height: 40px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  font-family: var(--font-sans);
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast),
    opacity var(--transition-fast);
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary — solid emerald */
.btn-primary {
  background: var(--accent);
  color: #052e16;
  font-weight: var(--weight-semibold);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
  box-shadow: var(--shadow-accent-sm);
}
.btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Secondary — outlined zinc */
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-light);
}
.btn-secondary:hover {
  background: var(--bg-overlay);
  border-color: rgba(255,255,255,0.2);
}
.btn-secondary:focus-visible {
  outline: 2px solid var(--border-light);
  outline-offset: 2px;
}

/* Ghost — no border */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-overlay);
  color: var(--text-primary);
}

/* Accent ghost */
.btn-accent-ghost {
  background: var(--accent-dim);
  color: var(--accent-light);
  border-color: rgba(16,185,129,0.2);
}
.btn-accent-ghost:hover {
  background: rgba(16,185,129,0.15);
  border-color: rgba(16,185,129,0.3);
  box-shadow: var(--shadow-accent-sm);
}

/* Sizes */
.btn-sm { height: 32px; padding: 0 var(--space-3); font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-lg { height: 48px; padding: 0 var(--space-6); font-size: var(--text-base); border-radius: var(--radius-md); }
.btn-xl { height: 56px; padding: 0 var(--space-8); font-size: var(--text-lg); border-radius: var(--radius-lg); gap: var(--space-3); }

/* Icon button */
.btn-icon {
  padding: 0;
  width: 40px;
  aspect-ratio: 1;
}
.btn-icon.btn-sm { width: 32px; }
.btn-icon.btn-lg { width: 48px; }

/* ── INPUTS ─────────────────────────────────────────────── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.input-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}
.input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  outline: none;
}
.input::placeholder { color: var(--text-disabled); }
.input:hover { border-color: var(--border-light); }
.input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow-sm);
  background: var(--bg-elevated);
}
.input-lg {
  height: 52px;
  font-size: var(--text-base);
  border-radius: var(--radius-md);
  padding: 0 var(--space-5);
}
.input-xl {
  height: 60px;
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
  padding: 0 var(--space-6);
  font-weight: var(--weight-medium);
  letter-spacing: -0.01em;
}

/* Input with leading icon */
.input-wrapper {
  position: relative;
}
.input-wrapper .input { padding-left: 2.75rem; }
.input-wrapper .input-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.input-wrapper.has-suffix .input { padding-right: 5rem; }
.input-wrapper .input-suffix {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
}

/* Hero search bar */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow);
}
.search-bar:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow-sm), var(--shadow-md);
}
.search-bar .search-input {
  flex: 1;
  height: 56px;
  padding: 0 var(--space-5);
  background: transparent;
  border: none;
  outline: none;
  font-size: var(--text-base);
  font-family: var(--font-sans);
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}
.search-bar .search-input::placeholder { color: var(--text-disabled); font-weight: var(--weight-regular); }
.search-bar .search-btn {
  margin: var(--space-2);
  flex-shrink: 0;
}

/* ── CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.card-hover:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-glow:hover {
  border-color: rgba(16,185,129,0.2);
  box-shadow: var(--shadow-accent);
}
.card-body { padding: var(--space-6); }
.card-body-sm { padding: var(--space-4); }
.card-body-lg { padding: var(--space-8); }

/* Tool card */
.tool-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}
.tool-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-light);
  transform: translateY(-1px);
}
.tool-card:hover .tool-card-icon { color: var(--accent-light); }
.tool-card-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}
.tool-card-content { min-width: 0; }
.tool-card-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tool-card-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Stat card (bento) */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.stat-card-value {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  line-height: 1;
}
.stat-card-value.accent { color: var(--accent); }
.stat-card-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: var(--weight-medium);
}
.stat-card-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--success);
}

/* Pricing card */
.pricing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: relative;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.pricing-card:hover {
  border-color: var(--border-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.pricing-card.featured {
  background: linear-gradient(145deg, rgba(16,185,129,0.06) 0%, var(--bg-surface) 100%);
  border-color: rgba(16,185,129,0.3);
}
.pricing-card.featured:hover {
  border-color: rgba(16,185,129,0.5);
  box-shadow: var(--shadow-accent);
}
.pricing-badge-featured {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #052e16;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  white-space: nowrap;
}
.pricing-tier {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}
.pricing-price {
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  line-height: 1;
}
.pricing-price span {
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  color: var(--text-muted);
  letter-spacing: 0;
}
.pricing-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex: 1;
}
.pricing-feature {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.pricing-feature-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(16,185,129,0.3);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 9px;
}

/* ── CODE BLOCK ─────────────────────────────────────────── */
.code-block {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  overflow-x: auto;
  position: relative;
}
.code-block .accent-word { color: var(--accent-light); }
.code-block .muted-word  { color: var(--text-muted); }
.code-block .string-word { color: #fbbf24; }

/* ── TOOLTIP ────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: var(--z-tooltip, 50);
  box-shadow: var(--shadow-md);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── TAG / CHIP ─────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  background: var(--bg-overlay);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
}

/* ── SPINNER ─────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-lg { width: 24px; height: 24px; border-width: 3px; }

/* ── COPY BUTTON ─────────────────────────────────────────── */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.copy-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-light);
}
.copy-btn.copied { color: var(--accent); border-color: rgba(16,185,129,0.3); }
