/* ═══════════════════════════════════════════════════════════════
   TRADESMART HUB — Reusable UI Components
   Toast notifications, skeleton loaders, form validation, PWA prompt
   ═══════════════════════════════════════════════════════════════ */

/* ─── Toast Notifications ─────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  padding: 14px 20px;
  border-radius: 12px;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toastSlideIn 0.3s ease-out;
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.toast.hiding {
  opacity: 0;
  transform: translateX(100%);
}

.toast-success { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.3); }
.toast-error { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.3); }
.toast-warning { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.3); }
.toast-info { background: rgba(14,165,233,0.15); border-color: rgba(14,165,233,0.3); }

.toast-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 700; font-size: 14px; color: white; margin-bottom: 2px; }
.toast-message { font-size: 13px; color: rgba(255,255,255,0.75); line-height: 1.4; }
.toast-close {
  background: none; border: none; color: rgba(255,255,255,0.5); cursor: pointer;
  font-size: 18px; padding: 0 4px; line-height: 1; flex-shrink: 0;
}
.toast-close:hover { color: white; }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* ─── Skeleton Loaders ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.12) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

.skeleton-text { height: 14px; margin-bottom: 8px; width: 80%; }
.skeleton-text.short { width: 50%; }
.skeleton-text.full { width: 100%; }
.skeleton-title { height: 22px; width: 60%; margin-bottom: 12px; }
.skeleton-card {
  height: 180px;
  border-radius: 16px;
  margin-bottom: 16px;
}
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-button { height: 40px; width: 120px; border-radius: 8px; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Form Validation Feedback ────────────────────────────────── */
.form-group { position: relative; margin-bottom: 16px; }

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: white;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary, #0ea5e9);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}

.form-input.is-valid {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}

.form-input.is-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.form-feedback {
  font-size: 12px;
  margin-top: 4px;
  padding-left: 4px;
  display: none;
  align-items: center;
  gap: 4px;
}

.form-feedback.show { display: flex; }
.form-feedback.valid { color: #10b981; }
.form-feedback.invalid { color: #ef4444; }

.form-feedback::before {
  content: '';
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.form-feedback.valid::before { content: '✓'; }
.form-feedback.invalid::before { content: '✗'; }

/* ─── PWA Install Prompt ──────────────────────────────────────── */
.pwa-install-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(14,165,233,0.95), rgba(6,95,70,0.95));
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 9999;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  animation: slideUp 0.4s ease-out;
  max-width: 420px;
  width: calc(100% - 40px);
}

.pwa-install-banner.hidden { display: none; }

.pwa-install-icon { font-size: 32px; }
.pwa-install-text { flex: 1; }
.pwa-install-title { font-weight: 700; font-size: 14px; color: white; }
.pwa-install-desc { font-size: 12px; color: rgba(255,255,255,0.8); margin-top: 2px; }

.pwa-install-btn {
  background: white;
  color: #0f172a;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.pwa-install-dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(100%); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 480px) {
  .toast-container { top: 10px; right: 10px; left: 10px; }
  .toast { min-width: auto; }
  .pwa-install-banner { flex-wrap: wrap; }
}

/* ─── Footer Legal Links ──────────────────────────────────────── */
.footer-legal {
  text-align: center;
  padding: 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 40px;
}

.footer-legal a {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 12px;
  margin: 0 12px;
  transition: color 0.2s;
}

.footer-legal a:hover { color: var(--primary, #0ea5e9); }
