/* ════════════════════════════════════════════════════════════════════
   0G INTEGRATION UI — OnyxCapital x 0G Chain / 0G Storage
   Kept in its own file, separate from index.html's core <style> block.

   Design system: builds on the host app's existing dark/gold exchange
   look (Binance-style palette already in use) and adds one accent of
   its own — a cool indigo — so "0G" reads as its own network layer
   inside OnyxCapital rather than another gold chip competing for attention.
   Gold stays reserved for primary actions, matching the host app's
   own button hierarchy.
   ════════════════════════════════════════════════════════════════════ */

:root{
  --zg-accent:#7C8CFF;
  --zg-accent-dim:rgba(124,140,255,.35);
  --zg-accent-bg:rgba(124,140,255,.10);
}

/* ── Floating mascot badge ──────────────────────────────────────────
   Stacked above the existing Zeal AI button so it never collides with
   bottom-anchored content like the Balances table. */
#zerogFab{
  position:fixed;bottom:92px;right:22px;z-index:300;
  width:56px;height:56px;cursor:pointer;user-select:none;
  animation:zerogFloat 3.2s ease-in-out infinite;
}
#zerogFab:hover{animation-play-state:paused;transform:scale(1.08);}
@keyframes zerogFloat{0%,100%{transform:translateY(0);}50%{transform:translateY(-6px);}}

#zerogFab .zerogOrbit{
  position:absolute;inset:-6px;border-radius:50%;
  border:1.5px dashed var(--zg-accent-dim);
  animation:zerogSpin 7s linear infinite;
  pointer-events:none;
}
@keyframes zerogSpin{to{transform:rotate(360deg);}}

#zerogFab .zerogBody{
  position:absolute;inset:0;border-radius:50%;
  background:radial-gradient(circle at 32% 28%, #2b2f3a 0%, #14171C 75%);
  border:1px solid var(--zg-accent-dim);
  box-shadow:0 6px 18px rgba(124,140,255,.22), inset 0 0 12px rgba(124,140,255,.10);
  display:flex;align-items:center;justify-content:center;
  transition:box-shadow .2s;
}

#zerogFab .zerogFace{position:relative;width:26px;height:20px;}
#zerogFab .zerogEye{
  position:absolute;top:0;width:5px;height:7px;border-radius:50%;
  background:var(--zg-accent);animation:zerogBlink 4.5s ease-in-out infinite;
}
#zerogFab .zerogEye.l{left:2px;}
#zerogFab .zerogEye.r{right:2px;}
@keyframes zerogBlink{0%,92%,100%{transform:scaleY(1);}95%{transform:scaleY(.15);}}
#zerogFab .zerogMouth{
  position:absolute;bottom:0;left:50%;transform:translateX(-50%);
  width:12px;height:6px;border-bottom:2px solid var(--zg-accent);
  border-radius:0 0 10px 10px;
}

#zerogFab .zerogStatusDot{
  position:absolute;top:-1px;right:-1px;width:12px;height:12px;border-radius:50%;
  background:#646E7D;border:2px solid var(--bg,#0E1014);z-index:2;
  transition:background .2s, box-shadow .2s;
}
#zerogFab.connected .zerogStatusDot{background:#02C076;box-shadow:0 0 6px rgba(2,192,118,.8);}
#zerogFab.pending .zerogStatusDot{background:#F0B90B;box-shadow:0 0 6px rgba(240,185,11,.8);animation:zerogPulse 1s infinite;}
@keyframes zerogPulse{0%,100%{opacity:1;}50%{opacity:.35;}}

/* ── Toast-style popup ───────────────────────────────────────────── */
#zerogPopup{
  position:fixed;bottom:158px;right:22px;z-index:301;
  max-width:280px;background:#1A1E28;border:1px solid var(--zg-accent-dim);
  border-radius:10px;padding:12px 14px;box-shadow:0 10px 30px rgba(0,0,0,.5);
  opacity:0;transform:translateY(10px);pointer-events:none;transition:.25s;
}
#zerogPopup.show{opacity:1;transform:translateY(0);}
#zerogPopup .zerogPopupTitle{font-size:11.5px;font-weight:700;color:var(--text);display:flex;align-items:center;gap:6px;margin-bottom:4px;}
#zerogPopup .zerogPopupBody{font-size:10.5px;color:var(--dim);line-height:1.45;}
#zerogPopup a{color:var(--zg-accent);text-decoration:none;}
#zerogPopup a:hover{text-decoration:underline;}

/* ── Modal shell ─────────────────────────────────────────────────── */
#zerogModalOverlay{
  position:fixed;inset:0;z-index:400;background:rgba(6,7,9,.75);backdrop-filter:blur(3px);
  display:none;align-items:center;justify-content:center;padding:20px;
}
#zerogModalOverlay.show{display:flex;}
#zerogModal{
  width:400px;max-width:100%;max-height:88vh;overflow:auto;
  background:#14171C;border:1px solid var(--border);border-radius:16px;
  box-shadow:0 28px 70px rgba(0,0,0,.6);
}
#zerogModal::-webkit-scrollbar{width:6px;}
#zerogModal::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px;}

#zerogModal .zerogModalHead{
  display:flex;align-items:center;justify-content:space-between;
  padding:16px 16px 10px 18px;
}
.zerogHeadTitle{display:flex;align-items:center;gap:9px;}
.zerogHeadLogo{
  width:26px;height:26px;border-radius:50%;flex-shrink:0;
  background:radial-gradient(circle at 32% 28%,#2b2f3a 0%,#14171C 75%);
  border:1px solid var(--zg-accent-dim);display:flex;align-items:center;justify-content:center;
}
.zerogHeadLogo svg{width:13px;height:13px;color:var(--zg-accent);}
#zerogModal .zerogModalHead h3{font-size:13.5px;color:var(--text);font-weight:700;letter-spacing:.2px;}
.zerogHeadSub{font-size:9.5px;color:var(--dim);margin-top:1px;}

#zerogModal .zerogClose{
  cursor:pointer;color:var(--dim);padding:6px;border-radius:8px;
  display:flex;align-items:center;justify-content:center;transition:.15s;
}
#zerogModal .zerogClose:hover{color:var(--text);background:var(--bg3);}
#zerogModal .zerogClose svg{width:15px;height:15px;}

/* Wallet status bar under the header */
.zerogWalletBar{
  margin:0 18px 14px;padding:9px 12px;border-radius:10px;
  background:var(--bg3);border:1px solid var(--border);
  display:flex;align-items:center;justify-content:space-between;gap:10px;
}
.zerogWalletBar .zerogWalletInfo{display:flex;align-items:center;gap:8px;min-width:0;}
.zerogWalletBar .zerogWalletDot{width:7px;height:7px;border-radius:50%;background:#646E7D;flex-shrink:0;}
.zerogWalletBar.connected .zerogWalletDot{background:#02C076;box-shadow:0 0 5px rgba(2,192,118,.7);}
.zerogWalletBar .zerogAddr{font-family:'SF Mono',Consolas,monospace;font-size:11px;color:var(--text);}
.zerogWalletBar .zerogWalletMuted{font-size:11px;color:var(--dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}

/* Icon-based segmented tabs */
.zerogTabs{
  display:flex;gap:3px;padding:0 14px 14px;
}
.zerogTab{
  flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;
  padding:8px 4px 9px;border-radius:9px;border:none;background:transparent;
  color:var(--dim);font-size:10px;font-weight:700;letter-spacing:.15px;cursor:pointer;
  transition:.15s;
}
.zerogTab svg{width:16px;height:16px;}
.zerogTab:hover{color:var(--text);background:var(--bg3);}
.zerogTab.active{color:var(--zg-accent);background:var(--zg-accent-bg);}

#zerogModal .zerogModalBody{padding:2px 18px 18px;display:flex;flex-direction:column;gap:12px;}

/* ── Hero balance card ──────────────────────────────────────────── */
.zerogHero{
  position:relative;overflow:hidden;
  background:linear-gradient(160deg,#1B2030 0%,#14171C 65%);
  border:1px solid var(--zg-accent-dim);border-radius:12px;
  padding:16px 16px 14px;
}
.zerogHero::before{
  content:'';position:absolute;top:-40%;right:-20%;width:180px;height:180px;border-radius:50%;
  border:1px solid rgba(124,140,255,.15);pointer-events:none;
}
.zerogHero::after{
  content:'';position:absolute;top:-55%;right:-8%;width:220px;height:220px;border-radius:50%;
  border:1px solid rgba(124,140,255,.09);pointer-events:none;
}
.zerogHeroLabel{font-size:9.5px;color:var(--dim);text-transform:uppercase;letter-spacing:.6px;margin-bottom:6px;position:relative;}
.zerogHeroRow{display:flex;align-items:flex-end;justify-content:space-between;gap:10px;position:relative;}
.zerogHeroValue{font-size:26px;font-weight:800;color:var(--text);letter-spacing:-.3px;line-height:1;}
.zerogHeroUnit{font-size:13px;font-weight:700;color:var(--zg-accent);margin-left:5px;}
.zerogHeroSub{font-size:10px;color:var(--dim);margin-top:7px;position:relative;line-height:1.4;}

.zerogIconBtn{
  width:30px;height:30px;border-radius:9px;border:1px solid var(--border);background:var(--bg3);
  color:var(--dim);cursor:pointer;display:flex;align-items:center;justify-content:center;
  transition:.15s;flex-shrink:0;
}
.zerogIconBtn:hover{color:var(--text);border-color:var(--zg-accent-dim);}
.zerogIconBtn svg{width:14px;height:14px;}
.zerogIconBtn.spinning svg{animation:zerogSpin .8s linear infinite;}

/* ── Numbered step cards ────────────────────────────────────────── */
.zerogStep{
  background:var(--bg3);border:1px solid var(--border);border-radius:12px;
  padding:13px 14px;display:flex;gap:11px;align-items:flex-start;
}
.zerogStepNum{
  width:22px;height:22px;border-radius:50%;background:var(--zg-accent-bg);color:var(--zg-accent);
  font-size:11px;font-weight:800;flex-shrink:0;display:flex;align-items:center;justify-content:center;
  border:1px solid var(--zg-accent-dim);
}
.zerogStepBody{flex:1;min-width:0;}
.zerogStepBody h4{font-size:11.5px;color:var(--text);font-weight:700;margin-bottom:4px;letter-spacing:.1px;}
.zerogStepBody p{font-size:10.5px;color:var(--dim);line-height:1.5;margin-bottom:10px;}

/* ── Buttons ─────────────────────────────────────────────────────
   Primary mirrors the host app's own high-contrast gold CTA style
   (dark text on solid gold) so 0G actions feel native to OnyxCapital,
   not bolted on. */
.zerogBtn{
  display:inline-flex;align-items:center;gap:6px;
  padding:8px 14px;border-radius:8px;border:none;cursor:pointer;
  font-size:11.5px;font-weight:800;letter-spacing:.1px;transition:.15s;white-space:nowrap;
  text-decoration:none;
}
.zerogBtn.primary{background:var(--gold);color:#14171C;}
.zerogBtn.primary:hover{background:#ffc72e;transform:translateY(-1px);}
.zerogBtn.secondary{background:var(--zg-accent-bg);color:var(--zg-accent);border:1px solid var(--zg-accent-dim);}
.zerogBtn.secondary:hover{background:rgba(124,140,255,.18);}
.zerogBtn.ghost{background:transparent;color:var(--dim);border:1px solid var(--border);}
.zerogBtn.ghost:hover{border-color:var(--zg-accent-dim);color:var(--text);}
.zerogBtn:disabled{opacity:.4;cursor:not-allowed;transform:none !important;}
.zerogBtn svg{width:12px;height:12px;}

.zerogBadge{display:inline-flex;align-items:center;gap:4px;font-size:9.5px;padding:3px 9px;border-radius:999px;font-weight:700;letter-spacing:.2px;}
.zerogBadge.ok{background:rgba(2,192,118,.14);color:#02C076;}
.zerogBadge.pending{background:rgba(240,185,11,.14);color:#F0B90B;}
.zerogBadge.fail{background:rgba(246,70,93,.14);color:#F6465D;}

/* ── Info notice ─────────────────────────────────────────────────── */
.zerogNotice{
  display:flex;gap:9px;align-items:flex-start;
  font-size:10.5px;color:var(--dim);line-height:1.5;
  background:var(--zg-accent-bg);border:1px solid var(--zg-accent-dim);border-radius:10px;padding:11px 12px;
}
.zerogNotice svg{width:14px;height:14px;color:var(--zg-accent);flex-shrink:0;margin-top:1px;}
.zerogNotice.warn{background:rgba(240,185,11,.08);border-color:var(--gold-dim);}
.zerogNotice.warn svg{color:var(--gold);}
.zerogNotice code{background:rgba(255,255,255,.06);padding:1px 5px;border-radius:4px;font-size:9.5px;}

/* ── Generic section card (Chain Log / Storage tabs) ────────────── */
.zerogSection{background:var(--bg3);border:1px solid var(--border);border-radius:12px;padding:14px 15px;}
.zerogSection h4{font-size:10px;color:var(--dim);text-transform:uppercase;letter-spacing:.5px;margin-bottom:8px;}
.zerogSection p{font-size:11px;color:var(--dim);line-height:1.5;margin-bottom:10px;}
.zerogRow{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:12px;flex-wrap:wrap;}
.zerogRow + .zerogRow{margin-top:8px;}
.zerogAddr{font-family:'SF Mono',Consolas,monospace;font-size:11px;color:var(--text);}

/* ── Activity log ────────────────────────────────────────────────── */
#zerogLog{display:flex;flex-direction:column;gap:7px;max-height:190px;overflow:auto;}
#zerogLog .zerogLogRow{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  font-size:10.5px;padding:8px 10px;background:var(--bg);border-radius:8px;border:1px solid var(--border);
}
#zerogLog .zerogLogRow .zerogLogLeft{display:flex;align-items:center;gap:7px;color:var(--text);min-width:0;}
#zerogLog .zerogLogRow .zerogLogLeft svg{width:13px;height:13px;color:var(--zg-accent);flex-shrink:0;}
#zerogLog .zerogLogRow a{color:var(--zg-accent);text-decoration:none;font-family:'SF Mono',Consolas,monospace;}
#zerogLog .zerogLogRow a:hover{text-decoration:underline;}
#zerogLog .zerogEmpty{color:var(--dim);font-size:11px;text-align:center;padding:18px 0;}

/* ── Inline per-trade badge injected into the Journal tab ─────────── */
.zerogInlineBadge{
  display:inline-flex;align-items:center;gap:4px;font-size:9.5px;margin-top:4px;color:var(--dim);
}
.zerogInlineBadge svg{width:11px;height:11px;flex-shrink:0;}
.zerogInlineBadge a{color:var(--zg-accent);text-decoration:none;}
.zerogInlineBadge a:hover{text-decoration:underline;}

/* ── Full-page Spot Trade overlay ──────────────────────────────────
   Matches the host app's own full-screen overlay pattern (Price
   Ticker / Calculator) rather than living inside the small mascot
   popup — this feature needs real room. */
#zerogSpotOverlay{
  position:fixed;inset:0;z-index:9990;background:#04040a;display:none;flex-direction:column;
}
#zerogSpotOverlay.show{display:flex;}
#zerogSpotTopBar{
  display:flex;align-items:center;gap:16px;padding:14px 20px;border-bottom:1px solid var(--border);flex:0 0 auto;
}
.zerogSpotTitle{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:700;color:var(--text);}
.zerogSpotTitle svg{width:16px;height:16px;color:var(--zg-accent);}

#zerogNetSwitch{display:flex;gap:4px;background:var(--bg3);border-radius:999px;padding:3px;margin-left:auto;}
.zerogNetBtn{
  padding:6px 16px;border-radius:999px;border:none;background:transparent;color:var(--dim);
  font-size:11.5px;font-weight:700;cursor:pointer;transition:.15s;
}
.zerogNetBtn:hover{color:var(--text);}
.zerogNetBtn.active{background:var(--zg-accent);color:#0E1014;}

#zerogSpotCloseBtn{
  display:flex;align-items:center;gap:6px;background:var(--bg3);border:1px solid var(--border);
  color:var(--text);border-radius:8px;padding:8px 14px;cursor:pointer;font-size:12px;font-weight:700;transition:.15s;
}
#zerogSpotCloseBtn:hover{border-color:var(--zg-accent-dim);}
#zerogSpotCloseBtn svg{width:13px;height:13px;}

#zerogSpotBody{
  flex:1;overflow-y:auto;padding:24px;display:flex;flex-direction:column;gap:16px;
  max-width:560px;width:100%;margin:0 auto;
}
.zerogSpotCard{
  background:var(--bg2);border:1px solid var(--border);border-radius:14px;padding:18px 20px;
}
.zerogSpotCard svg{width:28px;height:28px;color:var(--zg-accent);margin:0 auto;display:block;}

.zerogSpotInput{
  background:var(--bg);border:1px solid var(--border);border-radius:8px;padding:9px 11px;
  color:var(--text);font-size:12.5px;width:100%;
}
.zerogSpotInput:focus{outline:none;border-color:var(--zg-accent-dim);}
.zerogSpotMono{font-family:'SF Mono',Consolas,monospace;}

/* ── Phone breakpoint ────────────────────────────────────────────── */
@media (max-width:640px){
  #zerogFab{bottom:80px;right:14px;width:48px;height:48px;}
  #zerogPopup{right:14px;left:14px;max-width:none;bottom:136px;}
  #zerogModalOverlay{padding:0;align-items:flex-end;}
  #zerogModal{width:100%;max-height:85vh;border-radius:16px 16px 0 0;}
  .zerogTab span{font-size:9px;}
  .zerogHeroValue{font-size:22px;}
  #zerogSpotTopBar{flex-wrap:wrap;padding:12px 14px;}
  #zerogNetSwitch{order:3;margin-left:0;width:100%;justify-content:center;}
  #zerogSpotBody{padding:16px;}
}
