/* ============================================================
   PrintMember — style.css
   Warna utama: #1e3a8a (biru tua) | Aksen: #f59e0b (oranye)
   ============================================================ */

:root {
  --primary: #1e3a8a;
  --primary-dark: #152a63;
  --primary-light: #3b5bcc;
  --accent: #f59e0b;
  --accent-dark: #d97f06;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 4px 14px rgba(30, 58, 138, 0.08);
  --shadow-hover: 0 8px 24px rgba(30, 58, 138, 0.14);

  --bronze: #cd7f32;
  --silver: #9aa0a6;
  --gold: #d4a900;
  --platinum: #8a8d91;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* ---------- Utility ---------- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card h3 { margin-top: 0; }

.page { display: none; animation: fadeIn 0.25s ease; }
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-title { font-size: 1.6rem; margin: 0 0 4px; color: var(--primary); }
.page-subtitle { color: var(--text-muted); margin-top: 0; margin-bottom: 20px; }

button { font-family: inherit; cursor: pointer; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); box-shadow: var(--shadow-hover); }

.btn-secondary { background: var(--accent); color: #fff; }
.btn-secondary:hover { background: var(--accent-dark); }

.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-ghost { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,0.5); }
.btn-ghost:hover { background: rgba(255,255,255,0.15); }

input, select {
  width: 100%;
  padding: 10px 12px;
  margin: 6px 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 91, 204, 0.15);
}
label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.optional { font-weight: 400; color: #94a3b8; }
.hint { font-size: 0.8rem; color: var(--text-muted); text-align: center; margin-top: 10px; }

/* ---------- Navbar ---------- */
.navbar {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.navbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 1.15rem; margin-right: auto; }
.nav-links { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.85);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}
.nav-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-btn.active { background: var(--accent); color: #fff; }
.navbar-right { display: flex; align-items: center; gap: 10px; }
.nav-username { font-size: 0.85rem; opacity: 0.9; }

/* ---------- Auth Page ---------- */
.auth-wrapper {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card { width: 100%; max-width: 420px; text-align: center; }
.auth-logo { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.auth-logo span { color: var(--text); }
.auth-subtitle { color: var(--text-muted); margin-bottom: 20px; }

.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 18px; }
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 10px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--accent); }
.tab-content { display: none; text-align: left; }
.tab-content.active { display: block; }

/* ---------- Dashboard ---------- */
.grid-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}
.card-poin { background: linear-gradient(135deg, var(--primary), #2b4fb0); color: #fff; }
.poin-header { display: flex; justify-content: space-between; align-items: flex-start; }
.poin-label { font-size: 0.85rem; opacity: 0.85; }
.poin-value { font-size: 2.2rem; font-weight: 800; }
.progress-wrap { margin-top: 18px; }
.progress-bar { background: rgba(255,255,255,0.25); border-radius: 20px; height: 10px; overflow: hidden; }
.progress-fill { background: var(--accent); height: 100%; width: 0%; transition: width 0.4s ease; border-radius: 20px; }
.progress-label { font-size: 0.8rem; margin-top: 8px; opacity: 0.9; }

.tier-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  background: var(--bronze);
}
.tier-badge.tier-Bronze, .tier-Bronze { background: var(--bronze); }
.tier-badge.tier-Silver, .tier-Silver { background: var(--silver); }
.tier-badge.tier-Gold, .tier-Gold { background: var(--gold); color: #3a2c00; }
.tier-badge.tier-Platinum, .tier-Platinum { background: linear-gradient(135deg, #b6b9bd, #e5e4e2); color: #333; }

.info-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 0.9rem; }
.info-row:last-child { border-bottom: none; }
.info-row span { color: var(--text-muted); }

.card-referral p { font-size: 0.85rem; color: var(--text-muted); }
.referral-box { display: flex; align-items: center; gap: 10px; background: var(--bg); padding: 10px 14px; border-radius: 10px; }
.referral-box code { flex: 1; font-size: 1.05rem; font-weight: 700; color: var(--primary); letter-spacing: 1px; }

.tier-table-card { margin-top: 4px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.4px; }
.empty { text-align: center; color: var(--text-muted); white-space: normal; }

/* ---------- Rewards Grid ---------- */
.grid-rewards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.reward-card { display: flex; flex-direction: column; gap: 8px; }
.reward-card h4 { margin: 0; color: var(--primary); }
.reward-card p { margin: 0; font-size: 0.85rem; color: var(--text-muted); flex: 1; }
.reward-poin { font-weight: 800; color: var(--accent-dark); font-size: 1.1rem; }
.reward-stok { font-size: 0.75rem; color: var(--text-muted); }

/* ---------- Vouchers ---------- */
.grid-vouchers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.voucher-card {
  background: #fff;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  padding: 16px;
}
.voucher-code { font-size: 1.15rem; font-weight: 800; color: var(--primary); letter-spacing: 1px; }
.voucher-status { display: inline-block; margin-top: 6px; padding: 3px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; }
.voucher-status.aktif { background: #dcfce7; color: var(--success); }
.voucher-status.terpakai { background: #e2e8f0; color: var(--text-muted); }
.voucher-status.expired { background: #fee2e2; color: var(--danger); }

/* ---------- Admin ---------- */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card { text-align: center; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.grid-2col { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-bottom: 20px; }
.grid-2col-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 20px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.form-actions .btn { flex: 1; min-width: 140px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text); margin: 10px 0 14px; }
.checkbox-label input { width: auto; margin: 0; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.action-btns { display: flex; gap: 6px; flex-wrap: nowrap; }
.action-btns .btn { padding: 6px 10px; font-size: 0.78rem; }
tr.editing-row { background: #fef3c7; }
.tx-result { margin-top: 10px; font-size: 0.85rem; background: var(--bg); border-radius: 8px; padding: 10px; display: none; white-space: pre-line; }
.tx-result.show { display: block; }

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  animation: slideIn 0.25s ease;
  max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .navbar-inner { justify-content: center; }
  .brand { width: 100%; text-align: center; margin-right: 0; }
  .navbar-right { width: 100%; justify-content: center; }
  .poin-value { font-size: 1.8rem; }
}
