/* ============================================
   SpamJammer — Minimalist / Clean Dashboard
   ============================================ */

:root {
  --accent: #0D9488;
  --accent-light: #0d948815;
  --accent-hover: #0b7f74;
  --bg: #ffffff;
  --bg-secondary: #fafafa;
  --text: #1a1a1a;
  --text-muted: #737373;
  --text-light: #a3a3a3;
  --border: #e5e5e5;
  --border-light: #f0f0f0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
  --radius: 10px;
  --radius-sm: 6px;
  --font: 'Outfit', sans-serif;
  --sidebar-width: 240px;
  --topnav-height: 60px;
}

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

body {
  font-family: var(--font);
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Top Navigation ---- */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topnav-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.topnav-left {
  display: flex;
  align-items: center;
  gap: 40px;
}

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

.logo-text {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.3px;
  color: var(--text);
}

.topnav-links {
  display: flex;
  gap: 4px;
}

.topnav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 450;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}

.topnav-links a:hover {
  color: var(--text);
  background: var(--bg-secondary);
}

.topnav-links a.active {
  color: var(--text);
  background: var(--bg-secondary);
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s;
  position: relative;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--text-light);
}

.notification-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  background: #f87171;
  border-radius: 50%;
  border: 1.5px solid var(--bg);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.user-menu:hover {
  background: var(--bg-secondary);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.user-role {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ---- Layout ---- */
.layout {
  display: flex;
  margin-top: var(--topnav-height);
  min-height: calc(100vh - var(--topnav-height));
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--topnav-height);
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 12px;
  overflow-y: auto;
}

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

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 400;
  transition: color 0.2s, background 0.2s;
}

.sidebar-link:hover {
  color: var(--text);
  background: var(--bg-secondary);
}

.sidebar-link.active {
  color: var(--text);
  background: var(--accent-light);
  font-weight: 500;
}

.sidebar-link.active svg {
  color: var(--accent);
}

.sidebar-link .badge {
  margin-left: auto;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
}

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

.plan-badge {
  margin-bottom: 12px;
}

.plan-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 10px;
  border-radius: 4px;
}

.usage-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.usage-text {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}

.usage-count {
  font-weight: 500;
  color: var(--text);
}

.usage-bar {
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s ease;
}

/* ---- Main Content ---- */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 28px 32px 48px;
  max-width: 1280px;
}

.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text);
}

.page-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 400;
}

/* ---- Stats Row ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: box-shadow 0.2s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 450;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-trend {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
}

.stat-trend.positive {
  color: var(--accent);
  background: var(--accent-light);
}

.stat-trend.neutral {
  color: var(--text-muted);
  background: var(--bg-secondary);
}

.stat-value {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -1px;
  line-height: 1.1;
  color: var(--text);
}

.stat-value.accent {
  color: var(--accent);
}

.stat-footer {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
}

/* ---- Card ---- */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.card-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 400;
}

.card-link {
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.card-link:hover {
  opacity: 0.7;
}

/* ---- Chart ---- */
.chart-container {
  position: relative;
}

.activity-chart {
  width: 100%;
  height: 220px;
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  padding: 10px 0 0;
  font-size: 11.5px;
  color: var(--text-light);
}

.chart-legend {
  display: flex;
  gap: 20px;
  margin-top: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ---- Two Column Layout ---- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

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

.right-col .card {
  margin-bottom: 0;
}

/* ---- Data Table ---- */
.table-wrap {
  overflow-x: auto;
}

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

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-light);
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.data-table tr {
  transition: background 0.15s;
}

.data-table tbody tr:hover {
  background: var(--bg-secondary);
}

.text-muted {
  color: var(--text-muted);
}

/* Category Tags */
.category-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

.category-tag.phishing {
  background: #fef2f2;
  color: #dc2626;
}

.category-tag.promotional {
  background: #fffbeb;
  color: #d97706;
}

.category-tag.scam {
  background: #fdf4ff;
  color: #a855f7;
}

.category-tag.malware {
  background: #f0fdf4;
  color: #16a34a;
}

/* Action Badges */
.action-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

.action-badge.blocked {
  background: #fef2f2;
  color: #dc2626;
}

.action-badge.quarantined {
  background: #fffbeb;
  color: #d97706;
}

.action-badge.delivered {
  background: var(--accent-light);
  color: var(--accent);
}

/* ---- Spam Categories ---- */
.categories-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.category-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.category-info {
  display: flex;
  justify-content: space-between;
}

.category-name {
  font-size: 13px;
  font-weight: 450;
}

.category-pct {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.category-bar {
  height: 5px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}

.category-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
}

.phishing-fill { background: #dc2626; }
.promotional-fill { background: #d97706; }
.scam-fill { background: #a855f7; }
.malware-fill { background: #16a34a; }
.other-fill { background: var(--text-light); }

/* ---- Top Blocked Domains ---- */
.domains-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.domain-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.domain-row:hover {
  background: var(--bg-secondary);
}

.domain-rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.domain-name {
  flex: 1;
  font-size: 13px;
  font-weight: 400;
}

.domain-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

/* ---- Quick Actions ---- */
.actions-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 450;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.action-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.action-btn svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.action-btn:hover svg {
  color: var(--accent);
}

.action-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent);
  color: white;
  padding: 1px 7px;
  border-radius: 10px;
}

/* ---- Animations ---- */
.fade-in {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeIn 0.5s ease forwards;
  animation-delay: calc(var(--delay, 0) * 80ms);
}

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

/* ---- Responsive ---- */
@media (max-width: 1200px) {
  .two-col {
    grid-template-columns: 1fr;
  }
  .right-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    display: none;
  }
  .main {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .topnav-links {
    display: none;
  }
  .main {
    padding: 20px 16px 48px;
  }
  .right-col {
    grid-template-columns: 1fr;
  }
  .user-info {
    display: none;
  }
}

@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: 1fr;
  }
}
