/* ==========================================================================
   Nappay Web — CSS tự chứa (không phụ thuộc CDN ngoài)
   Thay thế Bootstrap/CoreUI CDN để trang luôn hiển thị đúng dù VPS/trình
   duyệt không ra được internet tới cdn.jsdelivr.net.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  color: #212529;
  background-color: #f4f5f7;
  line-height: 1.5;
}

a { color: #321fdb; text-decoration: none; }
a:hover { text-decoration: underline; }
.text-decoration-none, .text-decoration-none:hover { text-decoration: none; }

h4 { font-weight: 700; margin: 0 0 .5rem; }

/* ---------- Layout: flex / grid ---------- */
.d-flex { display: flex; }
.flex-fill { flex: 1 1 auto; }
.flex-column { flex-direction: column; }
.align-middle { vertical-align: middle; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }

.row { display: flex; flex-wrap: wrap; margin: 0 -.5rem; }
.row > [class^="col-"] { padding: 0 .5rem; margin-bottom: 1rem; }
.col-auto { flex: 0 0 auto; }
.col-md-3 { flex: 0 0 25%; max-width: 25%; }
.col-md-4 { flex: 0 0 33.3333%; max-width: 33.3333%; }
@media (max-width: 768px) {
  .col-md-3, .col-md-4 { flex: 0 0 100%; max-width: 100%; }
}
.g-2 > * { margin-right: .5rem; }
.g-3 > * { margin-right: .75rem; }

/* ---------- Spacing utilities ---------- */
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.px-3 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.py-3 { padding-top: 1rem; padding-bottom: 1rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .25rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: 1rem; }
.me-2 { margin-right: .5rem; }
.me-3 { margin-right: 1rem; }
.ms-auto { margin-left: auto; }
.h-100 { height: 100%; }
.w-100 { width: 100%; }

/* ---------- Colors / backgrounds ---------- */
.bg-body-tertiary { background-color: #f4f5f7; }
.bg-dark { background-color: #1a1d29 !important; }
.bg-primary { background-color: #321fdb !important; }
.bg-white { background-color: #fff !important; }
.text-white { color: #fff !important; }
.text-muted, .text-body-secondary { color: #6b7785 !important; }
.text-success { color: #2eb85c !important; }
.text-danger { color: #e55353 !important; }
.text-warning { color: #f9b115 !important; }
.text-center { text-align: center; }
.small { font-size: .85rem; }
.fs-4 { font-size: 1.5rem; }
.fs-5 { font-size: 1.15rem; }
.fw-bold { font-weight: 700; }
.rounded { border-radius: .375rem; }
.border-bottom { border-bottom: 1px solid #dee2e6; }
.shadow-sm { box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.disabled { opacity: .55; pointer-events: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-weight: 500;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  border: 1px solid transparent;
  padding: .5rem 1rem;
  font-size: .95rem;
  border-radius: .375rem;
  background: #e9ecef;
  color: #212529;
  transition: filter .1s ease;
}
.btn:hover { filter: brightness(0.95); text-decoration: none; }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; }
.btn-primary { background: #321fdb; border-color: #321fdb; color: #fff; }
.btn-success { background: #2eb85c; border-color: #2eb85c; color: #fff; }
.btn-outline-primary { background: transparent; border-color: #321fdb; color: #321fdb; }
.btn-outline-success { background: transparent; border-color: #2eb85c; color: #2eb85c; }
.btn-outline-danger { background: transparent; border-color: #e55353; color: #e55353; }
.btn-outline-warning { background: transparent; border-color: #f9b115; color: #b8850c; }
.btn-link { background: none; border: none; color: #321fdb; padding: 0; }

/* ---------- Forms ---------- */
.form-label { display: block; margin-bottom: .35rem; font-weight: 500; font-size: .9rem; }
.form-control, .form-select {
  display: block;
  width: 100%;
  padding: .5rem .75rem;
  font-size: .95rem;
  border: 1px solid #ced4da;
  border-radius: .375rem;
  background-color: #fff;
  color: #212529;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: #321fdb;
  box-shadow: 0 0 0 .2rem rgba(50,31,219,.15);
}
.form-control-sm, .form-select-sm { padding: .3rem .5rem; font-size: .82rem; }

/* ---------- Card ---------- */
.card {
  background: #fff;
  border: 1px solid #e4e7eb;
  border-radius: .5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card-body { padding: 1.25rem; }
.card-header {
  padding: .85rem 1.25rem;
  background: #f8f9fa;
  border-bottom: 1px solid #e4e7eb;
  font-weight: 600;
  border-radius: .5rem .5rem 0 0;
}

/* ---------- Alerts ---------- */
.alert { padding: .65rem 1rem; border-radius: .375rem; margin-bottom: .75rem; border: 1px solid transparent; }
.alert-success { background: #d4edda; border-color: #c3e6cb; color: #155724; }
.alert-danger  { background: #f8d7da; border-color: #f5c6cb; color: #721c24; }
.alert-warning { background: #fff3cd; border-color: #ffeeba; color: #856404; }
.alert-info    { background: #d1ecf1; border-color: #bee5eb; color: #0c5460; }

/* ---------- Badge ---------- */
.badge { display: inline-block; padding: .25em .55em; font-size: .75em; font-weight: 700; border-radius: .35rem; color: #fff; }

/* ---------- Table ---------- */
.table-responsive { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .65rem .85rem; border-bottom: 1px solid #e9ecef; text-align: left; }
.table thead th { background: #f8f9fa; font-weight: 600; font-size: .85rem; color: #495057; }
.table-borderless th, .table-borderless td { border: none; }

/* ---------- Nav / Navbar / Sidebar ---------- */
.nav { list-style: none; margin: 0; padding: 0; }
.nav-item { margin: 0; }
.nav-link {
  display: block;
  padding: .55rem .9rem;
  border-radius: .375rem;
  color: inherit;
}
.nav-link:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.navbar {
  display: flex;
  align-items: center;
  min-height: 56px;
}
.navbar-expand { flex-wrap: nowrap; }

/* ---------- Pagination ---------- */
.pagination { display: flex; list-style: none; padding: 0; margin: 0; gap: .25rem; }
.page-item .page-link {
  display: block;
  padding: .4rem .75rem;
  border: 1px solid #dee2e6;
  border-radius: .375rem;
  color: #321fdb;
}
.page-item.disabled .page-link { color: #6b7785; background: #f8f9fa; }

/* ---------- App-specific ---------- */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.brand-logo { font-weight: 700; font-size: 1.4rem; color: #321fdb; }
.sidebar-brand { font-weight: 700; letter-spacing: .5px; }

.card-service {
  border: none;
  border-radius: .75rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
  transition: transform .15s ease;
}
.card-service:hover { transform: translateY(-3px); }

.balance-badge { font-size: 1.1rem; font-weight: 600; }

.status-pending { color: #f9b115; }
.status-success { color: #2eb85c; }
.status-failed, .status-wrong_value { color: #e55353; }
.status-canceled { color: #6b7785; }

.result-card-item {
  border: 1px dashed #321fdb;
  border-radius: .5rem;
  padding: .75rem 1rem;
  margin-bottom: .5rem;
  background: #f4f3fd;
}

/* ---------- Sidebar icon thay thế cho font icon CDN ---------- */
[class^="cil-"], [class*=" cil-"] {
  display: inline-block;
  width: 1.1em;
  text-align: center;
}
.cil-speedometer::before      { content: "\25A3"; }
.cil-credit-card::before      { content: "\1F4B3"; }
.cil-swap-horizontal::before  { content: "\21C4"; }
.cil-mobile::before            { content: "\1F4F1"; }
.cil-history::before           { content: "\23F1"; }
.cil-wallet::before             { content: "\1F45B"; }
.cil-people::before             { content: "\1F465"; }
.cil-list::before               { content: "\2261"; }
.cil-settings::before           { content: "\2699"; }
