/* ── Base ──────────────────────────────────────────────────────── */
body {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  background-color: var(--bg-primary);
  background-image: radial-gradient(
    circle at 2.5px 2.5px,
    var(--dot-color) 2.5px,
    transparent 0
  );
  background-size: 28px 28px;
  background-position: 0 0;
  color: var(--text-primary);
  transition: background-color var(--transition-slow), color var(--transition-slow);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar — từ template: border-radius 10px ──────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { opacity: 0.8; }

/* ── Header — height 58px như template ────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 var(--space-6);
  white-space: nowrap;
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-slow), border-color var(--transition-slow);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.brand-logo-svg {
  height: 24px;
  width: auto;
  display: block;
}



.brand-logo {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff;
}
.brand-sub {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
  padding-left: var(--space-5);
  flex-shrink: 0;
}


/* ── Main layout ───────────────────────────────────────────────── */
.page-main {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}

/* ── Centered state — search ở giữa màn hình khi chưa có wallet ── */
.page-main.centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 58px);
  padding-top: 0;
  padding-bottom: 0;
}
.page-main.centered .search-section {
  margin-bottom: 0;
  width: 100%;
}

/* ── Search section ────────────────────────────────────────────── */
.search-section {
  max-width: 1080px;
  margin: 0 auto var(--space-8);
  transition: margin 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-card {
  /* Glassmorphism: frosted glass effect */
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: var(--space-16) var(--space-12);
  text-align: center;
  box-shadow:
    0 16px 64px rgba(0, 0, 0, 0.35),
    0 0 80px rgba(58, 109, 240, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
/* Light gradient overlay — pseudo-element */
.search-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(58, 109, 240, 0.15) 0%,
    rgba(199, 93, 235, 0.08) 40%,
    rgba(59, 240, 131, 0.06) 70%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 0;
}
/* Ensure content sits above the overlay */
.search-card > * {
  position: relative;
  z-index: 1;
}
/* Override glass-card hover for search-card */
.search-card:hover {
  transform: none;
  box-shadow:
    0 20px 72px rgba(0, 0, 0, 0.4),
    0 0 100px rgba(58, 109, 240, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Light theme: brighter glass */
[data-theme="light"] .search-card {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow:
    0 16px 64px rgba(0, 0, 0, 0.08),
    0 0 60px rgba(58, 109, 240, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.search-title {
  font-size: var(--text-4xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-6);
  color: var(--text-primary);
  background: none;
  -webkit-text-fill-color: var(--text-primary);
}

.search-subtitle {
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

/* ── Dashboard grid ────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

.full-width  { grid-column: 1 / -1; }
.col-half    { grid-column: span 1; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.section-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.section-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}
.section-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.section-tag {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent-green);
  background: rgba(59, 240, 131, 0.1);
  border: 1px solid rgba(59, 240, 131, 0.2);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  animation: livePulse 2s ease-in-out infinite;
}

/* ── Positions grid ────────────────────────────────────────────── */
.positions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-4);
}

/* ── Global error banner ───────────────────────────────────────── */
.global-error[hidden] { display: none; }
.global-error {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: rgba(249, 96, 87, 0.1);
  border: 1px solid rgba(249, 96, 87, 0.25);
  border-radius: var(--radius-lg);
  color: var(--accent-red);
  margin-top: var(--space-4);
  font-size: var(--text-sm);
}
.error-close {
  margin-left: auto;
  color: var(--accent-red);
  opacity: 0.6;
  padding: 2px 4px;
  border-radius: 4px;
  transition: opacity var(--transition-fast);
}
.error-close:hover { opacity: 1; }

/* ── Section error banner ──────────────────────────────────────── */
.section-error {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: rgba(249, 96, 87, 0.08);
  border: 1px solid rgba(249, 96, 87, 0.2);
  border-radius: var(--radius-md);
  color: var(--accent-red);
  font-size: var(--text-sm);
  margin-top: var(--space-2);
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .col-half { grid-column: 1 / -1; }
  .positions-grid { grid-template-columns: 1fr; }
  .page-main { padding: var(--space-5) var(--space-4); }
  .search-card { padding: var(--space-8) var(--space-5); }
  .search-title { font-size: var(--text-3xl); }
}

@media (max-width: 480px) {
  .search-title { font-size: var(--text-2xl); }
  .site-header { padding: 0 var(--space-4); }
}
