/* ============================================
   WeldFolio Base Components
   Buttons, Cards, Inputs, Badges, Pills
   Built on top of design-tokens.css
   ============================================ */

/* ============================================
   BUTTONS
   ============================================ */

/* Base button reset */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base) var(--ease-out);
  white-space: nowrap;
  text-decoration: none;
}

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

/* Primary Button */
.btn-primary {
  background: var(--accent-primary);
  color: var(--text-inverse);
  box-shadow: 0 0 20px var(--accent-primary-glow);
}
.btn-primary:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(255, 122, 0, 0.4);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 0 15px var(--accent-primary-glow);
}

/* Secondary / Ghost Button */
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--bg-tertiary);
  transform: translateY(-1px);
}
.btn-secondary:active {
  transform: translateY(0);
  background: var(--bg-surface);
}

/* Tertiary / Text Button */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: var(--space-2) var(--space-4);
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

/* Icon Button */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast) ease;
}
.btn-icon:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-icon:active {
  background: var(--bg-secondary);
  transform: scale(0.96);
}
.btn-icon svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Button sizes */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}
.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  font-weight: 700;
}
.btn-full {
  width: 100%;
}

/* Disabled state */
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ============================================
   CARDS
   ============================================ */

/* Base card */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-base) ease;
}

/* Profile Card — welder search results, gallery */
.card-profile {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-base) ease;
  cursor: pointer;
}
.card-profile:hover {
  border-color: var(--border-default);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}
.card-profile .card-image {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-tertiary);
}
.card-profile .card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow) ease;
}
.card-profile:hover .card-image img {
  transform: scale(1.05);
}
.card-profile .card-body {
  padding: var(--space-5) var(--space-6);
}
.card-profile .card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.card-profile .card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}
.card-profile .card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Stat Card — dashboard metrics, data blocks */
.card-stat {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  transition: all var(--transition-base) ease;
}
.card-stat:hover {
  border-color: var(--border-default);
}
.card-stat .stat-value {
  font-size: var(--text-4xl);
  font-weight: 800;
  color: var(--accent-primary);
  line-height: 1;
  margin-bottom: var(--space-2);
}
.card-stat .stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
}
.card-stat .stat-icon {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-3);
  display: block;
}

/* Feature Card — homepage sections */
.card-feature {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  transition: all var(--transition-base) ease;
}
.card-feature:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-lg);
}
.card-feature .feature-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 122, 0, 0.15);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
  color: var(--accent-primary);
}
.card-feature .feature-icon svg {
  width: 24px;
  height: 24px;
}
.card-feature .feature-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}
.card-feature .feature-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* ============================================
   INPUTS
   ============================================ */

/* Text Input */
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  outline: none;
  transition: all var(--transition-fast) ease;
  box-shadow: none;
}
.input::placeholder {
  color: var(--text-muted);
}
.input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}
.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.input.error {
  border-color: var(--status-error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}
.input.success {
  border-color: var(--status-success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* Textarea */
textarea.input {
  min-height: 120px;
  resize: vertical;
  line-height: var(--leading-normal);
}

/* Select */
.select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg-tertiary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
  cursor: pointer;
}
.select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* Input with icon */
.input-wrapper {
  position: relative;
}
.input-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.input-icon svg {
  width: 16px;
  height: 16px;
}
.input.has-icon {
  padding-left: var(--space-10);
}

/* Label */
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}
.form-error {
  font-size: var(--text-xs);
  color: var(--status-error);
  margin-top: var(--space-1);
}

/* ============================================
   BADGES
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1.5;
}

.badge-orange {
  background: rgba(255, 122, 0, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(255, 122, 0, 0.3);
}

.badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: var(--status-success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-blue {
  background: rgba(74, 158, 255, 0.15);
  color: var(--accent-steel);
  border: 1px solid rgba(74, 158, 255, 0.3);
}

.badge-yellow {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-gray {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.badge-sm {
  padding: 2px var(--space-2);
  font-size: 10px;
}

/* ============================================
   PILL / CHIP
   ============================================ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  user-select: none;
}
.pill:hover {
  border-color: var(--border-default);
  background: var(--bg-surface);
}
.pill.active {
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-color: var(--accent-primary);
  font-weight: 600;
}

.pill-remove {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition-fast) ease;
}
.pill-remove:hover {
  background: rgba(0,0,0,0.3);
}

/* ============================================
   UTILITY HELPERS
   ============================================ */

/* Stack gap helper (reusable flex row) */
.flex-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.flex-wrap {
  flex-wrap: wrap;
}
.flex-gap-2 { gap: var(--space-2); }
.flex-gap-3 { gap: var(--space-3); }
.flex-gap-4 { gap: var(--space-4); }

/* Visibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}