/**
 * IntegrationOS — Fintech Pro v2.0 Global Visual Theme
 * Include on every page: <link rel="stylesheet" href="/shared/fintech-pro.css">
 * This file applies the CryptoVault dark fintech treatment across all pages.
 */

/* ── Body: deep dark bg + dot grid + atmospheric orbs ── */
html:not(.light) body {
  background: #070B16 !important;
  background-image: radial-gradient(rgba(123, 250, 76, 0.035) 1px, transparent 1px) !important;
  background-size: 26px 26px !important;
}
html:not(.light) body::before {
  content: '';
  position: fixed; top: -200px; left: -150px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(60, 200, 40, 0.07) 0%, transparent 68%);
  pointer-events: none; z-index: 0;
  animation: fpOrb1 22s ease-in-out infinite;
}
html:not(.light) body::after {
  content: '';
  position: fixed; bottom: -150px; right: -100px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(20, 80, 15, 0.12) 0%, transparent 68%);
  pointer-events: none; z-index: 0;
  animation: fpOrb2 28s ease-in-out infinite;
}
@keyframes fpOrb1 {
  0%,100% { transform: translate(0,0) scale(1); }
  40%     { transform: translate(60px, 80px) scale(1.06); }
}
@keyframes fpOrb2 {
  0%,100% { transform: translate(0,0) scale(1); }
  50%     { transform: translate(-70px,-50px) scale(1.08); }
}
.shell, .sidebar, .main, .main-content, [class*="layout"], [class*="wrapper"] {
  position: relative; z-index: 1;
}

/* ── Neon topline ── */
.neon-topline {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 9999;
  background: linear-gradient(90deg,
    transparent 0%, #7BFA4C 20%, #A8FF6A 50%, #7BFA4C 80%, transparent 100%);
  background-size: 200% 100%;
  animation: fpNeonSweep 4s linear infinite;
  pointer-events: none;
}
@keyframes fpNeonSweep {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Sidebar glassmorphism ── */
html:not(.light) .sidebar {
  background: rgba(6, 9, 20, 0.93) !important;
  backdrop-filter: blur(28px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(160%) !important;
  border-right: 1px solid rgba(123, 250, 76, 0.1) !important;
  box-shadow: 4px 0 40px rgba(0,0,0,0.4) !important;
}

/* ── Topbar glassmorphism ── */
html:not(.light) .topbar,
html:not(.light) .tp {
  background: rgba(8, 12, 22, 0.82) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border-bottom: 1px solid rgba(123, 250, 76, 0.11) !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.28) !important;
}

/* ── Cards / panels glassmorphism ── */
html:not(.light) .card,
html:not(.light) .panel,
html:not(.light) .metric-card,
html:not(.light) .stat-card,
html:not(.light) [class*="-card"]:not(.qa-card),
html:not(.light) [class*="panel"]:not(.panel-header),
html:not(.light) .integrations-panel,
html:not(.light) .quick-actions .qa-card {
  background: rgba(13, 17, 32, 0.68) !important;
  backdrop-filter: blur(22px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(22px) saturate(180%) !important;
  border: 1px solid rgba(123, 250, 76, 0.11) !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.04) !important;
}
html:not(.light) .metric-card:hover,
html:not(.light) .stat-card:hover {
  border-color: rgba(123, 250, 76, 0.25) !important;
  box-shadow: 0 6px 32px rgba(0,0,0,0.4), 0 0 16px rgba(123, 250, 76, 0.12) !important;
}

/* ── Logo mark: lime gradient ── */
html:not(.light) .logo-icon {
  background: linear-gradient(135deg, #4DB82E 0%, #7BFA4C 60%, #A8FF6A 100%) !important;
  box-shadow: 0 0 20px rgba(123, 250, 76, 0.35) !important;
}

/* ── Nav active item: lime left accent ── */
html:not(.light) .nav-item.active {
  background: rgba(123, 250, 76, 0.07) !important;
  border-color: rgba(123, 250, 76, 0.18) !important;
}
html:not(.light) .nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 2px; border-radius: 2px;
  background: #7BFA4C;
  box-shadow: 0 0 8px rgba(123, 250, 76, 0.6);
}
html:not(.light) .nav-item { position: relative; }

/* ── Primary button: lime + shine ── */
html:not(.light) .btn-primary,
html:not(.light) button.btn-primary,
html:not(.light) a.btn-primary {
  background: linear-gradient(135deg, #7BFA4C 0%, #4DB82E 100%) !important;
  color: #080D18 !important;
  font-weight: 700 !important;
  border-color: transparent !important;
  box-shadow: 0 2px 16px rgba(123, 250, 76, 0.28) !important;
  position: relative; overflow: hidden;
}
html:not(.light) .btn-primary:hover {
  box-shadow: 0 4px 24px rgba(123, 250, 76, 0.4) !important;
  opacity: .93 !important;
  transform: translateY(-1px) !important;
}
html:not(.light) .btn-primary::after {
  content: '';
  position: absolute; top: 0; left: -75%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  transform: skewX(-20deg);
  animation: fpBtnShine 3.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes fpBtnShine {
  0%,70% { left: -75%; }
  100%   { left: 125%; }
}

/* ── Table row hover accent ── */
html:not(.light) tbody tr { position: relative; }
html:not(.light) tbody tr:hover td { background: rgba(123, 250, 76, 0.05) !important; }
html:not(.light) tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 rgba(123, 250, 76, 0.65);
}

/* ── Search input ── */
html:not(.light) .search-input,
html:not(.light) input[type="search"],
html:not(.light) input[type="text"].search-input {
  background: rgba(9, 13, 26, 0.75) !important;
  border-color: rgba(123, 250, 76, 0.18) !important;
}
html:not(.light) .search-input:focus {
  border-color: rgba(123, 250, 76, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(123, 250, 76, 0.11), 0 0 14px rgba(123, 250, 76, 0.15) !important;
}

/* ── Scrollbar ── */
html:not(.light) ::-webkit-scrollbar           { width: 5px; height: 5px; }
html:not(.light) ::-webkit-scrollbar-track     { background: transparent; }
html:not(.light) ::-webkit-scrollbar-thumb     { background: rgba(123,250,76,.22); border-radius: 99px; }
html:not(.light) ::-webkit-scrollbar-thumb:hover { background: rgba(123,250,76,.4); }

/* ── Focus rings ── */
html:not(.light) input:focus,
html:not(.light) select:focus,
html:not(.light) textarea:focus,
html:not(.light) button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(123, 250, 76, 0.3) !important;
}

/* ── Security trust bar (sidebar) ── */
.security-trust-bar {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 10px 14px 8px;
  border-top: 1px solid rgba(123,250,76,.07);
}
.trust-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 8px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; font-family: var(--font-mono);
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  color: var(--text-4); transition: color .2s, border-color .2s;
}
.trust-badge.tb-on {
  color: rgba(123,250,76,.65); border-color: rgba(123,250,76,.18);
  background: rgba(123,250,76,.05);
}

/* ── System status pill ── */
.system-status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  background: rgba(34,197,94,.07); border: 1px solid rgba(34,197,94,.2);
  font-size: 9px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--success); font-family: var(--font-mono);
  transition: all .3s; cursor: default; user-select: none;
}
.system-status-pill.degraded {
  background: rgba(245,158,11,.07); border-color: rgba(245,158,11,.2); color: var(--warning);
}
.system-status-pill.down {
  background: rgba(239,68,68,.07); border-color: rgba(239,68,68,.2); color: var(--danger);
}
.system-status-dot {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor;
  animation: fpSysDot 2.2s ease-in-out infinite;
}
@keyframes fpSysDot {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.35; transform:scale(.75); }
}

/* ── Skeleton shimmer ── */
html:not(.light) .skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,.04) 25%,
    rgba(123,250,76,.07) 50%,
    rgba(255,255,255,.04) 75%) !important;
  background-size: 200% 100% !important;
  animation: fpSkelShimmer 1.6s ease-in-out infinite !important;
  border-radius: 4px; display: inline-block;
}
@keyframes fpSkelShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Viewport lock: sidebar fixed, only .main scrolls ────────────────────────
 * Applied only on pages that contain a .shell (admin pages with sidebar).
 * Login/register/standalone pages are unaffected.
 * ──────────────────────────────────────────────────────────────────────────── */
html:has(.shell),
html:has(.shell) body {
  overflow: hidden !important;
  height: 100% !important;
}

/* Shell: exact viewport height, clip overflow */
html:has(.shell) .shell {
  height: 100vh !important;
  min-height: unset !important;
  overflow: hidden !important;
  display: flex !important;
}

/* Sidebar: full height, static (no sticky needed), never scrolls page */
html:has(.shell) .sidebar {
  height: 100vh !important;
  flex-shrink: 0 !important;
  position: relative !important;
  overflow: hidden !important; /* internal nav clips; footer stays via margin-top:auto */
}

/* Main: the ONE and ONLY scroll container */
html:has(.shell) .main {
  height: 100vh !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* Content/page wrappers inside .main: no duplicate scroll */
html:has(.shell) .content,
html:has(.shell) .page {
  overflow: visible !important;
}

/* Topbar: sticks within .main scroll context */
html:has(.shell) .topbar,
html:has(.shell) .tp {
  position: sticky !important;
  top: 0 !important;
  flex-shrink: 0 !important;
  z-index: 20 !important;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .neon-topline,
  .system-status-dot,
  html:not(.light) .btn-primary::after,
  html:not(.light) .skeleton,
  html:not(.light) body::before,
  html:not(.light) body::after { animation: none !important; }
}
