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

:root {
  /* Colors */
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: #ecfdf5;
  --primary-glow: rgba(16, 185, 129, 0.12);
  
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  
  /* Statuses */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-text: #047857;
  --success-border: #a7f3d0;
  
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-text: #b45309;
  --warning-border: #fde68a;
  
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-text: #b91c1c;
  --danger-border: #fca5a5;

  --info: #3b82f6;
  --info-bg: #eff6ff;
  --info-text: #1d4ed8;
  --info-border: #bfdbfe;
  
  /* Sidebar Specific */
  --sidebar-bg: #090f0c;
  --sidebar-border: #14201a;
  --sidebar-text: #94a3b8;
  --sidebar-hover: rgba(16, 185, 129, 0.08);
  --sidebar-active: rgba(16, 185, 129, 0.14);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  
  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

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

/* Sidebar Styling */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: var(--sidebar-bg);
  color: #f1f5f9;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-right: 1px solid var(--sidebar-border);
  transition: var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.sidebar-brand span {
  display: block;
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.brand-mark.small {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 16px;
}

.sidebar-nav {
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

/* Nav Section Label */
.nav-section {
  margin: 16px 12px 6px;
  color: #475569;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
}

.sidebar-nav a:hover {
  color: #fff;
  background: var(--sidebar-hover);
}

.sidebar-nav a.active {
  color: #fff;
  background: var(--sidebar-active);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--primary);
}

.sidebar-nav a.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  opacity: 0.85;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13.5px;
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.sidebar-footer a:hover {
  background: #ef4444;
  color: #fff;
}

/* Main Content Area */
.main-content {
  width: 100%;
  margin-left: 260px;
  padding: 30px 40px 40px;
  transition: var(--transition);
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 20px;
}

.topbar h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.topbar p {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 2px;
}

.admin-chip {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  box-shadow: var(--shadow-sm);
}

.admin-chip span {
  font-size: 13.5px;
  font-weight: 700;
  color: #1e293b;
}

.admin-chip small {
  font-size: 11px;
  color: var(--muted);
}

.menu-button {
  display: none;
  border: 1px solid var(--border);
  background: var(--card);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  font-size: 18px;
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-card strong {
  display: block;
  margin: 12px 0 6px;
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
}

.stat-card small {
  font-size: 12px;
  color: var(--muted);
  display: block;
}

/* Featured / Highlight Stat Card */
.stat-card.highlight {
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
  color: #fff;
}

.stat-card.highlight span,
.stat-card.highlight small {
  color: rgba(255, 255, 255, 0.85);
}

.stat-card.highlight strong {
  color: #fff;
}

/* Standard Panels */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 28px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
}

.panel-heading h2 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.panel-heading p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

/* Filtering Layouts */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 20px 28px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.filter-bar input[type="search"],
.filter-bar input[type="text"],
.filter-bar input[type="number"],
.filter-bar select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: #fff;
  min-width: 180px;
  font-size: 13.5px;
  transition: var(--transition);
}

.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Form Controls Globally */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 650;
  color: #334155;
}

.form-control {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  outline: none;
  font-size: 14px;
  transition: var(--transition);
  width: 100%;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Money inputs */
.balance-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.money-input {
  position: relative;
  width: 140px;
}

.money-input span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

.money-input input {
  padding: 8px 10px 8px 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  outline: none;
  width: 100%;
  font-size: 13px;
  transition: var(--transition);
}

.money-input input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Buttons */
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13.5px;
  gap: 8px;
  transition: var(--transition);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  color: #fff;
  background: var(--primary);
}

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

.btn-secondary {
  color: #475569;
  background: #f1f5f9;
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-success {
  color: #fff;
  background: var(--success);
}

.btn-success:hover {
  background: var(--primary-hover);
}

.btn-warning {
  color: #fff;
  background: var(--warning);
}

.btn-warning:hover {
  background: #d97706;
}

.btn-danger {
  color: #fff;
  background: var(--danger);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-small, .btn-sm {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

/* Tables styling */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th, td {
  padding: 16px 24px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13.5px;
}

th {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f8fafc;
}

tbody tr {
  transition: var(--transition);
}

tbody tr:hover {
  background: #f8fafc;
}

.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--muted);
  font-size: 14px;
}

.action-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Badges styling */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}

.badge-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid var(--border);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  border-top: 1px solid var(--border);
}

.pagination a {
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  color: #475569;
}

.pagination a:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.pagination span {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

/* Alerts */
.alert {
  margin-bottom: 24px;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  border: 1px solid transparent;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.alert-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--warning-border);
}

/* Modern Modals styling (Global CSS to replace inline blocks) */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal-dialog {
  background: var(--card);
  border-radius: 20px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  animation: scaleUp 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.modal-header h3 {
  font-size: 16.5px;
  font-weight: 700;
  color: #0f172a;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: #f8fafc;
}

.btn-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  transition: var(--transition);
  line-height: 1;
}

.btn-close:hover {
  color: #ef4444;
}

/* Detail Rows for modals (e.g. withdraw details) */
.detail-row {
  display: flex;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.detail-row:last-child {
  border-bottom: none;
}
.detail-label {
  font-weight: 600;
  width: 150px;
  color: #475569;
  font-size: 13px;
}
.detail-value {
  color: #0f172a;
  font-size: 13px;
  flex: 1;
  word-break: break-all;
}

/* KYC/Deposit Image styling */
.kyc-image, .dep-screenshot {
  max-width: 100%;
  max-height: 300px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-top: 10px;
  object-fit: contain;
  box-shadow: var(--shadow-sm);
}

/* Progress bar inside table (Coupons) */
.progress-bar-container {
  width: 100%;
  background-color: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
  height: 6px;
  margin-top: 6px;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary);
  border-radius: 9999px;
  transition: var(--transition);
}

.progress-bar-text {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

/* Login Page Redesign */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: 
    radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
    #fafafa;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), #3b82f6);
}

.login-card h1 {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  margin: 20px 0 8px;
  letter-spacing: -0.02em;
}

.login-card p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.login-card label {
  font-size: 13px;
  font-weight: 650;
  color: #475569;
  display: block;
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  outline: none;
  font-size: 14px;
  margin-bottom: 16px;
  transition: var(--transition);
}

.login-card input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.demo-note {
  margin-top: 24px;
  padding: 16px;
  background: #ecfdf5;
  border: 1px solid #d1fae5;
  border-radius: 12px;
  color: #065f46;
  font-size: 12.5px;
  line-height: 1.6;
}

.demo-note strong {
  font-weight: 700;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Responsive Overrides */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 30px rgba(15, 23, 42, 0.15);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding: 24px;
  }
  .menu-button {
    display: inline-grid;
    place-items: center;
  }
  .admin-chip {
    display: none;
  }
  .filter-bar {
    padding: 16px 20px;
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-bar input, .filter-bar select, .filter-bar button {
    width: 100%;
  }
  .panel-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 20px;
  }
  .topbar h1 {
    font-size: 22px;
  }
}
