/* ═══════════════════════════════════════════════════════════════
   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); }

/* ─── Trending Narratives & AI Radar Widget ───────────────────── */
.trending-narratives-card {
  position: relative;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.82) 0%, rgba(20, 29, 47, 0.78) 50%, rgba(11, 19, 36, 0.92) 100%);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 20px;
  padding: 24px 26px;
  margin-bottom: 24px;
  box-shadow: 0 14px 40px -10px rgba(0, 0, 0, 0.55), 0 0 20px -5px rgba(14, 165, 233, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.trending-narratives-card:hover {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 16px 45px -10px rgba(0, 0, 0, 0.65), 0 0 25px -4px rgba(14, 165, 233, 0.2);
}

.trending-narratives-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #0ea5e9 25%, #f59e0b 55%, #10b981 80%, transparent 100%);
  opacity: 0.9;
}

.tn-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tn-badge-pulse {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  background: rgba(14, 165, 233, 0.14);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.15);
  margin-bottom: 8px;
}

.tn-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: tnPulse 1.8s infinite;
}

@keyframes tnPulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.tn-title {
  font-size: 19px;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tn-title-highlight {
  background: linear-gradient(135deg, #f8fafc 40%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tn-fire-icon {
  font-size: 22px;
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.5));
}

.tn-subtitle {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
  max-width: 760px;
}

.tn-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tn-status-pill {
  font-size: 11.5px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono, monospace);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tn-nav-group {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}

.tn-nav-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tn-nav-btn:hover {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  transform: scale(1.08);
}

.tn-refresh-btn {
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tn-refresh-btn:hover {
  background: rgba(14, 165, 233, 0.25);
  border-color: #38bdf8;
  color: #fff;
  transform: rotate(180deg) scale(1.05);
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.5);
}

.tn-refresh-btn.spinning .tn-refresh-icon {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ─── Top Sectors Section ─── */
.tn-sectors-section {
  margin-bottom: 20px;
}

.tn-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #64748b;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tn-sectors {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tn-sector-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  user-select: none;
}

.tn-sector-badge:hover {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.18);
}

.tn-sector-name {
  font-weight: 700;
  color: #f1f5f9;
}

.tn-sector-leaders {
  font-size: 11px;
  color: #94a3b8;
  font-family: var(--font-mono, monospace);
}

.tn-trend-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.tn-trend-tag.trend-high {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

.tn-trend-tag.trend-active {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
}

.tn-trend-tag.trend-volatile {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
}

.tn-trend-tag.trend-breakout {
  background: rgba(139, 92, 246, 0.18);
  color: #d8b4fe;
  border: 1px solid rgba(139, 92, 246, 0.4);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
}

/* ─── Scroll Track & Coins ─── */
.tn-scroll-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.tn-scroll-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #f8fafc;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.tn-scroll-arrow:hover {
  background: var(--primary, #0ea5e9);
  border-color: #38bdf8;
  color: #fff;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 0 16px rgba(14, 165, 233, 0.6);
}

.tn-scroll-arrow.left { left: 4px; }
.tn-scroll-arrow.right { right: 4px; }

.tn-coins-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 6px 4px 14px 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: 100%;
}

.tn-coins-track::-webkit-scrollbar {
  display: none;
}

.tn-coin-card {
  min-width: 185px;
  max-width: 200px;
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.tn-coin-card:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(22, 33, 55, 0.9);
  box-shadow: 0 14px 28px -6px rgba(14, 165, 233, 0.3), 0 0 18px -4px rgba(14, 165, 233, 0.25);
}

.tn-coin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tn-coin-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tn-coin-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.tn-coin-symbol {
  font-weight: 800;
  font-size: 15px;
  color: #f8fafc;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.tn-rank-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  font-family: var(--font-mono, monospace);
}

.tn-rank-pill.rank-1 {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(217, 119, 6, 0.5));
  border: 1px solid rgba(245, 158, 11, 0.65);
  color: #fef08a;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}

.tn-rank-pill.rank-2 {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.3), rgba(100, 116, 139, 0.5));
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: #f1f5f9;
}

.tn-rank-pill.rank-3 {
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.3), rgba(120, 53, 15, 0.5));
  border: 1px solid rgba(180, 83, 9, 0.6);
  color: #fed7aa;
}

.tn-coin-name {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tn-coin-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  gap: 6px;
}

.tn-mcap-tag {
  font-size: 11px;
  color: #64748b;
  font-family: var(--font-mono, monospace);
  font-weight: 600;
}

.tn-scan-badge {
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  transition: all 0.2s ease;
}

.tn-coin-card:hover .tn-scan-badge {
  background: #0ea5e9;
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.4);
}

.tn-skeleton-card {
  min-width: 185px;
  height: 104px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  animation: pulse 1.5s infinite;
}

/* Light mode overrides */
[data-theme="light"] .trending-narratives-card {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(14, 165, 233, 0.2);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .tn-title {
  color: #0f172a;
}

[data-theme="light"] .tn-title-highlight {
  background: linear-gradient(135deg, #0f172a 40%, #0284c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .tn-subtitle {
  color: #64748b;
}

[data-theme="light"] .tn-status-pill {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: #475569;
}

[data-theme="light"] .tn-nav-group {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .tn-nav-btn {
  color: #475569;
}

[data-theme="light"] .tn-nav-btn:hover {
  background: rgba(14, 165, 233, 0.15);
  color: #0284c7;
}

[data-theme="light"] .tn-sector-badge {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
  color: #334155;
}

[data-theme="light"] .tn-sector-name {
  color: #0f172a;
}

[data-theme="light"] .tn-coin-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .tn-coin-card:hover {
  background: #ffffff;
  border-color: #0ea5e9;
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.15);
}

[data-theme="light"] .tn-coin-symbol {
  color: #0f172a;
}

[data-theme="light"] .tn-scroll-arrow {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .trending-narratives-card {
    padding: 18px 16px;
  }
  .tn-title {
    font-size: 17px;
  }
  .tn-subtitle {
    font-size: 12px;
  }
  .tn-coins-track {
    padding: 6px 36px 12px 36px;
  }
  .tn-scroll-arrow {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }
}

/* ─── Integrated Advanced Filters Toolbar ─── */
.pro-filters-bar {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 12px;
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pro-side-btn {
  transition: all 0.2s ease;
}

.pro-side-btn.active {
  background: var(--primary, #0ea5e9) !important;
  color: #fff !important;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.35);
}

