/* [BSP Meta] Crypto Wallet Stylesheet — Server-Rendered HTML + SPA
/* Version: v1.2.0 */
/* Last change: 2026-06-23 13:22 UTC */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #0f172a;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ========== HEADER ========== */
header {
  background: var(--secondary);
  color: white;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

header h1 { font-size: 18px; font-weight: 600; }
header a { color: white; text-decoration: none; }

/* ========== NAV ========== */
nav {
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 24px;
  overflow-x: auto;
}

nav ul { list-style: none; display: flex; margin: 0; padding: 0; }
nav li { margin: 0; }
nav a {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

nav a:hover { color: var(--primary); }
nav a:active, nav a:focus { color: var(--primary); border-bottom-color: var(--primary); }

/* ========== MAIN ========== */
main { max-width: 960px; margin: 24px auto; padding: 0 16px; }

/* ========== FLASH MESSAGES ========== */
.flash {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}
.flash-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ========== FORMS ========== */
form {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

form div {
  margin-bottom: 12px;
}

form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-muted);
}

form input[type="text"],
form input[type="date"],
form input[type="password"],
form select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: white;
  font-family: inherit;
}

form input:focus, form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}

/* ========== BUTTONS ========== */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  background: var(--primary);
  color: white;
  font-family: inherit;
  text-decoration: none;
}

button:hover, .btn:hover { background: var(--primary-dark); }
a.btn { background: var(--primary); color: white; text-decoration: none; }
a.btn:hover { background: var(--primary-dark); }

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

/* ========== TABLES ========== */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  background: var(--bg);
}

tr:last-child td { border-bottom: none; }
tr:hover { background: #f8fafc; }

code {
  font-family: 'SF Mono', 'Fira Code', 'Monaco', monospace;
  font-size: 13px;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-all;
}

/* ========== WALLET GRID ========== */
.wallet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.wallet-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  border-left: 4px solid var(--primary);
}

.wallet-network {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
  background: #e0e7ff;
  color: #3730a3;
}

.wallet-address { font-family: monospace; font-size: 12px; color: var(--text-muted); word-break: break-all; margin-bottom: 8px; }
.wallet-balance { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.wallet-label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.wallet-actions { display: flex; gap: 6px; }

/* ========== RECEIVE ========== */
.receive-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: center;
}

.receive-card div { margin-bottom: 8px; }

.address-box {
  background: #f1f5f9;
  padding: 12px;
  border-radius: 6px;
  word-break: break-all;
  margin: 8px 0;
}

.qr-container {
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

/* ========== STATUS ========== */
.status-pending { color: var(--warning); font-weight: 600; }
.status-confirmed { color: var(--success); font-weight: 600; }
.status-failed { color: var(--danger); font-weight: 600; }

/* ========== MISC ========== */
.empty-state { text-align: center; padding: 40px 16px; color: var(--text-muted); }
.empty-state p { font-size: 16px; margin-bottom: 12px; }

hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
h2 { font-size: 20px; font-weight: 600; margin-bottom: 16px; }
h3 { font-size: 16px; font-weight: 600; margin: 16px 0 8px; }

.note { font-size: 13px; color: var(--text-muted); font-style: italic; }
.error-box { background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px; padding: 16px; margin-bottom: 16px; }
.error-box p { color: #991b1b; margin-bottom: 12px; }

footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 48px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 640px) {
  .wallet-grid { grid-template-columns: 1fr; }
  nav { padding: 0 8px; }
  nav a { padding: 10px 12px; font-size: 13px; }
  main { margin-top: 16px; }
  form { padding: 16px; }
}

/* SPA-specific styles (legacy, kept for compatibility) */
.app-header { display: none; } /* Hide SPA header, use EJS header instead */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }
.spinner { display: inline-block; width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal {
  background: white; border-radius: var(--radius);
  padding: 24px; max-width: 500px; width: 90%;
  max-height: 80vh; overflow-y: auto;
}

/* ========== SWAP STATUS PAGE ========== */
.swap-status-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.swap-status-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.swap-network-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.from-badge { background: #fef3c7; color: #92400e; }
.to-badge { background: #dbeafe; color: #1e40af; }
.swap-arrow { font-size: 20px; color: var(--text-muted); }

.swap-details { width: 100%; box-shadow: none; margin-bottom: 0; }
.swap-details td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--border); }
.swap-details tr:last-child td { border-bottom: none; }
.detail-label { color: var(--text-muted); font-size: 13px; width: 140px; }
.detail-value { font-size: 14px; }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-processing { background: #dbeafe; color: #1e40af; }
.status-completed { background: #dcfce7; color: #166534; }

.share-link-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.share-link-box label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.share-link-input {
  display: flex;
  gap: 8px;
}
.share-link-input input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: monospace;
  background: var(--bg);
}

.processing-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 20px;
  text-align: center;
  margin-bottom: 16px;
}
.processing-text {
  margin-top: 16px;
  font-size: 16px;
  font-weight: 500;
  color: var(--primary);
}
.processing-subtext {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.completed-box {
  background: #f0fdf4;
  border: 2px solid var(--success);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  margin-bottom: 16px;
  animation: fadeInUp 0.5s ease-out;
}
.success-icon { font-size: 48px; margin-bottom: 12px; }
.completed-title {
  font-size: 20px;
  font-weight: 700;
  color: #166534;
  margin-bottom: 8px;
}
.completed-amount { font-size: 24px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.completed-tx { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.completed-time { font-size: 13px; color: var(--text-muted); }

.nojs-box { text-align: center; padding: 16px 0; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== SWAP LINK IN HISTORY ========== */
.swap-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
}
.swap-link:hover {
  text-decoration: underline;
  color: var(--primary-dark);
}
.swap-link-text {
  font-size: 12px;
}
