/* =============================================
   CashHop App CSS — dashboard, transfer, history
   Design tokens inherited from theme.css
   ============================================= */

/* ===== APP SHELL ===== */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ===== TOP NAV ===== */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 60px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-brand span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 0.5rem;
}

.nav-link {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover,
.nav-link.active {
  background: var(--accent-glow);
  color: var(--accent);
}

/* ===== APP CONTENT AREA ===== */
.app-content {
  flex: 1;
  padding: 2.5rem 2rem 4rem;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.page-subtitle {
  color: var(--fg-muted);
  font-size: 0.95rem;
}

/* ===== TOTAL BALANCE HERO ===== */
.balance-hero {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 2.5rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.balance-hero::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.balance-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.5rem;
  position: relative;
}

.balance-amount {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  position: relative;
}

.balance-amount .currency {
  font-size: 1.5rem;
  vertical-align: super;
  font-weight: 600;
  color: var(--fg-muted);
}

/* ===== WALLET GRID ===== */
.wallets-section {
  margin-bottom: 2.5rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--fg-muted);
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.wallets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.wallet-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.4rem 1.6rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color 0.2s, transform 0.2s;
  cursor: default;
}

.wallet-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.wallet-item-icon {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.wallet-item-info {
  flex: 1;
}

.wallet-item-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.15rem;
}

.wallet-item-provider {
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-transform: capitalize;
}

.wallet-item-balance {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  text-align: right;
}

/* ===== TRANSFER BUTTON ROW ===== */
.action-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #0a0a0f;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.75rem 1.6rem;
  border-radius: 10px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.btn-primary:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.6rem;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== RECENT TRANSACTIONS (mini, on dashboard) ===== */
.tx-list-mini {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tx-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1.2rem;
}

.tx-icon-pair {
  display: flex;
  align-items: center;
  gap: -4px;
  position: relative;
  width: 56px;
  flex-shrink: 0;
}

.tx-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
}

.tx-icon-to {
  position: relative;
  left: -8px;
  border: 2px solid var(--bg-card);
}

.tx-info {
  flex: 1;
}

.tx-route {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.1rem;
}

.tx-meta {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.tx-amount-col {
  text-align: right;
}

.tx-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--fg);
}

.tx-fee {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.tx-status {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  background: rgba(0, 230, 118, 0.12);
  color: var(--accent);
  margin-left: 0.5rem;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--fg-muted);
  font-size: 0.95rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
}

/* ===== TRANSFER FORM ===== */
.transfer-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  max-width: 540px;
}

.form-group {
  margin-bottom: 1.4rem;
}

.form-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.form-select,
.form-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.8rem 1rem;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238888a0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-select:focus,
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select option {
  background: var(--bg-elevated);
}

.amount-wrapper {
  position: relative;
}

.amount-prefix {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--fg-muted);
  pointer-events: none;
}

.amount-wrapper .form-input {
  padding-left: 2rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
}

/* ===== FEE PREVIEW BOX ===== */
.fee-preview {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  margin: 1.5rem 0;
  display: none; /* shown by JS when fee is fetched */
}

.fee-preview.visible { display: block; }

.fee-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
}

.fee-row:last-child { margin-bottom: 0; }

.fee-row.total {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
  color: var(--fg);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.fee-row .label { color: var(--fg-muted); }
.fee-row .value { font-family: var(--font-display); font-weight: 600; }

/* ===== ERROR ALERT ===== */
.alert-error {
  background: rgba(255, 82, 82, 0.1);
  border: 1px solid rgba(255, 82, 82, 0.3);
  color: #ff6b6b;
  border-radius: 10px;
  padding: 0.9rem 1.2rem;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-display);
  font-weight: 500;
}

/* ===== SUCCESS TOAST ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 1rem 1.8rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--accent);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 999;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

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

/* ===== HISTORY TABLE ===== */
.tx-table-wrap {
  overflow-x: auto;
}

.tx-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.5rem;
}

.tx-table th {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  text-transform: uppercase;
  padding: 0 1rem 0.5rem;
  text-align: left;
}

.tx-table th:last-child { text-align: right; }

.tx-table td {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1rem;
  font-size: 0.9rem;
  vertical-align: middle;
}

.tx-table td:first-child {
  border-left: 1px solid var(--border);
  border-radius: 12px 0 0 12px;
}

.tx-table td:last-child {
  border-right: 1px solid var(--border);
  border-radius: 0 12px 12px 0;
  text-align: right;
}

.tx-table .tx-amount { font-size: 0.95rem; }

.tx-table tr:hover td { border-color: var(--accent); }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .app-content { padding: 1.5rem 1rem 3rem; }
  .balance-amount { font-size: 2.2rem; }
  .transfer-card { padding: 1.5rem; }
  .wallets-grid { grid-template-columns: 1fr; }
  .app-nav { padding: 0 1rem; }
  .nav-link { padding: 0.35rem 0.65rem; font-size: 0.82rem; }
}
