/* Basic styling for the downline explorer */

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

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  background: #f5f7fa;
  color: #1a1a2e;
  padding: 20px;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.app-header h1 {
  font-size: 1.8rem;
  font-weight: 600;
  background: linear-gradient(135deg, #1e3c72, #2a5298);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.wallet-badge {
  background: #e2e8f0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.nav-link {
  display: inline-block;
  text-decoration: none;
  color: #1a1a2e;
}

.btn-primary {
  background: #2a5298;
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #1e3c72;
}

.search-bar {
  background: white;
  padding: 16px 20px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
}

.search-bar form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.address-input {
  flex: 1;
  min-width: 250px;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  font-family: monospace;
}

.btn-secondary {
  background: #e2e8f0;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover:not(:disabled) {
  background: #cbd5e1;
}
.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error-message {
  background: #fee2e2;
  color: #991b1b;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid #dc2626;
}

.loading {
  text-align: center;
  padding: 40px;
  font-size: 1.2rem;
  color: #4b5563;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .dashboard-row {
    grid-template-columns: 1fr;
  }
}

.card {
  background: white;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 20px;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
}

.profile-row:last-child {
  border-bottom: none;
}

.label {
  color: #4b5563;
  font-weight: 500;
}

.value {
  font-weight: 500;
  min-width: 0;
  overflow-wrap: break-word;
}

.mono {
  font-family: "Courier New", monospace;
  letter-spacing: 0.3px;
  overflow-wrap: break-word;
  word-break: break-all;
}

.copyable-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.copy-btn {
  background: #e2e8f0;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.copy-btn:hover {
  background: #cbd5e1;
}

.active {
  color: #15803d;
}
.inactive {
  color: #b91c1c;
}

.tree-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.tree-item {
  background: #f8fafc;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
}

.tree-label {
  display: block;
  font-size: 0.85rem;
  color: #4b5563;
}

.tree-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 4px 0;
}

.tree-slots {
  font-size: 0.8rem;
  color: #6b7280;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.referral-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.referral-table th {
  text-align: left;
  padding: 8px 6px;
  background: #f1f5f9;
  font-weight: 600;
}

.referral-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #e5e7eb;
}

.referral-table tr:last-child td {
  border-bottom: none;
}

.pagination {
  margin-top: 12px;
  text-align: center;
  font-size: 0.9rem;
  color: #4b5563;
}

.empty-message {
  padding: 20px 0;
  text-align: center;
  color: #6b7280;
}

.app-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 0.85rem;
  color: #6b7280;
  border-top: 1px solid #e5e7eb;
  padding-top: 20px;
}

@media (max-width: 480px) {
  body {
    padding: 12px;
  }

  .app-header h1 {
    font-size: 1.4rem;
  }

  .card {
    padding: 16px;
  }

  .profile-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .tree-value {
    font-size: 1.3rem;
  }
}
