/* ================================================
   TRADEZYLO ADMIN PANEL — PREMIUM DARK THEME
   ================================================ */

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

:root {
  --bg: #050811;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f0f4ff;
  --text-muted: #8899bb;
  --accent: #4f9cf9;
  --accent-2: #a78bfa;
  --success: #34d399;
  --danger: #f87171;
  --gradient: linear-gradient(135deg, #4f9cf9 0%, #a78bfa 50%, #f472b6 100%);
  --gradient-btn: linear-gradient(135deg, #4f9cf9 0%, #7c3aed 100%);
  --sidebar-w: 240px;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- LOGIN SCREEN ---- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
}

.login-screen::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 30% 40%, rgba(79, 156, 249, 0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 60%, rgba(167, 139, 250, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.login-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  backdrop-filter: blur(20px);
  box-shadow: 0 40px 100px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);
  position: relative;
  animation: fadeIn 0.4s ease;
}

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

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 22px;
}
.login-logo-text {
  font-size: 20px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.login-form { display: flex; flex-direction: column; gap: 12px; }

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 14px;
  font-size: 15px;
  pointer-events: none;
}
.input-wrap input {
  width: 100%;
  padding: 13px 14px 13px 44px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: all 0.2s;
}
.input-wrap input::placeholder { color: rgba(136, 153, 187, 0.5); }
.input-wrap input:focus {
  border-color: rgba(79, 156, 249, 0.5);
  box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.1);
  background: rgba(79, 156, 249, 0.04);
}

.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--gradient-btn);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 4px;
}
.login-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.login-error {
  padding: 10px 14px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 8px;
  font-size: 13px;
  color: var(--danger);
  text-align: center;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- ADMIN DASHBOARD LAYOUT ---- */
#adminDashboard {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: rgba(255,255,255,0.03);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: rgba(79, 156, 249, 0.12); color: var(--accent); border: 1px solid rgba(79, 156, 249, 0.2); }
.nav-icon { font-size: 16px; }

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.06);
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}
.logout-btn:hover { background: rgba(248, 113, 113, 0.12); }

/* Main Content */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.header-left h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.header-left p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}
.header-right {
  display: flex;
  gap: 10px;
}

.refresh-btn, .export-btn {
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}
.refresh-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.refresh-btn:hover { background: var(--surface-hover); color: var(--text); }
.export-btn {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: var(--success);
}
.export-btn:hover { background: rgba(52, 211, 153, 0.18); }

/* Stats Cards */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.25s;
}
.stat-card:hover { background: var(--surface-hover); transform: translateY(-2px); }
.stat-card-icon { font-size: 30px; }
.stat-card-num {
  font-size: 26px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Table Controls */
.table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 400px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 10px 14px 10px 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: all 0.2s;
}
.search-input::placeholder { color: rgba(136, 153, 187, 0.5); }
.search-input:focus {
  border-color: rgba(79, 156, 249, 0.4);
  box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.08);
}

.count-badge {
  padding: 6px 14px;
  background: rgba(79, 156, 249, 0.1);
  border: 1px solid rgba(79, 156, 249, 0.2);
  border-radius: 100px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

/* Table */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

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

.data-table thead {
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}
.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(255,255,255,0.03); }

.row-num { color: var(--text-muted); font-weight: 600; }
.row-name { font-weight: 600; color: var(--text); }
.row-email { color: var(--accent); }
.row-tz { font-size: 12px; color: var(--text-muted); }
.row-source {
  padding: 3px 8px;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 6px;
  font-size: 11px;
  color: var(--accent-2);
  font-weight: 600;
  white-space: nowrap;
}
.row-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.delete-btn {
  padding: 5px 12px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: 6px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}
.delete-btn:hover { background: rgba(248, 113, 113, 0.15); }

/* Loading & Empty States */
.loading-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 24px;
  color: var(--text-muted);
  font-size: 14px;
}
.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.empty-icon { font-size: 40px; }

/* Delete Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: #0d1322;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6);
  animation: scaleIn 0.2s ease;
}
@keyframes scaleIn {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-icon { font-size: 40px; margin-bottom: 12px; }
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.modal p { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; }
.modal-btns { display: flex; gap: 10px; }
.modal-cancel, .modal-confirm {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-cancel {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.modal-cancel:hover { color: var(--text); background: var(--surface-hover); }
.modal-confirm {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger);
}
.modal-confirm:hover { background: rgba(248, 113, 113, 0.25); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 60px; padding: 16px 8px; }
  .sidebar-logo span:last-child, .nav-item span:last-child, .logout-btn span:last-child { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .logout-btn { justify-content: center; padding: 10px; }
  .admin-main { margin-left: 60px; padding: 20px; }
  .data-table th:nth-child(4), .data-table td:nth-child(4),
  .data-table th:nth-child(5), .data-table td:nth-child(5) { display: none; }
}
