/* ===== 1. Biến & reset ===== */
:root {
  --bg: #f3f7ff; --card: rgba(255, 255, 255, .94); --text: #17203a; --muted: #5b6785;
  --blue: #2563eb; --dark: #0f172a; --red: #dc2626; --green: #16a34a; --radius: 14px;
  --argb: linear-gradient(90deg, #ff0080, #ff8c00, #40e000, #00d0ff, #8000ff, #ff0080);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font-family: 'Segoe UI', Arial, sans-serif; }
a { color: var(--blue); text-decoration: none; }
main { flex: 1; width: 100%; max-width: 1150px; margin: 24px auto; padding: 0 16px; }
h1, h2, h3 { margin-top: 0; }
.hidden { display: none !important; }
#matrix { position: fixed; inset: 0; z-index: -1; }

/* ===== 2. Hiệu ứng ARGB ===== */
@keyframes argb-move { to { background-position: 300% 0; } }
.argb-text { background: var(--argb); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: argb-move 4s linear infinite; }
.argb-border { border: 2px solid transparent; background: linear-gradient(var(--card), var(--card)) padding-box, var(--argb) border-box; background-size: 100% 100%, 300% 100%; animation: argb-move 6s linear infinite; }

/* ===== 3. Header / Footer ===== */
.header { background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border-bottom: 3px solid transparent; border-image: var(--argb) 1; position: sticky; top: 0; z-index: 20; }
.header-inner { max-width: 1150px; margin: auto; padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.logo { font-size: 28px; font-weight: 900; letter-spacing: 3px; filter: drop-shadow(0 0 6px rgba(255, 0, 200, .45)); }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a { color: var(--text); padding: 7px 12px; border-radius: 8px; font-weight: 600; }
.nav a:hover { background: #e4ecff; }
.search { display: flex; flex: 1; min-width: 160px; max-width: 280px; }
.search input { margin: 0; }
.user-box { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.balance { color: var(--green); font-weight: 700; }
.footer { background: var(--dark); color: #cbd5e1; padding: 24px 16px; text-align: center; font-size: 14px; }

/* ===== 4. Thành phần chung ===== */
.btn { cursor: pointer; border: 0; border-radius: 9px; padding: 9px 16px; font: inherit; font-weight: 600; color: #fff; background: var(--blue); transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(37, 99, 235, .4); }
.btn.argb { background: var(--argb); background-size: 300% 100%; animation: argb-move 5s linear infinite; text-shadow: 0 1px 2px #0006; }
.btn.red { background: var(--red); } .btn.gray { background: #64748b; } .btn.green { background: var(--green); } .btn.small { padding: 5px 10px; font-size: 13px; }
input, select, textarea { width: 100%; padding: 10px; margin: 6px 0; border: 1px solid #bcc7e0; border-radius: 9px; font: inherit; background: #fff; }
label { font-size: 14px; font-weight: 600; }
.box { background: var(--card); border-radius: var(--radius); box-shadow: 0 2px 14px #0002; padding: 18px; margin-bottom: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px; border-bottom: 1px solid #e2e8f4; text-align: left; vertical-align: middle; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs button { cursor: pointer; border: 0; padding: 9px 16px; border-radius: 9px; font-weight: 600; background: #e4ecff; color: var(--text); }
.tabs button.active { background: var(--argb); background-size: 300% 100%; animation: argb-move 5s linear infinite; color: #fff; }
.badge { padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: #e2e8f4; }
.badge.approved, .badge.active, .badge.completed { background: #dcfce7; color: #166534; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.rejected, .badge.locked, .badge.hidden { background: #fee2e2; color: #991b1b; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat b { display: block; font-size: 24px; color: var(--blue); }
.form-narrow { max-width: 420px; margin: 40px auto; }

/* ===== 5. Sản phẩm ===== */
.hero { text-align: center; padding: 30px 16px; }
.hero h1 { font-size: 34px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.product { display: flex; flex-direction: column; gap: 8px; border-radius: var(--radius); padding: 14px; transition: transform .2s; }
.product:hover { transform: translateY(-4px); }
.product img { width: 100%; height: 150px; object-fit: cover; border-radius: 10px; background: linear-gradient(135deg, #dbe6ff, #f0e4ff); }
.product p { flex: 1; margin: 0; color: var(--muted); font-size: 14px; }
.price { color: var(--red); font-weight: 800; font-size: 19px; }
.chips { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.chips a { padding: 7px 14px; border-radius: 99px; background: #e4ecff; color: var(--text); font-weight: 600; }
.chips a.active { background: var(--dark); color: #fff; }

/* ===== 6. Nạp tiền ===== */
.deposit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; align-items: start; }
.deposit-grid img { width: 100%; max-width: 360px; border-radius: 12px; }
.code { font-size: 24px; font-weight: 800; color: var(--red); letter-spacing: 1px; }

/* ===== 7. Modal & Toast ===== */
.modal { position: fixed; inset: 0; background: #0008; display: grid; place-items: center; z-index: 100; padding: 12px; }
.modal-box { background: #fff; border-radius: var(--radius); padding: 20px; width: 460px; max-width: 100%; max-height: 90vh; overflow: auto; }
pre.delivery { white-space: pre-wrap; word-break: break-all; background: #f1f5ff; padding: 12px; border-radius: 9px; }
#toasts { position: fixed; top: 76px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 11px 16px; border-radius: 10px; color: #fff; background: var(--green); box-shadow: 0 4px 14px #0004; animation: toast-in .25s; }
.toast.error { background: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateX(30px); } }
.spinner { text-align: center; padding: 30px; color: var(--muted); }

/* ===== 8. Bong bóng hỗ trợ ===== */
.fab { position: fixed; right: 20px; width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer; font-size: 26px; color: #fff; z-index: 50; box-shadow: 0 0 16px #0006; }
.fab.ai { bottom: 92px; background: linear-gradient(135deg, #7a00ff, #00b7ff); }
.fab.zalo { bottom: 20px; background: #0068ff; }
.popup { position: fixed; right: 20px; bottom: 164px; width: 330px; max-width: 92vw; z-index: 60; }
.popup.zalo-popup { bottom: 92px; text-align: center; }
.chat-log { height: 270px; overflow: auto; background: #f1f5ff; border-radius: 9px; padding: 8px; margin: 8px 0; }
.msg { margin: 6px 0; padding: 8px 11px; border-radius: 11px; max-width: 86%; white-space: pre-wrap; background: #fff; }
.msg.user { background: var(--blue); color: #fff; margin-left: auto; }
.chat-form { display: flex; gap: 6px; } .chat-form input { margin: 0; }

@media (max-width: 640px) { .logo { font-size: 22px; } .user-box { margin-left: 0; } }
