/* === Onchain Credit Marketplace — Global Styles === */
:root {
  --transition-speed: 300ms;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* === Theme Transitions === */
body, .card, .nav, .btn, input, select, textarea, .modal-overlay, .badge {
  transition: background-color var(--transition-speed) ease,
              color var(--transition-speed) ease,
              border-color var(--transition-speed) ease,
              box-shadow var(--transition-speed) ease;
}

/* === Navigation === */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(148,163,184,0.1);
}

.nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.nav-link {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  background: transparent;
  color: inherit;
  transition: all 150ms ease;
}

.nav-link:hover, .nav-link.active {
  background: rgba(59,130,246,0.1);
  color: #3b82f6;
}

.dark .nav-link:hover, .dark .nav-link.active {
  background: rgba(59,130,246,0.2);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* === Theme Toggle === */
.theme-toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  border: 2px solid rgba(148,163,184,0.3);
  transition: all 200ms ease;
}

.theme-toggle .toggle-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 200ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.dark .theme-toggle .toggle-thumb {
  transform: translateX(20px);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: all 150ms ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 4px 12px rgba(37,99,235,0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  border: 1px solid rgba(148,163,184,0.3);
}

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.btn-arc {
  background: linear-gradient(135deg, #00d4aa, #00b894);
  color: #0f172a;
  font-weight: 700;
}

.btn-arc:hover:not(:disabled) {
  background: linear-gradient(135deg, #00b894, #009975);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
}

.btn-ghost:hover { background: rgba(148,163,184,0.1); }

/* === Cards === */
.card {
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid rgba(148,163,184,0.1);
  box-shadow: var(--shadow-sm);
}

.card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: rgba(59,130,246,0.3);
}

/* === Page Container === */
.page-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* === Grid Layouts === */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

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

@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .mobile-nav { display: flex; }
  .page-container { padding: 1rem; }
}

/* === Form Elements === */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: inherit;
  opacity: 0.8;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148,163,184,0.3);
  font-size: 0.875rem;
  background: transparent;
  color: inherit;
  transition: border-color 150ms ease;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.form-textarea { resize: vertical; min-height: 80px; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
}

.form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
}

/* === Stat Cards === */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8125rem;
  opacity: 0.6;
  font-weight: 500;
}

.stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-change.positive { color: #10b981; }
.stat-change.negative { color: #ef4444; }

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-success { background: rgba(16,185,129,0.1); color: #10b981; }
.badge-warning { background: rgba(245,158,11,0.1); color: #f59e0b; }
.badge-danger  { background: rgba(239,68,68,0.1);  color: #ef4444; }
.badge-info    { background: rgba(59,130,246,0.1);  color: #3b82f6; }
.badge-arc     { background: rgba(0,212,170,0.1);   color: #00d4aa; }
.badge-neutral { background: rgba(148,163,184,0.1); color: #94a3b8; }

/* === Credit Card === */
.credit-card {
  border: 1px solid rgba(148,163,184,0.1);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all 200ms ease;
  cursor: pointer;
}

.credit-card:hover {
  border-color: rgba(59,130,246,0.3);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.credit-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.credit-card-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.credit-card-footer {
  display: flex;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148,163,184,0.1);
}

.credit-metric {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.credit-metric-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.5;
  font-weight: 600;
}

.credit-metric-value {
  font-size: 0.9375rem;
  font-weight: 600;
}

/* === Score Gauge === */
.score-gauge {
  width: 160px;
  height: 160px;
  position: relative;
  margin: 0 auto;
}

.score-gauge svg {
  transform: rotate(-90deg);
}

.score-gauge-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.score-number {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.score-label {
  font-size: 0.75rem;
  opacity: 0.5;
  margin-top: 0.25rem;
}

/* === Tables === */
.table-wrapper { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.5;
  border-bottom: 1px solid rgba(148,163,184,0.2);
}

.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(148,163,184,0.08);
}

.data-table tr:hover td {
  background: rgba(59,130,246,0.03);
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 200ms ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  max-width: 560px;
  width: 100%;
  border-radius: var(--radius);
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  transform: translateY(20px);
  transition: transform 200ms ease;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

/* === Toast === */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideIn 300ms ease;
  min-width: 300px;
  max-width: 450px;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-success { background: #059669; color: white; }
.toast-error   { background: #dc2626; color: white; }
.toast-info    { background: #2563eb; color: white; }
.toast-warning { background: #d97706; color: white; }

/* === Filter Bar === */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  padding: 1rem 0;
}

.filter-chip {
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(148,163,184,0.2);
  background: transparent;
  color: inherit;
  transition: all 150ms ease;
}

.filter-chip:hover, .filter-chip.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

/* === Progress Bar === */
.progress-bar {
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(148,163,184,0.15);
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 500ms ease;
}

/* === Responsive Container === */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 0.875rem;
  opacity: 0.6;
  margin-top: 0.25rem;
}

/* === Loading Skeleton === */
.skeleton {
  background: linear-gradient(90deg, rgba(148,163,184,0.1) 25%, rgba(148,163,184,0.2) 50%, rgba(148,163,184,0.1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

/* === Wallet Address === */
.wallet-addr {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8125rem;
  opacity: 0.7;
}

/* === Mobile Bottom Nav === */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0.5rem;
  border-top: 1px solid rgba(148,163,184,0.1);
  justify-content: space-around;
}

@media (max-width: 640px) {
  .mobile-nav { display: flex; }
  body { padding-bottom: 70px; }
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 0.625rem;
  font-weight: 500;
  opacity: 0.6;
  transition: all 150ms ease;
}

.mobile-nav-item.active, .mobile-nav-item:hover {
  opacity: 1;
  color: #3b82f6;
}

.mobile-nav-item i { font-size: 1.25rem; }

/* === Network Indicator === */
.network-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.network-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* === Tabs === */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(148,163,184,0.15);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.5;
  border-bottom: 2px solid transparent;
  transition: all 150ms ease;
  position: relative;
  bottom: -1px;
}

.tab:hover { opacity: 0.8; }

.tab.active {
  opacity: 1;
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

/* === Hero section === */
.hero-gradient {
  background: linear-gradient(135deg, rgba(59,130,246,0.05), rgba(0,212,170,0.05));
  border-radius: var(--radius);
  padding: 2.5rem;
  margin-bottom: 2rem;
}

.dark .hero-gradient {
  background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(0,212,170,0.08));
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  opacity: 0.5;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
}
