/* =====================================================
   🏦 PRO TOPBAR — Professional FinTech Header
   Bloomberg-grade dark interface
   Uses CSS variables from user-dashboard.css / variables.css
   so admin theme-loader can override colors dynamically
   ===================================================== */

/* ── Base ─────────────────────────────────── */
.pro-topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 56px;
  background: var(--bg-dark, #18181b);
  border-bottom: 1px solid var(--border-color, #3f3f46);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  user-select: none;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 16px;
  max-width: 1920px;
  margin: 0 auto;
}

/* ── Left: Menu + Brand ──────────────────── */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--primary-orange-dim, rgba(249,115,22,0.1));
  color: var(--primary-orange, #f97316);
  cursor: pointer;
  transition: all 0.2s ease;
}

.topbar-menu-btn:hover {
  background: var(--primary-orange, #f97316);
  color: #fff;
  box-shadow: 0 0 12px var(--primary-orange-glow, rgba(249,115,22,0.4));
}

.topbar-menu-btn:active {
  transform: scale(0.94);
}

.topbar-menu-btn svg {
  width: 18px;
  height: 18px;
}

/* Brand */
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.topbar-logo-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 8px;
  box-shadow: none;
  flex-shrink: 0;
}

.topbar-logo-icon svg {
  width: 16px;
  height: 16px;
  color: white;
}

.topbar-logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.topbar-brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #e5e7eb);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ── Center: Inline search (desktop) ─────── */
.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 480px;
  margin: 0 24px;
}

.topbar-search-bar {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 36px;
  background: var(--bg-card, #27272a);
  border: 1px solid var(--border-color, #3f3f46);
  border-radius: 8px;
  padding: 0 12px;
  gap: 8px;
  transition: all 0.2s ease;
}

.topbar-search-bar:focus-within {
  border-color: var(--primary-orange, #f97316);
  box-shadow: 0 0 0 3px var(--primary-orange-dim, rgba(249,115,22,0.1));
}

.topbar-search-bar .search-icon {
  width: 15px;
  height: 15px;
  color: var(--text-muted, #71717a);
  flex-shrink: 0;
}

.topbar-search-bar input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary, #e5e7eb);
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
}

.topbar-search-bar input::placeholder {
  color: var(--text-muted, #71717a);
}

.topbar-search-shortcut {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  background: var(--bg-elevated, #3f3f46);
  border: 1px solid var(--border-color, #3f3f46);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted, #71717a);
  white-space: nowrap;
  line-height: 1;
}

/* ── Right: Actions ──────────────────────── */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* Generic action button */
.topbar-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary, #a1a1aa);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
}

.topbar-action-btn:hover {
  background: var(--primary-orange-dim, rgba(249,115,22,0.1));
  color: var(--primary-orange, #f97316);
}

.topbar-action-btn:active {
  transform: scale(0.94);
}

.topbar-action-btn svg {
  width: 20px;
  height: 20px;
}

/* Divider */
.topbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color, #3f3f46);
  margin: 0 6px;
  flex-shrink: 0;
}

/* ── Notification Badge ──────────────────── */
.topbar-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  background: var(--danger-red, #ef4444);
  border-radius: 50%;
  border: 2px solid var(--bg-dark, #18181b);
  pointer-events: none;
  display: block;
}

.topbar-badge[hidden] {
  display: none;
}

.topbar-badge.has-count {
  top: 3px;
  right: 3px;
  min-width: 16px;
  width: auto;
  height: 16px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  border-radius: 8px;
  letter-spacing: 0;
}

/* ── Profile Trigger ─────────────────────── */
.topbar-profile-trigger {
  width: auto !important;
  padding: 4px !important;
  gap: 8px;
  margin-left: 2px;
  border-radius: 8px !important;
}

.topbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-orange, #f97316) 0%, var(--primary-orange-light, #fb923c) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.topbar-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.topbar-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, #e5e7eb);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted, #71717a);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.topbar-profile-trigger:hover .topbar-chevron {
  color: var(--text-primary, #e5e7eb);
}

.topbar-profile-trigger.active .topbar-chevron {
  transform: rotate(180deg);
}

/* ── Search Overlay (slide-down) ─────────── */
.topbar-search-overlay {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-dark, #18181b);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color, #3f3f46);
  transform: translateY(-100%);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
}

.topbar-search-overlay.active {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  z-index: 10;
}

.topbar-search-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
  height: 40px;
  background: var(--bg-card, #27272a);
  border: 1px solid var(--border-color, #3f3f46);
  border-radius: 10px;
  padding: 0 14px;
  transition: border-color 0.2s ease;
}

.topbar-search-inner:focus-within {
  border-color: var(--primary-orange, #f97316);
  box-shadow: 0 0 0 3px var(--primary-orange-dim, rgba(249,115,22,0.1));
}

.topbar-search-inner .topbar-search-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted, #71717a);
  flex-shrink: 0;
}

.topbar-search-inner input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary, #e5e7eb);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
}

.topbar-search-inner input::placeholder {
  color: var(--text-muted, #71717a);
}

.topbar-search-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: var(--bg-elevated, #3f3f46);
  color: var(--text-secondary, #a1a1aa);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.topbar-search-close:hover {
  background: var(--primary-orange-dim, rgba(249,115,22,0.1));
  color: var(--primary-orange, #f97316);
}

.topbar-search-close svg {
  width: 14px;
  height: 14px;
}

/* Search Results */
.topbar-search-results {
  max-width: 640px;
  margin: 8px auto 0;
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-card, #27272a);
  border: 1px solid var(--border-color, #3f3f46);
  border-radius: 10px;
}

.topbar-search-results.hidden {
  display: none;
}

/* Search prediction items */
.search-predict-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-color, #3f3f46);
  text-decoration: none;
}

.search-predict-item:last-child {
  border-bottom: none;
}

.search-predict-item:hover,
.search-predict-item.active {
  background: var(--primary-orange-dim, rgba(249,115,22,0.1));
}

.search-predict-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  background: var(--bg-elevated, #3f3f46);
  color: var(--primary-orange, #f97316);
}

.search-predict-info {
  flex: 1;
  min-width: 0;
}

.search-predict-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #e5e7eb);
  line-height: 1.3;
}

.search-predict-name mark {
  background: transparent;
  color: var(--primary-orange, #f97316);
  font-weight: 700;
}

.search-predict-desc {
  font-size: 11px;
  color: var(--text-muted, #71717a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-predict-price {
  text-align: right;
  flex-shrink: 0;
}

.search-predict-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #e5e7eb);
}

.search-predict-change {
  font-size: 11px;
  font-weight: 500;
}

.search-predict-change.up { color: var(--success-green, #22c55e); }
.search-predict-change.down { color: var(--danger-red, #ef4444); }

.search-predict-empty {
  padding: 20px 14px;
  text-align: center;
  color: var(--text-muted, #71717a);
  font-size: 13px;
}

.search-predict-heading {
  padding: 8px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #71717a);
}

/* ── Topbar Dropdown (notifications / profile) ── */
.topbar-dropdown-anchor {
  position: relative;
}

.topbar-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 300px;
  background: #1a1f2e;
  border: 1px solid var(--border-color, #3f3f46);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 300;
  overflow: hidden;
}

.topbar-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Dropdown header */
.topbar-dd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color, #3f3f46);
}

.topbar-dd-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #e5e7eb);
}

.topbar-dd-header .dd-action {
  font-size: 12px;
  font-weight: 500;
  color: var(--primary-orange, #f97316);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}

.topbar-dd-header .dd-action:hover {
  color: var(--primary-orange-light, #fb923c);
}

/* Notification items */
.topbar-notif-list {
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color, #3f3f46) transparent;
}

.topbar-notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-color, #3f3f46);
}

.topbar-notif-item:last-child {
  border-bottom: none;
}

.topbar-notif-item:hover {
  background: var(--primary-orange-dim, rgba(249,115,22,0.08));
}

.topbar-notif-item.unread {
  background: var(--primary-orange-dim, rgba(249,115,22,0.04));
}

.topbar-notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.topbar-notif-icon.success { background: rgba(var(--success-rgb, 34, 197, 94), 0.12); color: var(--success-green, #22c55e); }
.topbar-notif-icon.warning { background: rgba(var(--warning-rgb, 245, 158, 11), 0.12); color: var(--color-warning, #f59e0b); }
.topbar-notif-icon.info    { background: rgba(var(--info-rgb, 59, 130, 246), 0.12); color: var(--color-info, #3b82f6); }
.topbar-notif-icon.danger  { background: rgba(var(--danger-rgb, 239, 68, 68), 0.12);  color: var(--danger-red, #ef4444); }

.topbar-notif-body {
  flex: 1;
  min-width: 0;
}

.topbar-notif-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, #e5e7eb);
  margin-bottom: 2px;
  line-height: 1.4;
}

.topbar-notif-time {
  font-size: 11px;
  color: var(--text-muted, #71717a);
}

.topbar-notif-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted, #71717a);
  font-size: 13px;
}

.topbar-notif-empty svg {
  width: 36px;
  height: 36px;
  margin-bottom: 8px;
  opacity: 0.4;
}

/* Profile dropdown */
.topbar-profile-dropdown {
  min-width: 240px;
}

.topbar-dd-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border-color, #3f3f46);
}

.topbar-dd-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-orange, #f97316) 0%, var(--primary-orange-light, #fb923c) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.topbar-dd-profile-info h4 {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #e5e7eb);
}

.topbar-dd-profile-info p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted, #71717a);
}

/* Dropdown menu items */
.topbar-dd-menu {
  padding: 6px 0;
}

.topbar-dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary, #a1a1aa);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.topbar-dd-item:hover {
  background: var(--primary-orange-dim, rgba(249,115,22,0.08));
  color: var(--text-primary, #e5e7eb);
}

.topbar-dd-item svg {
  width: 16px;
  height: 16px;
  opacity: 0.5;
  flex-shrink: 0;
}

.topbar-dd-item:hover svg {
  opacity: 0.8;
}

.topbar-dd-separator {
  height: 1px;
  background: var(--border-color, #3f3f46);
  margin: 4px 0;
}

.topbar-dd-item.danger {
  color: var(--danger-red, #ef4444);
}

.topbar-dd-item.danger svg {
  color: var(--danger-red, #ef4444);
}

.topbar-dd-item.danger:hover {
  background: rgba(var(--danger-rgb, 239, 68, 68), 0.08);
  color: #fca5a5;
}

/* ── Market ticker strip (optional) ──────── */
.topbar-ticker {
  height: 28px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color, #3f3f46);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 24px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted, #71717a);
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.ticker-symbol {
  color: var(--text-secondary, #a1a1aa);
  font-weight: 600;
}

.ticker-up   { color: var(--success-green, #22c55e); }
.ticker-down { color: var(--danger-red, #ef4444); }

/* =====================================================
   📱 RESPONSIVE — Mobile First
   ===================================================== */

/* ── Mobile (≤ 767px) ────────────────────── */
@media (max-width: 767px) {
  .pro-topbar {
    height: 52px;
  }

  .topbar-inner {
    padding: 0 12px;
  }

  .topbar-center {
    display: none;
  }

  .topbar-brand-name {
    font-size: 15px;
  }

  .topbar-user-name,
  .topbar-chevron {
    display: none;
  }

  .topbar-divider {
    margin: 0 2px;
  }

  .topbar-search-overlay {
    padding: 10px 12px;
  }

  .topbar-dropdown {
    position: fixed !important;
    top: 56px !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    min-width: 0 !important;
    max-height: 70vh;
    border-radius: 14px;
  }
}

/* ── Small mobile (≤ 374px) ──────────────── */
@media (max-width: 374px) {
  .topbar-left {
    gap: 8px;
  }

  .topbar-menu-btn {
    width: 32px;
    height: 32px;
  }

  .topbar-logo-icon {
    width: 28px;
    height: 28px;
  }

  .topbar-logo-icon svg {
    width: 14px;
    height: 14px;
  }

  .topbar-brand-name {
    font-size: 14px;
  }

  .topbar-action-btn {
    width: 32px;
    height: 32px;
  }

  .topbar-avatar {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }
}

/* ── Tablet & Desktop (≥ 768px) ──────────── */
@media (min-width: 768px) {
  .topbar-inner {
    padding: 0 20px;
  }
}

/* ── Desktop (≥ 1024px) ──────────────────── */
@media (min-width: 1024px) {
  .topbar-inner {
    padding: 0 24px;
  }
}

/* ── Ultra-wide (≥ 1400px) ───────────────── */
@media (min-width: 1400px) {
  .topbar-inner {
    padding: 0 32px;
  }
}

/* ── Accessibility ───────────────────────── */
.topbar-menu-btn:focus-visible,
.topbar-action-btn:focus-visible,
.topbar-profile-trigger:focus-visible {
  outline: 2px solid var(--primary-orange, #f97316);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .pro-topbar *,
  .pro-topbar *::before,
  .pro-topbar *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ── Print ───────────────────────────────── */
@media print {
  .pro-topbar {
    display: none;
  }
}

/* =====================================================
   INSTANT PAGE RENDERING
   Eliminates skeleton/loading states for seamless
   page transitions — content renders immediately
   ===================================================== */

/* 1. Kill ALL skeleton shimmer/pulse animations */
.skeleton,
.dp-skeleton,
.skeleton-card,
.skeleton-grid,
.skeleton-row,
.skeleton-cell,
.skeleton-header,
.skeleton-content,
.skeleton-tabs,
.skeleton-tab,
.skeleton-logo,
.skeleton-info,
.skeleton-code,
.skeleton-name,
.skeleton-sector,
.skeleton-price-info,
.skeleton-price,
.skeleton-change,
.skeleton-line,
.skeleton-avatar,
.skeleton-account,
.skeleton-item,
.skeleton-text,
.pf-skeleton-row,
.oms-skeleton-row,
.ml-idx-skeleton,
.tab-skeleton,
.pf-chart-skeleton-circle,
.pf-chart-skeleton-line,
[class*="skeleton-line"] {
  animation: none !important;
  background-image: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* 2. Hide page-level loading spinners & loading text containers */
.screener-loading,
.soc-loading,
.ref-loading,
.sup-loading,
.inc-loading,
.tax-loading,
.div-loading,
.ml-loading,
.legal-loading,
.notif-loader,
.pf-chart-loading,
.chart-loading,
#chartLoading,
.wl-loading-spinner,
.wl-loading,
.loading-container,
.contact-loader,
.alerts-loading,
.accounts-loading,
#accountsLoading {
  display: none !important;
}

/* 3. Dashboard fade-in: visible instantly (no scroll-reveal delay) */
.dash-fade-in {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

/* 4. Fund/stock detail fade-in: instant */
.fund-section {
  animation: none !important;
  opacity: 1 !important;
}

/* 5. Hide loading-state containers across all pages */
#loadingState,
.profile-loading,
#profileLoading,
.transactions-loading,
#holdingsLoading,
.pf-holdings-loading,
.loading-state:not(.kyc-loading-overlay .loading-state) {
  display: none !important;
}

/* 6. Show main content containers immediately (override display:none / .hidden) */
#aboutContent,
#legalContent {
  display: block !important;
}

#profileContent.hidden,
.profile-content.hidden {
  display: block !important;
  visibility: visible !important;
}
