/* Merchantpayd design system - shared across admin, merchant, and agent
   dashboards. Loaded AFTER Bootstrap's CSS - Bootstrap stays for its JS
   components (modals, dropdowns, collapse) and grid utilities used
   throughout the app's existing pages; this file overrides Bootstrap's
   visual defaults and adds the sidebar shell structure. Existing
   Bootstrap classes (.card, .btn, .badge, .table, .row/.col-*, .modal,
   .form-control) still work exactly as before - their JS behavior is
   untouched, only their appearance changes. */

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

:root {
  --mp-bg: #F6F7F9;
  --mp-ink: #12151C;
  --mp-ink-soft: #62697A;
  --mp-line: #E4E7EC;
  --mp-card: #FFFFFF;
  --mp-accent: #0F8F6C;
  --mp-accent-soft: #E3F3EC;
  --mp-amber: #B5720A;
  --mp-amber-soft: #FBF0DD;
  --mp-red: #C13A3A;
  --mp-red-soft: #FBEAEA;
  --mp-gray-soft: #F0F1F3;
  --mp-gray-text: #4B5160;
  --mp-purple: #5B3FBF;
  --mp-purple-soft: #E9E4FB;
  --mp-usdc: #2775CA;
  --mp-usdc-soft: #E7F0FB;
  --mp-usdt: #1B9C77;
  --mp-usdt-soft: #E4F5EE;
  --mp-sidebar: #12151C;
  --mp-sidebar-line: #262B36;
  --mp-sidebar-text: #9AA1B2;
}

/* Blue theme - set by JS (see the shared applyTheme() pattern each page's
   loadConfig() calls) as data-theme="blue" on <html>, based on
   THEME_COLOR from backend/.env (via GET /public-config). Only the
   accent variables change - the dark sidebar/background stay the same
   regardless of theme, matching how this was actually asked for
   ("dark with green... adding blue instead"). Deliberately a different
   blue from --mp-usdc above (which specifically marks USDC-currency
   badges) - close hues there would make the accent color look like it
   means "USDC" rather than just being this deployment's theme. */
[data-theme="blue"] {
  --mp-accent: #2563EB;
  --mp-accent-soft: #E4ECFD;
}

body {
  font-family: 'Inter', -apple-system, sans-serif !important;
  background: var(--mp-bg) !important;
  color: var(--mp-ink) !important;
  -webkit-font-smoothing: antialiased;
}
.mp-mono { font-family: 'JetBrains Mono', monospace; }
code, .font-monospace { font-family: 'JetBrains Mono', monospace !important; }

/* ---------- Shell layout ---------- */
.mp-shell { display: flex; min-height: 100vh; }
.mp-sidebar {
  width: 244px; flex-shrink: 0; background: var(--mp-sidebar); padding: 20px 14px;
  display: flex; flex-direction: column; position: fixed; left: 0; top: 0; height: 100vh;
  height: 100dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; z-index: 1030;
  /* Firefox */
  scrollbar-width: thin; scrollbar-color: #3A4050 transparent;
}
/* A visible (if subtle) scrollbar specifically on the sidebar - without
   this, whether an overflowing sidebar even LOOKS scrollable depends
   entirely on the OS/browser's own scrollbar visibility settings (many
   default to hidden-until-hover or hidden entirely), which is very
   likely why this looked broken even though the underlying overflow/
   scroll mechanism was working - there was nothing telling the person
   there was more to scroll to. Chrome/Safari (WebKit) */
.mp-sidebar::-webkit-scrollbar { width: 6px; }
.mp-sidebar::-webkit-scrollbar-track { background: transparent; }
.mp-sidebar::-webkit-scrollbar-thumb { background: #3A4050; border-radius: 3px; }
/* Now position:fixed (taken out of .mp-shell's own flex flow entirely,
   unlike the old position:sticky), so .mp-main needs its own explicit
   space reserved for the sidebar's width instead of relying on flex
   layout to do it - see .mp-main's own rule below. */
.mp-brand { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 22px; }
.mp-brand-left { display: flex; align-items: center; gap: 9px; }
.mp-brand-mark {
  width: 26px; height: 26px; border-radius: 6px; background: var(--mp-accent);
  display: flex; align-items: center; justify-content: center; font-weight: 600;
  font-size: 13px; color: #fff; flex-shrink: 0;
}
.mp-brand-name { color: #fff; font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; }
.mp-nav-close { display: none; background: none; border: none; color: var(--mp-sidebar-text); font-size: 20px; cursor: pointer; padding: 2px 6px; }
.mp-nav-group-label { color: #565D6E; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 16px 10px 6px; }
.mp-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px;
  color: var(--mp-sidebar-text) !important; font-size: 13.5px; font-weight: 500; cursor: pointer;
  margin-bottom: 1px; text-decoration: none !important;
}
.mp-nav-item svg { width: 16px; height: 16px; opacity: 0.85; flex-shrink: 0; }
.mp-nav-item.active { background: #1D2129; color: #fff !important; }
.mp-nav-item.active svg { opacity: 1; color: var(--mp-accent); }
.mp-nav-item .mp-count { margin-left: auto; background: var(--mp-red); color: #fff; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 20px; }
.mp-sidebar-foot {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--mp-sidebar-line);
  display: flex; align-items: center; gap: 9px;
  position: sticky; bottom: 0; background: var(--mp-sidebar); padding-bottom: 6px;
}
.mp-avatar { width: 28px; height: 28px; border-radius: 50%; background: #2A3040; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600; color: #fff; flex-shrink: 0; }
.mp-sidebar-foot-name { color: #fff; font-size: 12.5px; font-weight: 500; }
.mp-sidebar-foot-role { color: #6B7285; font-size: 11px; }

.mp-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1025; }
.mp-backdrop.open { display: block; }

.mp-main { flex: 1; min-width: 0; margin-left: 244px; padding: 26px 34px 60px; }
.mp-mobile-topbar { display: none; align-items: center; gap: 12px; margin-bottom: 18px; }
.mp-hamburger { background: var(--mp-card); border: 1px solid var(--mp-line); border-radius: 8px; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.mp-page-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.mp-page-sub { color: var(--mp-ink-soft); font-size: 13px; margin: 3px 0 0; }

@media (max-width: 900px) {
  .mp-sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.2s ease; }
  .mp-sidebar.open { transform: translateX(0); }
  .mp-nav-close { display: block; }
  .mp-main { margin-left: 0; padding: 18px 18px 48px; }
  .mp-mobile-topbar { display: flex; }
}

/* ---------- Cards (restyles Bootstrap's .card) ---------- */
.card {
  background: var(--mp-card) !important; border: 1px solid var(--mp-line) !important;
  border-radius: 10px !important; box-shadow: none !important;
}
.card-body { padding: 16px 18px !important; }

/* ---------- Stat cards ---------- */
.mp-stat-label { color: var(--mp-ink-soft); font-size: 12.5px; font-weight: 500; margin-bottom: 8px; }
.mp-stat-value { font-size: 23px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.mp-stat-value.success { color: var(--mp-accent); }

/* ---------- Badges (restyles Bootstrap's .badge, keeps class names working) ---------- */
.badge { font-weight: 500 !important; border-radius: 20px !important; padding: 5px 11px !important; font-size: 12.5px !important; }
.text-bg-success, .badge.bg-success { background: var(--mp-accent-soft) !important; color: var(--mp-accent) !important; }
.text-bg-warning, .badge.bg-warning { background: var(--mp-amber-soft) !important; color: var(--mp-amber) !important; }
.text-bg-danger, .badge.bg-danger { background: var(--mp-red-soft) !important; color: var(--mp-red) !important; }
.text-bg-secondary, .badge.bg-secondary { background: var(--mp-gray-soft) !important; color: var(--mp-gray-text) !important; }
.text-bg-dark, .badge.bg-dark { background: var(--mp-purple-soft) !important; color: var(--mp-purple) !important; }
.text-bg-info, .badge.bg-info { background: var(--mp-usdc-soft) !important; color: var(--mp-usdc) !important; }
.text-bg-light, .badge.border { background: var(--mp-gray-soft) !important; color: var(--mp-gray-text) !important; border: none !important; }

/* Chain/commodity chips - USDC/USDT specifically, distinct from generic status badges above */
.mp-chip-usdc { background: var(--mp-usdc-soft); color: var(--mp-usdc); font-size: 11.5px; font-weight: 500; padding: 3px 9px; border-radius: 20px; }
.mp-chip-usdt { background: var(--mp-usdt-soft); color: var(--mp-usdt); font-size: 11.5px; font-weight: 500; padding: 3px 9px; border-radius: 20px; }

/* ---------- Buttons (restyles Bootstrap's .btn) ---------- */
.btn { border-radius: 8px !important; font-weight: 500 !important; font-size: 13px !important; }
.btn-dark { background: var(--mp-ink) !important; border-color: var(--mp-ink) !important; }
.btn-outline-secondary, .btn-outline-dark { border-color: var(--mp-line) !important; color: var(--mp-ink) !important; }
.btn-outline-secondary:hover, .btn-outline-dark:hover { background: var(--mp-gray-soft) !important; }
.btn-outline-success { border-color: var(--mp-accent) !important; color: var(--mp-accent) !important; }
.btn-outline-danger { border-color: var(--mp-red) !important; color: var(--mp-red) !important; }
.btn-primary { background: var(--mp-accent) !important; border-color: var(--mp-accent) !important; }

/* ---------- Tables ---------- */
.table { font-size: 13px; }
.table thead th {
  font-size: 11.5px !important; font-weight: 600 !important; color: var(--mp-ink-soft) !important;
  text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--mp-line) !important;
  border-top: none !important; background: transparent !important;
}
.table td { border-bottom: 1px solid var(--mp-line) !important; vertical-align: middle; }
.table-light { background: transparent !important; }

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-color: var(--mp-line) !important; border-radius: 7px !important; font-size: 13px !important;
}
.form-control:focus, .form-select:focus {
  border-color: var(--mp-accent) !important; box-shadow: 0 0 0 3px var(--mp-accent-soft) !important;
}

/* ---------- Utility ---------- */
.mp-panel-title { font-size: 14.5px; font-weight: 600; margin: 0 0 4px; }
.mp-panel-sub { font-size: 12px; color: var(--mp-ink-soft); margin: 0 0 12px; }

/* Card-wrapped links (e.g. dashboard quick-link tiles) - the whole card
   is clickable via an <a>, but should read as a card, not a text link */
a.text-decoration-none, a.text-decoration-none:hover {
  color: inherit !important; text-decoration: none !important;
}
