/* ==========================================================================
   Reusable components: buttons, cards, inputs, toasts, badges
   ========================================================================== */

.fq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-btn);
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
  min-height: 44px;
  white-space: nowrap;
}
.fq-btn:active { transform: scale(0.97); }
.fq-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.fq-btn--primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.fq-btn--primary:hover:not(:disabled) { background: var(--primary-dark); box-shadow: var(--shadow-md); }

.fq-btn--secondary { background: var(--surface-alt); color: var(--text); }
.fq-btn--secondary:hover:not(:disabled) { background: var(--border); }

.fq-btn--accent { background: var(--accent); color: #402D00; }
.fq-btn--danger { background: var(--danger); color: #fff; }
.fq-btn--ghost { background: transparent; color: var(--muted); }
.fq-btn--ghost:hover { color: var(--text); background: var(--surface-alt); }

.fq-btn--lg { padding: 18px 36px; font-size: 1.15rem; border-radius: 20px; }
.fq-btn--sm { padding: 9px 16px; font-size: 0.85rem; min-height: 36px; }
.fq-btn--block { width: 100%; }

.fq-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
}
.fq-icon-btn:hover { background: var(--surface-alt); }

/* Cards */

.fq-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.fq-card--hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

/* Inputs */

.fq-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.fq-field label { font-weight: 700; font-size: 0.9rem; }
.fq-field .fq-hint { font-size: 0.8rem; color: var(--muted); }
.fq-field .fq-error { font-size: 0.82rem; color: var(--danger); font-weight: 600; }

.fq-input, .fq-textarea, .fq-select {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-input);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.15s ease;
}
.fq-input:focus, .fq-textarea:focus, .fq-select:focus {
  border-color: var(--primary);
  outline: none;
}
.fq-input.has-error, .fq-textarea.has-error { border-color: var(--danger); }
.fq-textarea { resize: vertical; min-height: 80px; }

/* Badges */

.fq-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--surface-alt);
  color: var(--muted);
}
.fq-badge--success { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.fq-badge--primary { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); }
.fq-badge--accent { background: color-mix(in srgb, var(--accent) 22%, transparent); color: #8a5b00; }
.fq-badge--danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }

/* Toasts */

.fq-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}
@media (max-width: 600px) {
  .fq-toast-container { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

.fq-toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 16px;
  padding: 14px 18px;
  box-shadow: var(--shadow-md);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: fq-toast-in 0.25s ease;
}
.fq-toast--success { border-left-color: var(--success); }
.fq-toast--error { border-left-color: var(--danger); }
.fq-toast__close { cursor: pointer; color: var(--muted); background: none; border: none; font-size: 1rem; }

@keyframes fq-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.fq-toast.fq-toast--out { animation: fq-toast-out 0.2s ease forwards; }
@keyframes fq-toast-out { to { opacity: 0; transform: translateY(8px); } }

/* Empty states */

.fq-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.fq-empty__icon { font-size: 3rem; margin-bottom: 12px; }
.fq-empty h3 { color: var(--text); margin-bottom: 8px; }
.fq-empty p { margin-bottom: 20px; }

/* Avatars */

.fq-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  background: var(--surface-alt);
  font-size: 1.4rem;
  flex-shrink: 0;
}

/* Skeleton loading */

.fq-skeleton {
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 50%, var(--surface-alt) 75%);
  background-size: 200% 100%;
  animation: fq-shimmer 1.4s ease infinite;
  border-radius: 12px;
}
@keyframes fq-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Modal */
.fq-modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 10, 20, 0.5);
  display: flex; align-items: center; justify-content: center; z-index: 500;
  padding: 20px;
}
.fq-modal {
  background: var(--surface); border-radius: var(--radius-card);
  padding: 28px; max-width: 420px; width: 100%; box-shadow: var(--shadow-lg);
}
.fq-modal h3 { margin-bottom: 10px; }
.fq-modal p { color: var(--muted); margin-bottom: 20px; }
.fq-modal__actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Connection indicator */
.fq-connection {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 900; padding: 8px 18px; border-radius: var(--radius-pill);
  font-weight: 700; font-size: 0.82rem; box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 8px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.fq-connection--ok { background: color-mix(in srgb, var(--success) 20%, var(--surface)); color: var(--success); }
.fq-connection--bad { background: color-mix(in srgb, var(--danger) 20%, var(--surface)); color: var(--danger); }
.fq-connection.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(-10px); }
.fq-connection__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.fq-connection--ok .fq-connection__dot { animation: fq-pulse 1.6s ease infinite; }
@keyframes fq-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
