/* ============================================================
   USDtoCash Portal — Main Stylesheet
   White + Blue (#1d4ed8) Theme · Bootstrap 5.3 base
   ============================================================ */

:root {
  --primary:      #1d4ed8;
  --primary-dark: #1e40af;
  --primary-light:#eff6ff;
  --blue-50:      #eff6ff;
  --blue-100:     #dbeafe;
  --sidebar-bg:   #0f172a;
  --sidebar-w:    260px;
  --topbar-h:     64px;
  --radius:       12px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --font:         'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { font-family: var(--font); background: #f5f8ff; color: #1e293b; }
a { text-decoration: none; }

/* ── Auth Pages ─────────────────────────────────────────────── */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 50%, #bfdbfe 100%);
  padding: 24px 16px;
}
.auth-wrapper { width: 100%; max-width: 440px; }
.auth-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: 0 8px 40px rgba(29,78,216,.12);
}
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-title { font-size: 1.5rem; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.auth-subtitle { color: #64748b; font-size: .9rem; margin-bottom: 24px; }
.auth-divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
  color: #94a3b8;
  font-size: .8rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 40px);
  height: 1px;
  background: #e2e8f0;
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -.3px;
}
.sidebar-logo span { color: #93c5fd; }
.logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.user-avatar {
  width: 40px; height: 40px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .95rem;
  color: #fff;
  flex-shrink: 0;
}
.user-avatar-sm {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  color: #fff;
  flex-shrink: 0;
}
.user-name  { font-size: .85rem; font-weight: 600; color: #f1f5f9; line-height: 1.2; }
.user-email { font-size: .72rem; color: #94a3b8; }
.sidebar-nav { flex: 1; padding: 12px 12px; }
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #94a3b8;
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
.sidebar-nav .nav-link.active { background: var(--primary); color: #fff; }
.sidebar-nav .nav-link i { font-size: 1rem; flex-shrink: 0; }
.sidebar-footer {
  padding: 12px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.text-danger-light { color: #fca5a5 !important; }
.text-danger-light:hover { color: #f87171 !important; }

/* Admin sidebar accent */
.admin-sidebar .sidebar-nav .nav-link.active { background: #dc2626; }

/* ── Main Wrapper ───────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  z-index: 900;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.topbar-toggle { padding: 4px; color: #475569; }
.topbar-title { font-weight: 700; font-size: 1.05rem; color: #0f172a; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.admin-topbar .topbar-title::before {
  content: '⚙ ';
  color: #dc2626;
}
.live-rate-badge {
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: .78rem;
  font-weight: 600;
}
.live-rate-badge-lg {
  background: rgba(255,255,255,.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 1rem;
  font-weight: 700;
  display: inline-block;
}

/* ── Main Content ───────────────────────────────────────────── */
.main-content { flex: 1; padding: 28px 28px; }
.main-footer {
  padding: 16px 28px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  font-size: .8rem;
  color: #94a3b8;
  background: #fff;
}
.main-footer a { color: #64748b; }

/* ── Cards & Stats ──────────────────────────────────────────── */
.card { border-radius: var(--radius) !important; }
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid #f1f5f9;
  position: relative;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 12px;
}
.stat-icon.blue   { background: #eff6ff; color: var(--primary); }
.stat-icon.green  { background: #f0fdf4; color: #16a34a; }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon.red    { background: #fef2f2; color: #dc2626; }
.stat-num   { font-size: 1.8rem; font-weight: 800; color: #0f172a; line-height: 1; }
.stat-label { font-size: .78rem; color: #64748b; margin-top: 4px; font-weight: 500; }
.stat-action { font-size: .75rem; color: var(--primary); font-weight: 600; display: block; margin-top: 8px; }

/* ── Tables ─────────────────────────────────────────────────── */
.table th { font-size: .78rem; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: .04em; }
.table td { font-size: .875rem; }
.btn-xs { padding: 2px 8px; font-size: .75rem; border-radius: 6px; }

/* ── Info Labels ────────────────────────────────────────────── */
.info-label { font-size: .72rem; color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.info-value { font-size: .9rem; color: #1e293b; font-weight: 500; margin-top: 2px; }

/* ── Conversion Steps ───────────────────────────────────────── */
.conversion-steps {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 4px 0;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.step-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
}
.step.active .step-num { background: var(--primary); color: #fff; }
.step.done   .step-num { background: #16a34a; color: #fff; }
.step-text { font-size: .72rem; color: #64748b; font-weight: 500; white-space: nowrap; }
.step.active .step-text { color: var(--primary); font-weight: 700; }
.step-line { flex: 1; height: 2px; background: #e2e8f0; min-width: 32px; }
.step-line.done { background: #16a34a; }

/* ── Rate Display ───────────────────────────────────────────── */
.rate-display .rate-amount {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.rate-display .rate-label { font-size: .85rem; color: #64748b; margin-top: 4px; }
.rate-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rate-info-item { background: #f8faff; border-radius: 8px; padding: 10px 12px; }
.ri-label { font-size: .72rem; color: #94a3b8; font-weight: 600; }
.ri-value { font-size: .85rem; font-weight: 600; color: #1e293b; display: block; margin-top: 2px; }

/* ── Wallet ─────────────────────────────────────────────────── */
.wallet-qr-wrapper {
  display: inline-flex;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
  border: 2px solid var(--blue-100);
}
.wallet-qr-wrapper img, .wallet-qr-wrapper canvas { display: block; }
.wallet-address-box {
  background: #f8faff;
  border: 1px solid var(--blue-100);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.wallet-addr { font-family: monospace; font-size: .8rem; word-break: break-all; color: #1e293b; }

/* ── Profile Avatar ─────────────────────────────────────────── */
.profile-avatar {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--primary), #2563eb);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  margin: 0 auto 8px;
}

/* ── Token Tracker ──────────────────────────────────────────── */
.track-timeline { display: flex; flex-direction: column; gap: 12px; }
.timeline-step {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #94a3b8;
  font-size: .85rem;
}
.timeline-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #e2e8f0;
  flex-shrink: 0;
}
.timeline-step.active .timeline-dot { background: currentColor; }

/* ── Quick Actions ──────────────────────────────────────────── */
.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  color: #374151;
  transition: all .15s;
}
.quick-action-btn:hover { background: var(--blue-50); border-color: #bfdbfe; color: var(--primary); }
.quick-action-btn.btn-whatsapp { border-color: #bbf7d0; color: #16a34a; }
.quick-action-btn.btn-whatsapp:hover { background: #f0fdf4; }

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}

/* ── Misc ───────────────────────────────────────────────────── */
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }

/* ── Sidebar Overlay (mobile) ───────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}
.sidebar-close { display: none; color: #94a3b8; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .main-wrapper { margin-left: 0; }
  .sidebar {
    transform: translateX(-100%);
    z-index: 1050;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }
  .sidebar-close { display: block; }
  .main-content { padding: 16px; }
  .topbar { padding: 0 16px; }
}

/* ── Dark Mode ──────────────────────────────────────────────── */
[data-bs-theme="dark"] {
  --bs-body-bg: #0f172a;
  --bs-body-color: #e2e8f0;
  --bs-card-bg: #1e293b;
  --bs-border-color: #334155;
}
[data-bs-theme="dark"] .stat-card    { background: #1e293b; border-color: #334155; }
[data-bs-theme="dark"] .topbar       { background: #1e293b; border-color: #334155; }
[data-bs-theme="dark"] .main-footer  { background: #1e293b; border-color: #334155; }
[data-bs-theme="dark"] .quick-action-btn { background: #1e293b; border-color: #334155; color: #e2e8f0; }
[data-bs-theme="dark"] .rate-info-item   { background: #0f172a; }
[data-bs-theme="dark"] .wallet-address-box { background: #1e293b; }
[data-bs-theme="dark"] body          { background: #0f172a; }
[data-bs-theme="dark"] .auth-card    { background: #1e293b; }
