/* =============================================
   HSBC ADMIN PANEL — DARK THEME DESIGN SYSTEM
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-2: #1a1a28;
  --bg-input: #1e1e2e;
  --border: #2a2a3a;
  --border-light: #333348;
  --red: #F44336;
  --red-dark: #D32F2F;
  --red-glow: rgba(244,67,54,0.15);
  --green: #4CAF50;
  --yellow: #FFC107;
  --blue: #42A5F5;
  --white: #FFFFFF;
  --text: #E8E8F0;
  --text-2: #9898AC;
  --text-3: #686878;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --r: 12px;
  --r-lg: 16px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --glass: rgba(255,255,255,0.03);
  --transition: 0.2s ease;
  --accent: #4CAF50;
}

html, body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand img { height: 32px; }
.sidebar-brand span { font-size: 16px; font-weight: 700; color: var(--white); }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}

.nav-item:hover { background: var(--glass); color: var(--text); }

.nav-item.active {
  background: var(--red-glow);
  color: var(--red);
  font-weight: 600;
}

.nav-item .icon { font-size: 18px; width: 24px; text-align: center; }

.nav-item .badge {
  margin-left: auto;
  background: var(--red);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-user { display: flex; align-items: center; gap: 10px; }

.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}

.sidebar-user-name { font-size: 13px; font-weight: 600; }
.sidebar-user-role { font-size: 11px; color: var(--text-2); }

.main {
  flex: 1;
  margin-left: 260px;
  padding: 32px;
  min-height: 100vh;
}

.page-header { margin-bottom: 28px; }
.page-title { font-size: 24px; font-weight: 800; color: var(--white); margin-bottom: 4px; }
.page-subtitle { font-size: 14px; color: var(--text-2); }

/* ── Back Button ── */
.btn-back {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-back:hover { background: var(--border); }

/* ── Stat Cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--red);
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover::before { opacity: 1; }
.stat-card:hover { border-color: var(--border-light); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.stat-icon.red { background: var(--red-glow); }
.stat-icon.green { background: rgba(76,175,80,0.15); }
.stat-icon.yellow { background: rgba(255,193,7,0.15); }
.stat-icon.blue { background: rgba(66,165,245,0.15); }

.stat-value { font-size: 26px; font-weight: 800; color: var(--white); margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-2); }

/* ── Data Table ── */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.table-scroll { overflow-x: auto; }

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.table-title { font-size: 16px; font-weight: 700; color: var(--white); }

.table-search {
  width: 260px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.table-search:focus { border-color: var(--red); }
.table-search::placeholder { color: var(--text-3); }

.table-filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.filter-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover, .filter-btn.active {
  background: var(--red-glow);
  border-color: var(--red);
  color: var(--red);
}

table { width: 100%; border-collapse: collapse; }

thead th {
  text-align: left;
  padding: 12px 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-2);
  white-space: nowrap;
}

tbody td {
  padding: 12px 20px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--glass); }
tbody tr:last-child td { border-bottom: none; }

/* ── Status Badges ── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-status.pending { background: rgba(255,193,7,0.12); color: var(--yellow); }
.badge-status.approved { background: rgba(76,175,80,0.12); color: var(--green); }
.badge-status.rejected { background: rgba(244,67,54,0.12); color: var(--red); }
.badge-status.active { background: rgba(76,175,80,0.12); color: var(--green); }
.badge-status.blocked { background: rgba(244,67,54,0.12); color: var(--red); }

.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Toggle Pill ── */
.toggle-pill {
  position: relative;
  width: 48px; height: 26px;
  border-radius: 13px;
  border: none;
  cursor: pointer;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  padding: 0 4px;
  flex-shrink: 0;
}

.toggle-pill.off { background: var(--bg-input); border: 1px solid var(--border); }
.toggle-pill.on { background: #2E7D32; }

.toggle-knob {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--white);
  transition: transform 0.25s;
  position: absolute;
  top: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.toggle-pill.off .toggle-knob { left: 3px; }
.toggle-pill.on .toggle-knob { left: calc(100% - 23px); }

.toggle-label {
  font-size: 11px;
  position: absolute;
  right: 6px;
  color: rgba(255,255,255,0.7);
}

.toggle-pill.off .toggle-label { right: auto; left: 28px; color: var(--text-3); }

/* ── Action Buttons ── */
.btn-action {
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-action.approve { background: rgba(76,175,80,0.12); color: var(--green); }
.btn-action.approve:hover { background: var(--green); color: var(--white); }
.btn-action.reject { background: rgba(244,67,54,0.12); color: var(--red); }
.btn-action.reject:hover { background: var(--red); color: var(--white); }
.btn-action.view { background: rgba(66,165,245,0.12); color: var(--blue); }
.btn-action.view:hover { background: var(--blue); color: var(--white); }
.btn-action.block { background: rgba(255,193,7,0.12); color: var(--yellow); }
.btn-action.block:hover { background: var(--yellow); color: #333; }

.action-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── User Detail Grid ── */
.ud-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.ud-col { display: flex; flex-direction: column; gap: 20px; }

.ud-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 16px;
}

/* ── Settings Grid ── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 800px;
}

.settings-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 20px;
}

/* ── Login Page ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo img { height: 40px; margin: 0 auto; }
.login-title { text-align: center; font-size: 20px; font-weight: 800; color: var(--white); margin-bottom: 8px; }
.login-sub { text-align: center; font-size: 13px; color: var(--text-2); margin-bottom: 28px; }

.form-group-admin { margin-bottom: 16px; }
.form-label-admin { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }

.form-input-admin {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input-admin:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-glow); }

.btn-admin {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--red);
  color: var(--white);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-admin:hover { background: var(--red-dark); }
.btn-admin:active { transform: scale(0.98); }
.btn-admin:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show { display: flex; }

.modal {
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 16px; font-weight: 700; color: var(--white); }

.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg-input);
  color: var(--text-2);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border); }

/* ── KYC Image Preview ── */
.kyc-images { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.kyc-img-card { background: var(--bg-card-2); border-radius: var(--r); overflow: hidden; }
.kyc-img-card img { width: 100%; height: 160px; object-fit: cover; cursor: pointer; }
.kyc-img-label { text-align: center; padding: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); }

/* ── Detail Grid ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item { padding: 12px; background: var(--bg-card-2); border-radius: var(--r); }
.detail-label { font-size: 11px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.detail-value { font-size: 14px; font-weight: 600; color: var(--white); word-break: break-all; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; display: block; }
.empty-state .title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }

/* ── Toast ── */
.admin-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  z-index: 300;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Spinner ── */
.spin-admin {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .ud-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 20px 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .table-header { flex-direction: column; gap: 12px; align-items: stretch; }
  .table-search { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .kyc-images { grid-template-columns: 1fr; }
  .ud-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .mobile-toggle { display: flex !important; }
}

.mobile-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 150;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; }
.sidebar-overlay.show { display: block; }

/* ── Utilities ── */
.hide { display: none !important; }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-yellow { color: var(--yellow); }
