/* ============================================================
   AGI DeFi Platform — Base Global Styles
   ============================================================ */

/* ── Body ── */
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--c-text-primary);
  background-color: var(--c-bg-base);
  background-image: var(--gradient-bg);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ── Custom Scrollbar (Webkit) ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--c-bg-deep);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 107, 43, 0.40);
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 107, 43, 0.65);
}

/* ── Default Page Wrapper ── */
.page-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-px);
  padding-top: calc(var(--header-h) + var(--sp-6));
  padding-bottom: calc(var(--bottom-nav-h) + var(--sp-6) + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
}

@media (min-width: 1024px) {
  .page-wrapper {
    padding-bottom: var(--sp-12);
  }
}

/* ── Section Spacing ── */
.section {
  margin-bottom: var(--sp-8);
}

.section-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--c-text-primary);
  margin-bottom: var(--sp-4);
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: var(--text-sm);
  color: var(--c-text-secondary);
  margin-bottom: var(--sp-6);
}

/* ── Typography Utilities ── */
.text-primary    { color: var(--c-text-primary); }
.text-secondary  { color: var(--c-text-secondary); }
.text-muted      { color: var(--c-text-muted); }
.text-highlight  { color: var(--c-text-highlight); }
.text-orange     { color: var(--c-primary); }
.text-success    { color: var(--c-success); }
.text-danger     { color: var(--c-danger); }
.text-warning    { color: var(--c-warning); }

.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }

.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.font-black   { font-weight: 900; }
.font-mono    { font-family: var(--font-data); font-variant-numeric: tabular-nums; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Number Display (tabular) ── */
.num {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--c-text-highlight);
  letter-spacing: -0.02em;
}
.num-white {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--c-text-primary);
}

/* ── Layout Utilities ── */
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1  { gap: var(--sp-1); }
.gap-2  { gap: var(--sp-2); }
.gap-3  { gap: var(--sp-3); }
.gap-4  { gap: var(--sp-4); }
.gap-6  { gap: var(--sp-6); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--card-gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--card-gap); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--card-gap); }

.w-full  { width: 100%; }
.hidden  { display: none !important; }
.visible { display: block !important; }

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--c-border-subtle);
  margin: var(--sp-6) 0;
}

/* ── Address / Monospace Display ── */
.address-text {
  font-family: var(--font-data);
  font-size: var(--text-sm);
  color: var(--c-text-secondary);
  letter-spacing: 0.02em;
}

/* ── Page Section Header ── */
.page-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.page-section-header .title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--c-text-primary);
}

.page-section-header .action {
  font-size: var(--text-sm);
  color: var(--c-primary);
  font-weight: 500;
  cursor: pointer;
}

/* ── Orange Accent Line ── */
.accent-line {
  width: 40px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: var(--r-full);
  margin-bottom: var(--sp-4);
}

/* ── Overlay ── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--c-bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: calc(var(--z-bottom-sheet) - 10); /* 140: below bottom-sheet(150) & modal(200) */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ── Safe Area Handling ── */
.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
