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

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

:root {
  --bg: #f5f5f0;
  --bg-card: #ffffff;
  --bg-sidebar: #1a1a2e;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e5e5e0;
  --primary: #1a1a2e;
  --danger: #c23b3b;
  --danger-bg: #fef2f2;
  --success: #0f6e56;
  --success-bg: #ecfdf5;
  --warning: #ba7517;
  --warning-bg: #fffbeb;
  --info: #3266ad;
  --info-bg: #eff6ff;
}

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 220px;
  background: var(--bg-sidebar);
  color: #fff;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #c23b3b, #e6735a);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 0.85rem;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 0.88rem;
  border-radius: 8px;
  margin-bottom: 2px;
  transition: all 0.15s;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.nav-item.active { background: rgba(255,255,255,0.12); color: #fff; font-weight: 500; }

.nav-bottom { margin-top: auto; padding-top: 1rem; }

.btn-test {
  width: 100%;
  padding: 0.6rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-test:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ===== CONTENT ===== */
.content {
  flex: 1;
  margin-left: 220px;
  padding: 2rem 2.5rem;
  max-width: 1200px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--bg-card);
  padding: 1.1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -1px;
}

.stat-danger .stat-value { color: var(--danger); }
.stat-success .stat-value { color: var(--success); }
.stat-warning .stat-value { color: var(--warning); }
.stat-info .stat-value { color: var(--info); }

/* ===== CHARTS ===== */
.charts-row {
  display: flex;
  gap: 16px;
  margin-bottom: 1.75rem;
}

.chart-box {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.chart-box h3 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}

/* ===== TABLES ===== */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

thead tr { background: #fafaf8; }

th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #f0f0ec;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

.row-fraud { background: rgba(194, 59, 59, 0.04); }

.mono { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }
.muted { color: var(--text-muted); }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }

/* ===== BUTTONS ===== */
.btn-primary {
  padding: 0.6rem 1.25rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  padding: 0.5rem 1rem;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}

.btn-danger {
  padding: 0.5rem 1rem;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 6px;
}

/* ===== FILTERS ===== */
.filter-group {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}

.btn-filter {
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.15s;
}

.btn-filter:hover { color: var(--text); }
.btn-filter.active { background: var(--primary); color: #fff; }

/* ===== FRAUD IP LIST ===== */
.fraud-ip-list { max-height: 320px; overflow-y: auto; }

.fraud-ip-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f0f0ec;
}

.fraud-ip-item:last-child { border-bottom: none; }

.ip-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 500;
}

.fraud-count {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== SECTION ===== */
.section {
  margin-bottom: 1.75rem;
}

.section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  gap: 4px;
  margin-top: 1rem;
  justify-content: center;
}

.page-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
  border: 1px solid var(--border);
}

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

/* ===== FORMS ===== */
.input {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}

.input:focus { border-color: var(--primary); }
.input-sm { width: 100px; }

/* ===== SETTINGS ===== */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.settings-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f5f5f0;
}

.setting-row:last-child { border-bottom: none; }
.setting-row label { font-weight: 500; font-size: 0.88rem; display: block; }
.setting-row small { color: var(--text-muted); font-size: 0.75rem; display: block; margin-top: 2px; }

/* ===== MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-box {
  background: #fff;
  border-radius: 14px;
  padding: 1.75rem;
  width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-box h3 { margin-bottom: 1rem; }
.modal-box .input { width: 100%; margin-bottom: 0.75rem; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 0.5rem; }

/* ===== INTEGRATION ===== */
.integration-steps { display: grid; gap: 16px; }

.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  position: relative;
}

.step-num {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.step-card h3 { font-size: 0.95rem; margin-bottom: 0.5rem; }
.step-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; }
.step-card ol { font-size: 0.85rem; color: var(--text-muted); padding-left: 1.25rem; margin-top: 0.5rem; line-height: 1.8; }

.code-block {
  background: #1a1a2e;
  color: #e6e6e6;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-top: 0.75rem;
  position: relative;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  overflow-x: auto;
}

.btn-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
}

.btn-copy:hover { background: rgba(255,255,255,0.2); }

/* ===== INFO BOX ===== */
.info-box {
  background: var(--info-bg);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  color: #1e40af;
  margin-top: 1.5rem;
  line-height: 1.6;
}

/* ===== EMPTY STATE ===== */
.empty-text {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem !important;
  font-size: 0.88rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .charts-row { flex-direction: column; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { width: 60px; padding: 1rem 0.5rem; }
  .sidebar .nav-item span, .sidebar .logo span { display: none; }
  .content { margin-left: 60px; padding: 1.5rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
