/* ============================
   GDF DApp - Design System
   ============================ */

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

:root {
  --bg-primary: #080b14;
  --bg-secondary: #0d1120;
  --bg-card: rgba(15, 20, 40, 0.85);
  --bg-card-hover: rgba(20, 28, 55, 0.9);
  --border-card: rgba(100, 140, 255, 0.12);
  --border-card-hover: rgba(100, 140, 255, 0.25);
  --text-primary: #e8ecf4;
  --text-secondary: #8b95b0;
  --text-muted: #5a6380;
  --accent-blue: #3b82f6;
  --accent-purple: #7c3aed;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-gold: #f59e0b;
  --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #7c3aed 100%);
  --gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --gradient-gold: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 1px rgba(100, 140, 255, 0.1);
  --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background effects */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(124, 58, 237, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.04) 0%, transparent 50%);
  z-index: -1;
  animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(-5%, -3%);
  }
}

/* ============================
   Header / Navbar
   ============================ */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(8, 11, 20, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-card);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.nav-title {
  font-size: 1.25rem;
  font-weight: 800;
  background: var(--gradient-secondary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Wallet Button */
.btn-wallet {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border-card-hover);
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-wallet:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--accent-blue);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
  transform: translateY(-1px);
}

.btn-wallet.connected {
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.3);
  background: rgba(6, 182, 212, 0.1);
}

.btn-wallet .wallet-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* Language Switcher */
.lang-wrapper {
  position: relative;
}

.btn-lang {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-card-hover);
  background: var(--bg-card);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.btn-lang:hover {
  border-color: var(--accent-blue);
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: 48px;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-card-hover);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  min-width: 160px;
  animation: slideDown 0.2s ease;
  z-index: 200;
}

.lang-dropdown.show {
  display: block;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.lang-option:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--text-primary);
}

.lang-option.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  font-weight: 600;
}

.lang-option .flag {
  font-size: 1.2rem;
}

/* Flag images (replaces emoji for compatibility) */
.flag-img {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
}

.flag-img-sm {
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 2px;
}

/* ============================
   Main Content
   ============================ */

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ============================
   Cards
   ============================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  transition: all 0.3s ease;
}

.card:hover {
  border-color: var(--border-card-hover);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  font-size: 1rem;
}

/* Info Card */
.info-card {
  background: linear-gradient(135deg, rgba(15, 20, 45, 0.9) 0%, rgba(20, 15, 45, 0.9) 100%);
  border-color: rgba(124, 58, 237, 0.15);
  position: relative;
  overflow: hidden;
}

.info-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-item.full-width {
  grid-column: 1 / -1;
}

.info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.info-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.info-value.address {
  font-size: 0.85rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent-cyan);
  cursor: pointer;
  transition: color 0.2s;
}

.info-value.address:hover {
  color: var(--accent-blue);
}

/* Level Badge */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 700;
}

.level-badge.v0 {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
}

.level-badge.v1 {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.level-badge.v2 {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.level-badge.v3 {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
}

.level-badge.v4 {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.level-badge.v5 {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.nft-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

.nft-badge.active {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
}

.nft-badge.inactive {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}

/* ============================
   Referral Table
   ============================ */

.referral-count {
  color: var(--accent-blue);
  font-weight: 700;
}

.table-wrapper {
  overflow-x: auto;
  margin: 0 -4px;
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
}

.ref-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-card);
}

.ref-table td {
  padding: 10px 12px;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(100, 140, 255, 0.05);
  color: var(--text-secondary);
}

.ref-table tr:hover td {
  background: rgba(59, 130, 246, 0.05);
  color: var(--text-primary);
}

.ref-table .addr {
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent-cyan);
  font-size: 0.78rem;
  cursor: pointer;
}

.ref-table .addr:hover {
  color: var(--accent-blue);
  text-decoration: underline;
}

.ref-table .perf {
  font-weight: 600;
  color: var(--text-primary);
}

.no-data {
  text-align: center;
  padding: 30px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.no-data .emoji {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

/* ============================
   Earnings Card
   ============================ */

.earnings-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.earning-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(100, 140, 255, 0.06);
  transition: all 0.2s;
}

.earning-row:hover {
  background: rgba(100, 140, 255, 0.04);
  border-color: var(--border-card-hover);
}

.earning-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.earning-label .name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.earning-label .tag {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.earning-value {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.earning-value .amount {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-green);
}

.earning-value .unit {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: right;
}

/* ============================
   Connect Prompt
   ============================ */

.connect-prompt {
  text-align: center;
  padding: 60px 20px;
}

.connect-prompt .icon-big {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
}

.connect-prompt .title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.connect-prompt .subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.connect-prompt .btn-connect-lg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.connect-prompt .btn-connect-lg:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.3);
}

/* ============================
   Toast notification
   ============================ */

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-secondary);
  border: 1px solid var(--border-card-hover);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================
   Loading skeleton
   ============================ */

.skeleton {
  background: linear-gradient(90deg, rgba(100, 140, 255, 0.06) 25%, rgba(100, 140, 255, 0.12) 50%, rgba(100, 140, 255, 0.06) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  height: 20px;
  width: 80px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* ============================
   Responsive
   ============================ */

@media (max-width: 420px) {
  .navbar {
    padding: 10px 14px;
  }

  .nav-title {
    font-size: 1.1rem;
  }

  .btn-wallet {
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  .btn-lang {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .container {
    padding: 12px;
    gap: 12px;
  }

  .card {
    padding: 16px;
  }

  .info-grid {
    gap: 12px;
  }

  .info-value {
    font-size: 0.9rem;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 24px;
  }
}

/* ============================
   Scrollbar
   ============================ */

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(100, 140, 255, 0.2);
  border-radius: 2px;
}