/* ============================================================
   Bridge Pay Solution — Merchant Portal Styles (portal.css)
   Builds on the design tokens defined in styles.css
   ============================================================ */

body.portal {
  background: var(--bg-soft);
  min-height: 100vh;
}

/* ── Shared helpers ── */
.muted { color: var(--text-muted); }
.center { text-align: center; }
.hidden { display: none !important; }
.mono {
  font-family: ui-monospace, 'SFMono-Regular', 'Menlo', 'Consolas', monospace;
  font-size: 0.85rem;
}

/* ── Toast ── */
.toast-wrap {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--card-shadow-hover);
  font-size: 0.9rem;
  font-weight: 500;
  max-width: 320px;
  animation: toastIn 0.3s ease;
}
.toast.success { background: var(--emerald); }
.toast.error { background: var(--rose); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   AUTH (login / register)
   ============================================================ */
.auth-wrap {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 100vh;
}
.auth-aside {
  background: var(--grad-hero);
  color: #fff;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-aside::after {
  content: '';
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  bottom: -160px;
  right: -120px;
}
.auth-aside .logo { color: #fff; font-weight: 700; font-size: 1.15rem; gap: 0.6rem; display: inline-flex; align-items: center; }
.auth-aside h2 { color: #fff; font-size: 2rem; line-height: 1.2; }
.auth-aside p { color: rgba(255, 255, 255, 0.85); margin-top: 0.75rem; }
.auth-points { margin-top: 1.5rem; display: grid; gap: 0.85rem; position: relative; z-index: 1; }
.auth-points li { display: flex; align-items: center; gap: 0.65rem; color: rgba(255,255,255,0.92); }
.auth-points li span.tick {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,0.2); display: grid; place-items: center; flex: 0 0 auto;
}
.auth-demo {
  position: relative; z-index: 1;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem; font-size: 0.85rem;
}
.auth-demo b { display: block; margin-bottom: 0.25rem; }

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
}
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.8rem; }
.auth-card > p.sub { color: var(--text-muted); margin: 0.4rem 0 1.75rem; }

.tabs { display: flex; gap: 0.5rem; background: var(--bg-muted); padding: 0.35rem; border-radius: 999px; margin-bottom: 1.5rem; }
.tabs button {
  flex: 1; border: 0; background: transparent; padding: 0.6rem; border-radius: 999px;
  font: inherit; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: var(--transition);
}
.tabs button.active { background: #fff; color: var(--primary); box-shadow: var(--card-shadow); }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 0.4rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.75rem 0.9rem; border: 1.5px solid var(--card-border);
  border-radius: var(--radius-sm); font: inherit; color: var(--text); background: #fff; transition: var(--transition);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.12);
}
.field .hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }
.checkbox-row { display: flex; align-items: center; gap: 0.55rem; font-size: 0.88rem; }
.checkbox-row input { width: auto; }

.form-error {
  background: rgba(244, 63, 94, 0.08); color: var(--rose); border: 1px solid rgba(244,63,94,0.25);
  border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; font-size: 0.85rem; margin-bottom: 1rem;
}
.btn-block { width: 100%; justify-content: center; }
.auth-foot { margin-top: 1.25rem; text-align: center; font-size: 0.88rem; color: var(--text-muted); }
.auth-foot a { color: var(--primary); font-weight: 600; }

/* ============================================================
   DASHBOARD shell
   ============================================================ */
.app-shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }

.sidebar {
  background: #fff;
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .logo { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; color: var(--text); padding: 0.25rem 0.5rem 1.25rem; }
.side-nav { display: grid; gap: 0.25rem; flex: 1; }
.side-nav a {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.85rem; border-radius: var(--radius-sm);
  color: var(--text-body); font-weight: 500; font-size: 0.92rem; cursor: pointer; transition: var(--transition);
}
.side-nav a:hover { background: var(--bg-soft); }
.side-nav a.active { background: var(--bg-muted); color: var(--primary); font-weight: 600; }
.side-nav a svg { width: 18px; height: 18px; flex: 0 0 auto; }
.side-foot { border-top: 1px solid var(--card-border); padding-top: 0.9rem; }
.side-user { display: flex; align-items: center; gap: 0.65rem; padding: 0.5rem; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--grad-primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; flex: 0 0 auto;
}
.side-user .meta { overflow: hidden; }
.side-user .meta b { display: block; font-size: 0.88rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .meta span { font-size: 0.78rem; color: var(--text-muted); }

.app-main { padding: 1.5rem 2rem 3rem; max-width: 1200px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.75rem; gap: 1rem; flex-wrap: wrap; }
.topbar h1 { font-size: 1.6rem; }
.topbar .sub { color: var(--text-muted); font-size: 0.9rem; }
.mobile-bar { display: none; }

.view { display: none; }
.view.active { display: block; animation: fadeUp 0.35s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Cards / stats ── */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.scard {
  background: #fff; border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--card-shadow);
}
.scard .scard-label { color: var(--text-muted); font-size: 0.82rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.scard .scard-value { font-size: 1.7rem; font-weight: 800; color: var(--text); margin-top: 0.5rem; letter-spacing: -0.02em; }
.scard .scard-sub { font-size: 0.8rem; margin-top: 0.3rem; }
.scard .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 0.9rem; }
.ic.violet { background: var(--primary); }
.ic.green { background: var(--emerald); }
.ic.amber { background: var(--amber); }
.ic.rose { background: var(--rose); }

.panel {
  background: #fff; border: 1px solid var(--card-border); border-radius: var(--radius);
  box-shadow: var(--card-shadow); margin-bottom: 1.5rem; overflow: hidden;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--card-border); gap: 1rem; flex-wrap: wrap; }
.panel-head h3 { font-size: 1.05rem; }
.panel-body { padding: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }

/* ── Chart ── */
.bars { display: flex; align-items: flex-end; gap: 0.6rem; height: 180px; padding-top: 1rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; max-width: 46px; background: var(--grad-primary); border-radius: 8px 8px 0 0;
  min-height: 4px; transition: height 0.6s cubic-bezier(0.4,0,0.2,1); position: relative;
}
.bar-col .bar-label { font-size: 0.75rem; color: var(--text-muted); }

/* ── Method breakdown ── */
.method-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.9rem; }
.method-row .mname { width: 60px; font-size: 0.85rem; font-weight: 600; color: var(--text); }
.method-track { flex: 1; height: 8px; background: var(--bg-muted); border-radius: 999px; overflow: hidden; }
.method-fill { height: 100%; border-radius: 999px; background: var(--grad-cool); }
.method-row .mval { font-size: 0.82rem; color: var(--text-muted); width: 90px; text-align: right; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th {
  text-align: left; padding: 0.75rem 1rem; color: var(--text-muted); font-weight: 600; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--card-border); white-space: nowrap;
}
table.data td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--bg-muted); color: var(--text-body); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--bg-soft); }
.cell-strong { color: var(--text); font-weight: 600; }

.badge {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.6rem; border-radius: 999px;
  font-size: 0.74rem; font-weight: 700; text-transform: capitalize;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.success { background: rgba(16,185,129,0.12); color: #059669; }
.badge.pending { background: rgba(245,158,11,0.14); color: #b45309; }
.badge.failed  { background: rgba(244,63,94,0.12); color: #e11d48; }
.badge.active  { background: rgba(16,185,129,0.12); color: #059669; }
.badge.disabled { background: rgba(107,114,128,0.14); color: #4b5563; }

.method-chip { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.82rem; }
.method-dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-bKash { background: #e2136e; }
.dot-Nagad { background: #f15a23; }
.dot-Rocket { background: #8c3494; }
.dot-Upay { background: #ed1c24; }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty .big { font-size: 2rem; margin-bottom: 0.5rem; }

/* ── Filters ── */
.filters { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.filters input, .filters select {
  padding: 0.55rem 0.75rem; border: 1.5px solid var(--card-border); border-radius: var(--radius-sm);
  font: inherit; font-size: 0.85rem; background: #fff; color: var(--text);
}
.filters input:focus, .filters select:focus { outline: none; border-color: var(--primary); }

/* ── API keys ── */
.key-row {
  display: flex; align-items: center; gap: 0.75rem; background: var(--bg-soft);
  border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 0.75rem 1rem; margin-bottom: 0.85rem;
}
.key-row .key-label { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); width: 90px; flex: 0 0 auto; text-transform: uppercase; }
.key-row code { flex: 1; overflow-x: auto; white-space: nowrap; color: var(--text); }
.icon-btn {
  border: 1px solid var(--card-border); background: #fff; border-radius: 8px; padding: 0.4rem 0.6rem;
  cursor: pointer; font-size: 0.8rem; color: var(--text-body); transition: var(--transition);
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── Payment link cards ── */
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.link-card {
  background: #fff; border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--card-shadow); display: flex; flex-direction: column; gap: 0.5rem;
}
.link-card h4 { font-size: 1.02rem; color: var(--text); }
.link-card .amt { font-size: 1.35rem; font-weight: 800; color: var(--primary); }
.link-card .desc { font-size: 0.85rem; color: var(--text-muted); min-height: 1.2rem; }
.link-card .url-box { display: flex; gap: 0.4rem; margin-top: 0.35rem; }
.link-card .url-box input { flex: 1; padding: 0.5rem 0.65rem; border: 1.5px solid var(--card-border); border-radius: 8px; font-size: 0.78rem; color: var(--text-body); background: var(--bg-soft); }
.link-card .stats { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--text-muted); }
.link-card .card-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(30,27,75,0.45); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 200; padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius); width: 100%; max-width: 440px; box-shadow: var(--card-shadow-hover);
  animation: fadeUp 0.3s ease; max-height: 92vh; overflow-y: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--card-border); }
.modal-head h3 { font-size: 1.1rem; }
.modal-body { padding: 1.25rem; }
.modal-foot { padding: 1rem 1.25rem; border-top: 1px solid var(--card-border); display: flex; justify-content: flex-end; gap: 0.6rem; }
.close-x { border: 0; background: transparent; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--text-muted); }

/* ============================================================
   HOSTED CHECKOUT (pay.html)
   ============================================================ */
.checkout-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: var(--grad-hero); }
.checkout-card { width: 100%; max-width: 460px; background: #fff; border-radius: var(--radius); box-shadow: var(--card-shadow-hover); overflow: hidden; }
.checkout-head { padding: 1.5rem; border-bottom: 1px solid var(--card-border); }
.checkout-head .merchant { display: flex; align-items: center; gap: 0.65rem; }
.checkout-head .merchant .avatar { width: 34px; height: 34px; font-size: 0.85rem; }
.checkout-head .merchant b { color: var(--text); }
.checkout-amount { text-align: center; padding: 1.75rem 1.5rem; }
.checkout-amount .label { color: var(--text-muted); font-size: 0.85rem; }
.checkout-amount .value { font-size: 2.4rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.checkout-amount .item { color: var(--text-muted); margin-top: 0.25rem; }
.checkout-body { padding: 0 1.5rem 1.5rem; }
.method-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; margin: 0.5rem 0 1rem; }
.method-opt {
  border: 1.5px solid var(--card-border); border-radius: var(--radius-sm); padding: 0.75rem; cursor: pointer;
  display: flex; align-items: center; gap: 0.55rem; font-weight: 600; font-size: 0.9rem; transition: var(--transition); background: #fff;
}
.method-opt:hover { border-color: var(--primary); }
.method-opt.selected { border-color: var(--primary); background: var(--bg-muted); box-shadow: 0 0 0 3px rgba(109,40,217,0.1); }
.secure-note { display: flex; align-items: center; justify-content: center; gap: 0.4rem; color: var(--text-muted); font-size: 0.8rem; margin-top: 1rem; }
.pay-result { text-align: center; padding: 2rem 1.5rem; }
.pay-result .big-ic { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 1rem; font-size: 2rem; color: #fff; }
.pay-result.success .big-ic { background: var(--emerald); }
.pay-result.pending .big-ic { background: var(--amber); }
.pay-result.failed .big-ic { background: var(--rose); }
.receipt { background: var(--bg-soft); border-radius: var(--radius-sm); padding: 1rem 1.25rem; margin: 1.25rem 0; text-align: left; }
.receipt-row { display: flex; justify-content: space-between; padding: 0.35rem 0; font-size: 0.88rem; }
.receipt-row span:first-child { color: var(--text-muted); }

/* ============================================================
   API DOCS (api.html)
   ============================================================ */
.docs-shell { display: grid; grid-template-columns: 240px 1fr; max-width: 1200px; margin: 0 auto; gap: 2rem; padding: 7rem 1.5rem 4rem; }
.docs-nav { position: sticky; top: 6rem; align-self: start; display: grid; gap: 0.2rem; height: max-content; }
.docs-nav a { padding: 0.5rem 0.75rem; border-radius: 8px; color: var(--text-body); font-size: 0.9rem; }
.docs-nav a:hover { background: var(--bg-muted); color: var(--primary); }
.docs-nav .grp { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 700; margin: 1rem 0 0.35rem; padding: 0 0.75rem; }
.docs-content h2 { font-size: 1.6rem; margin: 2.5rem 0 0.75rem; scroll-margin-top: 6rem; }
.docs-content h2:first-child { margin-top: 0; }
.docs-content h3 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; scroll-margin-top: 6rem; }
.docs-content p { margin-bottom: 0.75rem; }
.endpoint { display: flex; align-items: center; gap: 0.65rem; background: var(--bg-soft); border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 0.65rem 0.9rem; margin: 0.75rem 0; font-family: ui-monospace, monospace; font-size: 0.88rem; }
.http-method { font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 6px; font-size: 0.75rem; color: #fff; }
.http-method.get { background: var(--emerald); }
.http-method.post { background: var(--primary); }
.http-method.delete { background: var(--rose); }
pre.code {
  background: #1e1b4b; color: #e9e7ff; border-radius: var(--radius-sm); padding: 1.1rem 1.25rem;
  overflow-x: auto; font-family: ui-monospace, monospace; font-size: 0.83rem; line-height: 1.6; margin: 0.75rem 0;
}
pre.code .tok-key { color: #a78bfa; }
pre.code .tok-str { color: #6ee7b7; }
.docs-content table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.88rem; }
.docs-content table th, .docs-content table td { text-align: left; padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--card-border); }
.docs-content table th { color: var(--text-muted); font-size: 0.8rem; }
.callout { background: var(--bg-muted); border-left: 3px solid var(--primary); border-radius: 0 8px 8px 0; padding: 0.85rem 1.1rem; margin: 1rem 0; font-size: 0.9rem; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .docs-shell { grid-template-columns: 1fr; }
  .docs-nav { display: none; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 150; width: 256px;
    transform: translateX(-100%); transition: transform 0.3s ease; box-shadow: var(--card-shadow-hover);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.85rem 1rem; background: #fff; border-bottom: 1px solid var(--card-border); position: sticky; top: 0; z-index: 100;
  }
  .mobile-bar .logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; color: var(--text); }
  .hammer { border: 0; background: transparent; font-size: 1.5rem; cursor: pointer; color: var(--text); }
  .app-main { padding: 1.25rem; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 140; display: none; }
  .scrim.open { display: block; }
}
@media (max-width: 520px) {
  .stat-cards { grid-template-columns: 1fr; }
  .method-picker { grid-template-columns: 1fr; }
}
