/* ═══════════════════════════════════════
   AMZ Manager — Base CSS
   Màu sắc, font, component chung
   ═══════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Be+Vietnam+Pro:wght@300;400;500;600&display=swap');

/* ── CSS Variables ── */
:root {
  --bg:       #07090c;
  --bg2:      #0d1017;
  --bg3:      #131820;
  --bg4:      #1a2230;
  --border:   #1c2738;
  --border2:  #283850;

  --text:     #d8e8f8;
  --muted:    #4a6a8a;
  --dim:      #1e2d40;

  --green:    #22c55e;  --gbg: #031508;  --gdim: #0a2e14;
  --red:      #f43f5e;  --rbg: #1a0508;
  --yellow:   #f59e0b;  --ybg: #1a1000;
  --blue:     #3b82f6;  --bbg: #050d20;
  --orange:   #f97316;  --obg: #180800;
  --purple:   #a855f7;  --pbg: #0e0520;
  --cyan:     #06b6d4;  --cbg: #01151c;
  --teal:     #14b8a6;

  --acc:  #22c55e;
  --acc2: #0ea5e9;

  --font-body: 'Be Vietnam Pro', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 12px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; }

/* ── Typography ── */
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--muted); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-yellow{ color: var(--yellow); }
.text-blue  { color: var(--blue); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: var(--radius-sm); border: none; font-size: 12px; font-weight: 500; transition: all .15s; user-select: none; white-space: nowrap; }
.btn-primary   { background: var(--acc); color: #000; font-weight: 600; }
.btn-primary:hover { opacity: .85; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border2); }
.btn-danger    { background: var(--rbg); color: var(--red); border: 1px solid #4a1020; }
.btn-danger:hover { background: #200608; }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 500; font-family: var(--font-mono); white-space: nowrap; }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }

.badge-live   { background: var(--gbg); color: var(--green); border: 1px solid var(--gdim); }
.badge-live::before { background: var(--green); }
.badge-die    { background: var(--rbg); color: var(--red);   border: 1px solid #4a1020; }
.badge-die::before { background: var(--red); }
.badge-wait   { background: var(--ybg); color: var(--yellow); border: 1px solid #3a2000; }
.badge-wait::before { background: var(--yellow); }
.badge-info   { background: var(--bbg); color: var(--blue);  border: 1px solid #0a1a3a; }
.badge-info::before { background: var(--blue); }
.badge-cancel { background: var(--obg); color: var(--orange); border: 1px solid #3a1800; }
.badge-cancel::before { background: var(--orange); }

/* ── Trust Chip ── */
.trust-chip { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.trust-num  { font-family: var(--font-mono); font-size: 13px; font-weight: 600; line-height: 1; }
.trust-lbl  { font-size: 9px; opacity: .7; font-family: var(--font-mono); }
.trust-bar  { width: 50px; height: 3px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
.trust-fill { height: 100%; border-radius: 2px; transition: width .4s; }
.trust-hot  { color: var(--green); } .trust-hot  .trust-fill { background: var(--green); }
.trust-mid  { color: var(--yellow);} .trust-mid  .trust-fill { background: var(--yellow);}
.trust-low  { color: var(--red);   } .trust-low  .trust-fill { background: var(--red);   }

/* ── Stage Chips ── */
.stage-chip { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-family: var(--font-mono); font-weight: 600; }
.stage-0 { background: #0a0a14; color: #4a5568; border: 1px solid #1a1a28; }
.stage-1 { background: var(--ybg); color: var(--yellow); border: 1px solid #3a2800; }
.stage-2 { background: var(--gbg); color: var(--green); border: 1px solid var(--gdim); }
.stage-3 { background: #031508; color: #4ade80; border: 1px solid #0a3018; box-shadow: 0 0 8px rgba(34,197,94,.15); }

/* ── Type Chips ── */
.type-chip    { display: inline-block; padding: 1px 7px; border-radius: 3px; font-size: 10px; font-family: var(--font-mono); font-weight: 500; }
.type-dao     { background: #120520; color: #c084fc; border: 1px solid #2d1050; }
.type-co      { background: #051505; color: #4ade80; border: 1px solid #143a14; }
.type-sdt     { background: #030d1a; color: #60a5fa; border: 1px solid #0d2540; }
.type-gmail   { background: #140800; color: #fb923c; border: 1px solid #301800; }
.type-hotmail { background: #0a1020; color: #94a3b8; border: 1px solid #1a2535; }

/* ── Cards ── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); }
.card-header { padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg3); border-radius: var(--radius) var(--radius) 0 0; display: flex; align-items: center; justify-content: space-between; }
.card-title { font-family: var(--font-mono); font-size: 11px; font-weight: 500; }
.card-body  { padding: 14px 16px; }

/* ── Table ── */
.table-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 7px 12px; text-align: left; font-size: 10px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-family: var(--font-mono); border-bottom: 1px solid var(--border); background: var(--bg3); white-space: nowrap; cursor: pointer; user-select: none; }
thead th:hover { color: var(--text); }
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg3); }
td { padding: 7px 12px; font-size: 12px; color: var(--text); vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
td.mono { font-family: var(--font-mono); font-size: 11px; }
.empty-row { padding: 32px; text-align: center; color: var(--muted); font-size: 13px; }

/* ── Pagination ── */
.paging { display: flex; align-items: center; padding: 8px 14px; border-top: 1px solid var(--border); gap: 8px; }
.pi { font-size: 11px; color: var(--muted); flex: 1; font-family: var(--font-mono); }
.prv, .nxt { padding: 3px 10px; border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 4px; font-size: 11px; font-family: var(--font-mono); }
.prv:hover:not(:disabled), .nxt:hover:not(:disabled) { border-color: var(--acc); color: var(--acc); }
.prv:disabled, .nxt:disabled { opacity: .3; cursor: not-allowed; }

/* ── Toolbar ── */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 160px; max-width: 280px; }
.search-wrap input { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px 6px 28px; color: var(--text); font-size: 12px; font-family: var(--font-body); outline: none; transition: border .15s; }
.search-wrap input:focus { border-color: var(--acc); }
.search-icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; pointer-events: none; }
.filter-group { display: flex; gap: 5px; flex-wrap: wrap; }
.fbtn { padding: 5px 10px; border-radius: 5px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-size: 10px; font-family: var(--font-mono); white-space: nowrap; user-select: none; transition: all .15s; }
.fbtn:hover { color: var(--text); border-color: var(--border2); }
.fbtn.active { background: var(--gbg); border-color: var(--gdim); color: var(--green); }
.fbtn.f-die.active    { background: var(--rbg); border-color: #4a1020; color: var(--red); }
.fbtn.f-wait.active   { background: var(--ybg); border-color: #3a2000; color: var(--yellow); }
.fbtn.f-info.active   { background: var(--bbg); border-color: #0a1a3a; color: var(--blue); }
select.fsel { background: var(--bg2); border: 1px solid var(--border); color: var(--muted); padding: 5px 8px; border-radius: 5px; font-size: 11px; font-family: var(--font-mono); outline: none; }

/* ── Bar Chart ── */
.bar-rows { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-label { font-size: 11px; color: var(--muted); width: 80px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 7px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 4px; transition: width .5s; }
.bar-val   { font-family: var(--font-mono); font-size: 11px; color: var(--text); width: 50px; text-align: right; flex-shrink: 0; }

/* ── KPI Card ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.kpi-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; position: relative; overflow: hidden; }
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.kpi-card.k-green::before  { background: var(--green); }
.kpi-card.k-red::before    { background: var(--red); }
.kpi-card.k-yellow::before { background: var(--yellow); }
.kpi-card.k-blue::before   { background: var(--blue); }
.kpi-card.k-purple::before { background: var(--purple); }
.kpi-card.k-cyan::before   { background: var(--cyan); }
.kpi-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-family: var(--font-mono); margin-bottom: 4px; }
.kpi-val   { font-size: 22px; font-weight: 600; font-family: var(--font-mono); line-height: 1.2; }
.kpi-sub   { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ── Section Title ── */
.section-title { font-family: var(--font-mono); font-size: 10px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Toast ── */
.toast { position: fixed; bottom: 20px; right: 20px; padding: 10px 16px; border-radius: var(--radius); font-size: 12px; font-family: var(--font-mono); opacity: 0; transform: translateY(10px); transition: all .25s; z-index: 9999; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-info    { background: var(--bbg); color: var(--blue); border: 1px solid #0a1a3a; }
.toast-success { background: var(--gbg); color: var(--green); border: 1px solid var(--gdim); }
.toast-error   { background: var(--rbg); color: var(--red); border: 1px solid #4a1020; }

/* ── Loading ── */
.loading { opacity: .5; pointer-events: none; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border2); border-top-color: var(--acc); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  td, th { padding: 6px 8px; }
}
