/* ============================================================
   WithPay — Global Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ─────────────────────────────────────── */
:root {
  --bg-primary:    #05050f;
  --bg-secondary:  #0d0d1f;
  --bg-card:       rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --border:        rgba(255,255,255,0.08);
  --border-focus:  rgba(124, 58, 237, 0.6);

  --violet:        #7c3aed;
  --violet-light:  #9d6eff;
  --violet-dark:   #5b21b6;
  --cyan:          #06b6d4;
  --cyan-light:    #67e8f9;
  --emerald:       #10b981;
  --rose:          #f43f5e;
  --amber:         #f59e0b;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #4b5563;

  --gradient-hero:  linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  --gradient-card:  linear-gradient(135deg, rgba(124,58,237,0.15) 0%, rgba(6,182,212,0.08) 100%);
  --gradient-btn:   linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);

  --shadow-card: 0 4px 32px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.05) inset;
  --shadow-btn:  0 4px 24px rgba(124,58,237,0.4);
  --radius:      16px;
  --radius-sm:   10px;
  --transition:  all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-primary:    #f8fafc;
  --bg-secondary:  #ffffff;
  --bg-card:       #ffffff;
  --bg-card-hover: #f1f5f9;
  --border:        rgba(0,0,0,0.1);
  --border-focus:  rgba(124, 58, 237, 0.6);

  --text-primary:   #0f172a;
  --text-secondary: #334155;
  --text-muted:     #64748b;

  --gradient-card:  linear-gradient(135deg, rgba(124,58,237,0.05) 0%, rgba(6,182,212,0.05) 100%);
  --shadow-card:    0 4px 16px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.3rem; }
p  { color: var(--text-secondary); }
a  { color: var(--violet-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--cyan); }

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--violet-dark); border-radius: 3px; }

/* ── Utility ───────────────────────────────────────────── */
.text-gradient {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em;
}
.badge-success { background: rgba(16,185,129,0.15); color: var(--emerald); border: 1px solid rgba(16,185,129,0.3); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--amber);   border: 1px solid rgba(245,158,11,0.3); }
.badge-danger  { background: rgba(244,63,94,0.15);  color: var(--rose);    border: 1px solid rgba(244,63,94,0.3); }
.badge-info    { background: rgba(6,182,212,0.12);   color: var(--cyan);    border: 1px solid rgba(6,182,212,0.3); }
.badge-muted   { background: rgba(255,255,255,0.06); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  border: none; outline: none; transition: var(--transition);
}
.btn-primary {
  background: var(--gradient-btn);
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(124,58,237,0.6); }
.btn-outline {
  background: transparent; color: var(--violet-light);
  border: 1px solid rgba(124,58,237,0.4);
}
.btn-outline:hover { background: rgba(124,58,237,0.12); border-color: var(--violet); }
.btn-danger  { background: rgba(244,63,94,0.15); color: var(--rose); border: 1px solid rgba(244,63,94,0.3); }
.btn-danger:hover { background: rgba(244,63,94,0.25); }
.btn-success { background: rgba(16,185,129,0.15); color: var(--emerald); border: 1px solid rgba(16,185,129,0.3); }
.btn-success:hover { background: rgba(16,185,129,0.25); }
.btn-sm  { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg  { padding: 14px 36px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  backdrop-filter: blur(12px);
}
.card:hover { border-color: rgba(124,58,237,0.3); }
.card-gradient {
  background: var(--gradient-card);
  border-color: rgba(124,58,237,0.2);
}

/* ── Forms ─────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 8px; }
.form-control {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--violet);
  background: rgba(124,58,237,0.06);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled, .form-control[readonly] {
  opacity: 0.6; cursor: not-allowed;
  background: rgba(255,255,255,0.02);
}
.input-group { display: flex; gap: 0; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.78rem; color: var(--rose); margin-top: 4px; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-size: 0.88rem; margin-bottom: 20px;
  border-left: 3px solid;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: rgba(16,185,129,0.1); border-color: var(--emerald); color: #6ee7b7; }
.alert-danger  { background: rgba(244,63,94,0.1);  border-color: var(--rose);    color: #fda4af; }
.alert-warning { background: rgba(245,158,11,0.1); border-color: var(--amber);   color: #fde68a; }
.alert-info    { background: rgba(6,182,212,0.1);  border-color: var(--cyan);    color: #a5f3fc; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th {
  padding: 14px 18px; text-align: left;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary); vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: rgba(255,255,255,0.03); }
.table .mono { font-family: 'Courier New', monospace; font-size: 0.82rem; color: var(--cyan-light); }

/* ── Stat Cards ─────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--gradient-hero);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
  margin-bottom: 16px;
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; margin-bottom: 4px; }
.stat-card .stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .stat-change { font-size: 0.8rem; margin-top: 8px; }

/* ── Sidebar Layout ─────────────────────────────────────── */
.layout-dashboard {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}
.sidebar {
  grid-row: 1 / -1;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 0;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-brand .brand-icon {
  width: 38px; height: 38px; background: var(--gradient-btn); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800; color: #fff;
}
.sidebar-brand .brand-name { font-weight: 800; font-size: 1.2rem; }
.sidebar-nav { padding: 16px 12px; flex: 1; }
.sidebar-section { margin-bottom: 24px; }
.sidebar-section-title {
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); padding: 0 8px; margin-bottom: 6px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.88rem; font-weight: 500;
  transition: var(--transition); margin-bottom: 2px;
}
.sidebar-link:hover  { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.sidebar-link.active { background: rgba(124,58,237,0.15);  color: var(--violet-light); }
.sidebar-link .icon  { width: 18px; text-align: center; font-size: 0.95rem; }
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.85rem;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--gradient-btn);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: #fff; flex-shrink: 0;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  background: var(--bg-secondary);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.topbar-title { font-size: 1rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* ── Sidebar Toggle Button (hamburger) ──────────────────── */
.sidebar-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 38px; height: 38px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1.2rem;
  transition: var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: rgba(124,58,237,0.15); border-color: var(--violet); }

/* ── Sidebar Overlay (mobile) ───────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  z-index: 199;
  animation: fadeIn 0.2s ease-out;
}
body.sidebar-open .sidebar-overlay { display: block; }

/* ── Main Content ───────────────────────────────────────── */
.main-content { padding: 28px; overflow-y: auto; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.6rem; margin-bottom: 4px; }

/* ── Grid ───────────────────────────────────────────────── */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Wallet Card ─────────────────────────────────────────── */
.wallet-card {
  background: linear-gradient(135deg, #1e0954 0%, #0c1a3e 50%, #071a2f 100%);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 20px;
  padding: 32px;
  position: relative; overflow: hidden;
  color: #ffffff;
}
.wallet-card::before {
  content: ''; position: absolute; top: -60px; right: -60px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(124,58,237,0.15); filter: blur(40px);
}
.wallet-card .balance-label { font-size: 0.8rem; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.08em; }
.wallet-card .balance-amount { font-size: 3rem; font-weight: 800; margin: 8px 0; }
.wallet-card .balance-currency { color: var(--cyan); margin-left: 4px; font-size: 1.4rem; }

/* ── API Key styles ─────────────────────────────────────── */
.key-display {
  font-family: 'Courier New', monospace;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--cyan-light);
  word-break: break-all;
}
.new-key-alert {
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.4);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

/* ── Verification badge ─────────────────────────────────── */
.verify-banner {
  background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(245,158,11,0.05));
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex; align-items: center; gap: 16px; margin-bottom: 24px;
}
.verify-banner .verify-icon { font-size: 2rem; }
.verify-banner .verify-text small { display: block; color: var(--text-muted); font-size: 0.82rem; }

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex; gap: 6px; align-items: center;
  margin-top: 0; flex-wrap: wrap;
}
/* page number buttons */
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 10px;
  border-radius: 10px; font-size: 0.85rem; font-weight: 500;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  color: var(--text-secondary);
  transition: var(--transition);
  white-space: nowrap;
}
.pagination a:hover {
  background: rgba(124,58,237,0.18);
  border-color: rgba(124,58,237,0.5);
  color: var(--violet-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,58,237,0.2);
}
/* active page */
.pagination .active {
  background: var(--gradient-btn);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(124,58,237,0.45);
}
/* prev / next wider pills */
.pagination .pg-prev,
.pagination .pg-next {
  padding: 0 16px; gap: 6px; font-weight: 600;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-primary);
  border-radius: 10px;
}
.pagination .pg-prev:hover,
.pagination .pg-next:hover {
  background: rgba(124,58,237,0.15);
  border-color: rgba(124,58,237,0.45);
  color: var(--violet-light);
  box-shadow: 0 4px 16px rgba(124,58,237,0.2);
  transform: translateY(-1px);
}
.pagination .pg-disabled {
  opacity: 0.28; cursor: not-allowed; pointer-events: none;
}
/* ellipsis */
.pagination .pg-dots {
  background: none; border: none;
  color: var(--text-muted); font-size: 1rem;
  width: 28px; min-width: 28px; padding: 0;
  cursor: default;
}

/* ── Loading spinner ─────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--violet-light); border-radius: 50%;
  animation: spin 0.7s linear infinite; display: inline-block;
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeIn  { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }
@keyframes shimmer { 0%,100% { background-position: -200% center; } 50% { background-position: 200% center; } }

.fade-in { animation: fadeIn 0.4s ease-out forwards; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .layout-dashboard { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: 270px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 32px rgba(0,0,0,0.5);
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .sidebar-toggle { display: flex; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
  .wallet-card { padding: 20px; }
  .wallet-card .balance-amount { font-size: 2.2rem; }
  .topbar { padding: 12px 16px; }
}

/* ── Theme Toggle ───────────────────────────────────────── */
.theme-toggle {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.theme-toggle:hover {
  transform: scale(1.1);
}
