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

html, body {
  background: #0C1219;
  color: #F2F4F5;
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
}

input {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

/* ===== Grid ===== */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -8px;
}

.col {
  padding: 0 8px;
  margin-bottom: 16px;
}

.col-12 { width: 100%; }

@media (min-width: 600px) {
  .col-sm-6 { width: 50%; }
}

@media (min-width: 768px) {
  .col-md-4 { width: 33.333%; }
}

@media (min-width: 1024px) {
  .col-lg-3 { width: 25%; }
}

/* ===== Header ===== */
.app-bar {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 56px;
  background: #121C26;
  border-bottom: 1px solid #2B3540;
  position: sticky;
  top: 0;
  z-index: 100;
}

.title-link {
  display: flex;
  align-items: center;
}

.nansen-logo {
  height: 32px;
  width: auto;
}

.header-title {
  margin-left: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #FFFFFF;
  letter-spacing: 0.02em;
}

.spacer {
  flex: 1;
}

.header-account {
  display: flex;
  align-items: center;
  gap: 16px;
}

.account-address {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(0, 255, 167, 0.1);
  border: 1px solid rgba(0, 255, 167, 0.3);
  border-radius: 8px;
}

.account-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #00FFA7;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  color: #949FA8;
  transition: color 0.2s;
}

.icon-btn:hover {
  color: #F2F4F5;
}

.copy-btn {
  opacity: 0.7;
  transition: opacity 0.2s;
}

.copy-btn:hover {
  opacity: 1;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
  border-radius: 8px;
  padding: 10px 24px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: #00FFA7;
  color: #000;
}

.btn-primary:hover:not(:disabled) {
  background: #00e699;
}

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

.btn-primary.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn-primary.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-outline-danger {
  border: 1px solid #FF7F7B;
  color: #FF7F7B;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 6px;
}

.btn-outline-danger:hover {
  background: rgba(255, 127, 123, 0.1);
}

.btn-sm {
  font-size: 12px;
  padding: 4px 12px;
}

.btn-lg {
  font-size: 15px;
  padding: 12px 32px;
  height: 48px;
}

.btn-block {
  width: 100%;
  height: 40px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Main Container ===== */
.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px;
  flex: 1;
}

/* ===== Stats Grid ===== */
.stats-grid {
  margin-bottom: 4px;
}

.stat-card {
  background: #121C26;
  border: 1px solid #2B3540;
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
  height: 100%;
}

.stat-card:hover {
  border-color: #00FFA7;
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 255, 167, 0.12);
}

.stat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.stat-icon {
  flex-shrink: 0;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #949FA8;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #00FFA7;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-subtext {
  font-size: 12px;
  color: #949FA8;
}

/* ===== CTA Section ===== */
.wallet-cta-section {
  margin-bottom: 16px;
}

.cta-card {
  background: linear-gradient(135deg, rgba(0, 255, 167, 0.03) 0%, rgba(60, 246, 184, 0.01) 100%);
  border: 1px solid rgba(0, 255, 167, 0.2);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
}

.cta-content {
  margin-bottom: 16px;
}

.cta-icon {
  margin-bottom: 24px;
}

.cta-title {
  font-size: 26px;
  font-weight: 600;
  color: #F2F4F5;
  margin-bottom: 16px;
}

.cta-description {
  font-size: 14px;
  color: #949FA8;
  max-width: 500px;
  margin: 0 auto 32px;
  line-height: 1.5;
}

.cta-features {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #949FA8;
}

/* ===== Balance Cards ===== */
.balance-grid {
  margin-bottom: 4px;
}

.balance-card {
  background: #121C26;
  border: 1px solid #2B3540;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: all 0.3s ease;
  height: 100%;
}

.balance-card:hover {
  border-color: rgba(0, 255, 167, 0.4);
  transform: translateY(-2px);
}

.balance-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #949FA8;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.balance-value {
  font-size: 24px;
  font-weight: 700;
  color: #00FFA7;
  line-height: 1;
}

.balance-unit {
  font-size: 14px;
  font-weight: 500;
  color: #949FA8;
}

/* ===== Actions Card ===== */
.actions-card {
  background: #121C26;
  border: 1px solid #2B3540;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.actions-title {
  font-size: 18px;
  font-weight: 600;
  color: #F2F4F5;
  text-align: center;
  margin-bottom: 12px;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  justify-content: center;
  border-bottom: 1px solid #2B3540;
  margin-bottom: 12px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #949FA8;
  padding: 10px 20px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab:hover {
  color: #F2F4F5;
}

.tab.active {
  color: #00FFA7;
  border-bottom-color: #00FFA7;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== Action Form ===== */
.action-form {
  max-width: 500px;
  margin: 0 auto;
}

.form-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #949FA8;
  margin-bottom: 12px;
}

.accent-text {
  color: #00FFA7;
  font-weight: 600;
}

.form-warning {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255, 165, 0, 0.1);
  border: 1px solid rgba(255, 165, 0, 0.3);
  border-radius: 6px;
  font-size: 12px;
  color: #FFA500;
  line-height: 1.4;
  margin-top: 12px;
}

.form-warning svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ===== Input Group ===== */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
  background: #0C1219;
  border: 1px solid #2B3540;
  border-radius: 6px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

.input-group:focus-within {
  border-color: #00FFA7;
}

.amount-input {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
  color: #F2F4F5;
  min-width: 0;
}

.amount-input::placeholder {
  color: #4a5568;
}

/* Hide number input spinners */
.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amount-input[type=number] {
  -moz-appearance: textfield;
}

.input-suffix {
  font-size: 13px;
  color: #949FA8;
  padding-right: 8px;
  white-space: nowrap;
}

.max-btn {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #00FFA7;
  padding: 4px 8px;
  margin-right: 8px;
  border-radius: 4px;
  transition: all 0.2s;
  white-space: nowrap;
}

.max-btn:hover:not(:disabled) {
  background: rgba(0, 255, 167, 0.1);
  transform: scale(1.05);
}

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

/* ===== Toasts ===== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: toast-in 0.3s ease;
  min-width: 280px;
  max-width: 400px;
}

.toast.success {
  background: #34CF82;
  color: #fff;
}

.toast.error {
  background: #FF7F7B;
  color: #fff;
}

.toast-body {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.toast-subtitle {
  font-size: 12px;
  opacity: 0.9;
}

.toast-subtitle a {
  color: #fff;
  text-decoration: underline;
}

.toast-subtitle a:hover {
  opacity: 0.8;
}

.toast-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.4);
}

.toast.removing {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ===== Footer ===== */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #121C26;
  border-top: 1px solid #2B3540;
}

.footer-text {
  font-size: 13px;
  color: #949FA8;
}

/* ===== Wallet Modal ===== */
.wallet-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wallet-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.wallet-modal-card {
  position: relative;
  background: #121C26;
  border: 1px solid #2B3540;
  border-radius: 16px;
  width: 360px;
  max-width: 90vw;
  overflow: hidden;
}

.wallet-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #2B3540;
}

.wallet-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #F2F4F5;
}

.wallet-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #949FA8;
  transition: all 0.2s;
}

.wallet-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #F2F4F5;
}

.wallet-modal-body {
  padding: 12px;
}

.wallet-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  border-radius: 10px;
  transition: all 0.2s;
  margin-bottom: 8px;
}

.wallet-option:last-of-type {
  margin-bottom: 0;
}

.wallet-option:not(:disabled):hover {
  background: rgba(0, 255, 167, 0.08);
}

.wallet-option:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.wallet-option-name {
  font-size: 14px;
  font-weight: 600;
  color: #F2F4F5;
}

.wallet-status {
  font-size: 12px;
  color: #949FA8;
}

.wallet-option:not(:disabled) .wallet-status {
  color: #00FFA7;
}

.no-wallets-msg {
  text-align: center;
  font-size: 13px;
  color: #949FA8;
  padding: 8px 16px 12px;
  line-height: 1.5;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #0C1219;
}

::-webkit-scrollbar-thumb {
  background: #2B3540;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a4a59;
}

/* ===== Responsive ===== */
@media (min-width: 1200px) {
  .dashboard-container {
    max-width: 1600px;
    padding: 32px 48px;
  }

  .app-bar {
    padding: 0 48px;
    height: 64px;
  }

  .header-title {
    font-size: 18px;
  }

  .stat-card {
    padding: 24px;
  }

  .stat-value {
    font-size: 32px;
  }

  .stat-label {
    font-size: 12px;
  }

  .stat-label-total-staked {
    font-size: 10px;
  }

  .stat-subtext {
    font-size: 13px;
  }

  .balance-card {
    padding: 24px;
  }

  .balance-value {
    font-size: 28px;
  }

  .balance-label {
    font-size: 12px;
  }

  .actions-card {
    padding: 28px;
  }

  .actions-title {
    font-size: 20px;
  }

  .action-form {
    max-width: 560px;
  }

  .cta-title {
    font-size: 30px;
  }

  .cta-description {
    font-size: 16px;
  }
}

@media (max-width: 960px) {
  .cta-card {
    padding: 48px 32px;
  }

  .cta-features {
    flex-direction: column;
    gap: 16px;
  }
}

@media (max-width: 600px) {
  .dashboard-container {
    padding: 16px;
  }

  .app-bar {
    padding: 0 16px;
  }

  .stat-value {
    font-size: 24px;
  }

  .balance-value {
    font-size: 20px;
  }

  .header-account {
    gap: 8px;
  }

  .account-address {
    padding: 4px 8px;
  }

  .account-text {
    max-width: 100px;
    font-size: 11px;
  }
}
