/* ============================================================
   CryptoX — Main Design System (Trust Wallet Inspired)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@600;700;800&display=swap');

/* ─── CSS Custom Properties ─────────────────────────────────── */
:root {
  --bg-primary:    #0A0A0F;
  --bg-surface:    #121318;
  --bg-elevated:   #1C1D24;
  --bg-overlay:    rgba(10,10,15,0.85);

  --color-brand:   #3375BB; /* Trust Wallet Blue */
  --color-blue:    #3375BB;
  --color-green:   #2E9F6E; /* Trust Wallet Green */
  --color-red:     #FF4D4D; /* Trust Wallet Red */
  --color-gold:    #F59E0B;
  --color-orange:  #F97316;

  --text-primary:  #FFFFFF;
  --text-secondary:#9CA3AF;
  --text-muted:    #6B7280;
  --border:        #262730;

  --gradient-main: linear-gradient(135deg, #3375BB 0%, #25588C 100%);
  --gradient-gold: linear-gradient(135deg, #F59E0B 0%, #EF9B0B 100%);
  --gradient-green:linear-gradient(135deg, #2E9F6E 0%, #207A52 100%);
  --gradient-red:  linear-gradient(135deg, #FF4D4D 0%, #D13434 100%);
  --gradient-card: linear-gradient(180deg, #1C1D24 0%, #121318 100%);
  --gradient-dark: linear-gradient(180deg, #121318 0%, #0A0A0F 100%);

  --shadow-sm:     0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:     0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.5);
  --shadow-brand:  0 0 20px rgba(51,117,187,0.35);
  --shadow-gold:   0 0 20px rgba(245,158,11,0.35);
  --shadow-green:  0 0 16px rgba(46,159,110,0.3);
  --shadow-red:    0 0 16px rgba(255,77,77,0.3);

  --radius-xl:     24px;
  --radius-lg:     20px;
  --radius-md:     16px;
  --radius-sm:     12px;
  --radius-xs:     8px;

  --sidebar-width: 256px;
  --topbar-height: 64px;

  --transition-fast:  all 0.15s ease;
  --transition-base:  all 0.25s ease;
  --transition-slow:  all 0.4s ease;
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Selection ─────────────────────────────────────────────── */
::selection { background: rgba(107,78,255,0.3); color: var(--text-primary); }

/* ─── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p { color: var(--text-secondary); line-height: 1.7; }
a { color: var(--color-brand); text-decoration: none; transition: var(--transition-fast); }
a:hover { color: var(--color-blue); }

/* ─── Layout ────────────────────────────────────────────────── */
.page-wrapper { display: flex; min-height: 100vh; }

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

.content-area {
  padding: 24px;
  flex: 1;
  max-width: 1600px;
  width: 100%;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--gradient-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
  box-shadow: var(--shadow-brand);
}

.logo-text {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition-fast);
  cursor: pointer;
  border-left: 3px solid transparent;
  position: relative;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(51,117,187,0.1);
  border-left-color: var(--color-brand);
}

.nav-item.active {
  color: var(--text-primary);
  background: rgba(51,117,187,0.15);
  border-left-color: var(--color-brand);
  font-weight: 600;
}

.nav-item.active svg { color: var(--color-brand); }

.nav-item-gold { color: var(--color-gold) !important; }
.nav-item-gold:hover { background: rgba(245,158,11,0.1) !important; border-left-color: var(--color-gold) !important; }
.nav-item-gold.active { background: rgba(245,158,11,0.15) !important; border-left-color: var(--color-gold) !important; }

.nav-divider { height: 1px; background: var(--border); margin: 8px 0; }

.sidebar-user {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); truncate: true; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-logout { font-size: 0.75rem; color: var(--text-muted); transition: var(--transition-fast); }
.user-logout:hover { color: var(--color-red); }

/* ─── Top Bar ───────────────────────────────────────────────── */
.top-bar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(18,19,24,0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-xs);
}

.hamburger:hover { color: var(--text-primary); background: var(--bg-elevated); }

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.notification-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.notification-btn:hover { color: var(--text-primary); border-color: var(--color-brand); }
.notification-btn svg { width: 16px; height: 16px; }

.user-balance {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
}

.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  cursor: pointer;
}

/* ─── Sidebar Overlay (mobile) ──────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}

/* ─── Grid Utilities ────────────────────────────────────────── */
.grid { display: grid; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ─── Flex Utilities ────────────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; justify-content: center; align-items: center; }
.flex-end     { display: flex; justify-content: flex-end; align-items: center; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }

.gap-xs  { gap: 4px; }
.gap-sm  { gap: 8px; }
.gap-md  { gap: 16px; }
.gap-lg  { gap: 24px; }
.gap-xl  { gap: 32px; }

/* ─── Spacing ───────────────────────────────────────────────── */
.mt-xs { margin-top: 4px; }    .mb-xs { margin-bottom: 4px; }
.mt-sm { margin-top: 8px; }    .mb-sm { margin-bottom: 8px; }
.mt-md { margin-top: 16px; }   .mb-md { margin-bottom: 16px; }
.mt-lg { margin-top: 24px; }   .mb-lg { margin-bottom: 24px; }
.mt-xl { margin-top: 32px; }   .mb-xl { margin-bottom: 32px; }

.p-xs  { padding: 4px; }
.p-sm  { padding: 8px; }
.p-md  { padding: 16px; }
.p-lg  { padding: 24px; }
.p-xl  { padding: 32px; }

/* ─── Text Utilities ────────────────────────────────────────── */
.text-xs   { font-size: 0.75rem; }
.text-sm   { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.text-3xl  { font-size: 2rem; }

.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.font-mono    { font-family: 'Courier New', monospace; }

.text-primary   { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-success   { color: var(--color-green) !important; }
.text-danger    { color: var(--color-red) !important; }
.text-gold      { color: var(--color-gold) !important; }
.text-brand     { color: var(--color-brand) !important; }

.text-gradient {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }
.truncate    { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uppercase   { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }

/* ─── Badge ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-native  { background: rgba(245,158,11,0.15); color: var(--color-gold); border: 1px solid rgba(245,158,11,0.3); }
.badge-frozen  { background: rgba(74,85,104,0.3);   color: var(--text-muted); border: 1px solid var(--border); }
.badge-new     { background: rgba(107,78,255,0.15); color: var(--color-brand); border: 1px solid rgba(107,78,255,0.3); }
.badge-success { background: rgba(34,197,94,0.15);  color: var(--color-green); border: 1px solid rgba(34,197,94,0.3); }
.badge-danger  { background: rgba(239,68,68,0.15);  color: var(--color-red);   border: 1px solid rgba(239,68,68,0.3); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--color-gold);  border: 1px solid rgba(245,158,11,0.3); }

/* ─── Misc ──────────────────────────────────────────────────── */
.w-full { width: 100%; }
.h-full { height: 100%; }
.relative { position: relative; }
.absolute { position: absolute; }
.overflow-hidden { overflow: hidden; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-overlay.open { display: block; }

  .main-content { margin-left: 0; padding-bottom: 70px; /* space for bottom nav */ }
  .hamburger { display: flex; align-items: center; justify-content: center; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .content-area { padding: 16px; }

  /* Bottom Nav */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(18,19,24,0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    z-index: 90;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
  }
  
  .bottom-nav-item svg {
    width: 24px;
    height: 24px;
  }
  
  .bottom-nav-item.active {
    color: var(--color-brand);
  }
}

@media (min-width: 769px) {
  .bottom-nav { display: none; }
}
