/* Forge | components.css
   Reusable UI parts. Hero card, stat cards, buttons, inputs,
   avatars, chips, toast, modal, bottom sheet, skeleton. */

/* HERO CARD (gradient) */
.hero-card {
  position: relative; overflow: hidden;
  background: var(--gradient-forge);
  color: var(--primary-text);
  border-radius: var(--r-xl);
  padding: var(--s-5);
  box-shadow: 0 8px 32px rgba(62, 207, 142, 0.22);
}
.hero-card::after {
  content: '';
  position: absolute; top: -40%; right: -20%;
  width: 60%; height: 180%;
  background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%);
  pointer-events: none;
}
.hero-label { font-size: var(--fs-sm); opacity: 0.85; margin-bottom: var(--s-2); }
.hero-value {
  font-size: 40px; font-weight: 700; line-height: 1;
  letter-spacing: -0.02em; margin-bottom: var(--s-2);
}
.hero-sub { font-size: var(--fs-sm); opacity: 0.85; }

/* STAT GRID */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-3);
}
@media (min-width: 600px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  transition: transform var(--t-fast) var(--ease-in),
              box-shadow var(--t-fast) var(--ease-in),
              border-color var(--t-fast) var(--ease-in);
}
@media (hover: hover) {
  .stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
}
.stat-label { font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--s-2); }
.stat-value {
  font-size: var(--fs-h1); font-weight: 700;
  color: var(--text-strong); line-height: 1.1;
}
.stat-value.positive { color: var(--primary); }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  min-height: 46px; padding: 0 var(--s-5);
  border-radius: var(--r-md);
  font-size: var(--fs-body); font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease-in),
              color var(--t-fast) var(--ease-in),
              box-shadow var(--t-fast) var(--ease-in),
              border-color var(--t-fast) var(--ease-in),
              transform var(--t-fast) var(--ease-in);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover); box-shadow: var(--sh-glow);
}
.btn-ghost {
  background: transparent; color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--error); color: #FFFFFF; }
.btn-danger:hover:not(:disabled) { background: #DC2626; }
.btn-icon {
  width: 44px; height: 44px; min-height: 44px; padding: 0;
  border-radius: var(--r-pill); color: var(--muted);
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }
.btn-icon svg { width: 20px; height: 20px; }
.btn-block { width: 100%; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* INPUTS */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.label { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; min-height: 46px;
  padding: var(--s-3) var(--s-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text); font-size: var(--fs-body);
  transition: border-color var(--t-fast) var(--ease-in),
              box-shadow var(--t-fast) var(--ease-in);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--sh-glow);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }

/* AVATAR */
.avatar {
  position: relative; flex: 0 0 auto;
  width: 40px; height: 40px;
  border-radius: var(--r-pill);
  background: var(--gradient-forge);
  color: var(--primary-text); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: var(--fs-sm); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--fs-h2); }
.avatar-xl { width: 96px; height: 96px; font-size: var(--fs-display); }
.avatar-wrap { position: relative; display: inline-block; }
.avatar-online::after {
  content: '';
  position: absolute; right: 0; bottom: 0;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg);
}

/* CHIP */
.chip {
  display: inline-flex; align-items: center; gap: var(--s-1);
  padding: var(--s-1) var(--s-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 500; color: var(--text);
}
.chip-primary {
  background: var(--primary-soft);
  border-color: transparent; color: var(--primary);
}
.chip-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: transparent; color: var(--error);
}

/* CARD */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}

/* TOAST */
.toast-host {
  position: fixed; top: var(--s-4); left: 50%;
  transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column;
  gap: var(--s-2);
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: var(--s-3) var(--s-4);
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--sh-md);
  font-size: var(--fs-sm); font-weight: 500;
  animation: toast-in var(--t-normal) var(--ease-in);
}
.toast-success { border-color: var(--primary); color: var(--primary); }
.toast-error   { border-color: var(--error);   color: var(--error); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* MODAL */
.backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(5, 6, 12, 0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-4);
  animation: fade-in var(--t-normal) var(--ease-in);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 420px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  padding: var(--s-5);
  animation: modal-in var(--t-slow) var(--ease-in);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* SKELETON */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  border-radius: var(--r-md);
  animation: shimmer 1400ms linear infinite;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
