/* ============================================
   SpamJammer - Gradient-Heavy / Aurora Style
   ============================================ */

:root {
  --purple: #7C3AED;
  --blue: #3B82F6;
  --pink: #EC4899;
  --orange: #F97316;
  --green: #10B981;
  --red: #EF4444;

  --bg-base: #0a0a0f;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(124, 58, 237, 0.2);

  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-muted: rgba(255, 255, 255, 0.3);

  --sidebar-width: 260px;
  --topnav-height: 64px;

  --gradient-primary: linear-gradient(135deg, var(--purple), var(--blue));
  --gradient-accent: linear-gradient(135deg, var(--pink), var(--orange));
  --gradient-full: linear-gradient(135deg, var(--purple), var(--blue), var(--pink), var(--orange));
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Manrope', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

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

/* ---- Grain Overlay ---- */
.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ---- Aurora Background ---- */
.aurora-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.aurora-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  animation: auroraFloat 20s ease-in-out infinite;
}

.aurora-orb-1 {
  width: 600px;
  height: 600px;
  background: var(--purple);
  top: -200px;
  left: -100px;
  animation-duration: 25s;
}

.aurora-orb-2 {
  width: 500px;
  height: 500px;
  background: var(--blue);
  top: 20%;
  right: -150px;
  animation-duration: 20s;
  animation-delay: -5s;
}

.aurora-orb-3 {
  width: 450px;
  height: 450px;
  background: var(--pink);
  bottom: -100px;
  left: 30%;
  animation-duration: 22s;
  animation-delay: -10s;
}

.aurora-orb-4 {
  width: 350px;
  height: 350px;
  background: var(--orange);
  bottom: 10%;
  right: 20%;
  animation-duration: 18s;
  animation-delay: -8s;
  opacity: 0.1;
}

@keyframes auroraFloat {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(40px, -30px) scale(1.05);
  }
  50% {
    transform: translate(-20px, 20px) scale(0.95);
  }
  75% {
    transform: translate(30px, 40px) scale(1.02);
  }
}

/* ---- Fade-In Animation ---- */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  animation: fadeInUp 0.6s ease forwards;
}

.fade-in:nth-child(1) { animation-delay: 0.1s; }
.fade-in:nth-child(2) { animation-delay: 0.2s; }
.fade-in:nth-child(3) { animation-delay: 0.3s; }
.fade-in:nth-child(4) { animation-delay: 0.4s; }

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

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

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

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

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

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

.nav-link {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--text-primary);
  background: rgba(124, 58, 237, 0.15);
}

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

.nav-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.nav-icon-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.notification-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gradient-accent);
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.user-menu:hover {
  background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
}

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

.user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

/* ---- App Layout ---- */
.app-layout {
  display: flex;
  padding-top: var(--topnav-height);
  position: relative;
  z-index: 1;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  left: 0;
  top: var(--topnav-height);
  bottom: 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 12px;
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 50;
}

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

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  position: relative;
}

.sidebar-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-item.active {
  color: var(--text-primary);
  background: rgba(124, 58, 237, 0.12);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--gradient-primary);
}

.sidebar-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.6875rem;
  font-weight: 700;
  background: rgba(236, 72, 153, 0.15);
  color: var(--pink);
}

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

.plan-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.plan-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.plan-name {
  font-size: 0.8125rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.usage-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.usage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.usage-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.usage-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.usage-bar {
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

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

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 28px 32px 48px;
  min-height: calc(100vh - var(--topnav-height));
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 30%, rgba(255,255,255,0.6));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.last-updated {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-ghost {
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

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

.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(124,58,237,0.2), transparent, rgba(59,130,246,0.1));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-blue {
  background: rgba(59, 130, 246, 0.12);
  color: var(--blue);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.stat-icon-pink {
  background: rgba(236, 72, 153, 0.12);
  color: var(--pink);
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.1);
}

.stat-icon-green {
  background: rgba(16, 185, 129, 0.12);
  color: var(--green);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.1);
}

.stat-icon-purple {
  background: rgba(124, 58, 237, 0.12);
  color: var(--purple);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.1);
}

.stat-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-primary);
}

.stat-unit {
  font-size: 1.25rem;
  font-weight: 600;
}

.stat-change {
  font-size: 0.75rem;
  font-weight: 600;
}

.stat-change.positive {
  color: var(--green);
}

.stat-change.neutral {
  color: var(--text-secondary);
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124,58,237,0.3), rgba(59,130,246,0.2), transparent);
  opacity: 0.6;
}

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

.card-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--purple);
  transition: color 0.2s ease;
}

.card-link:hover {
  color: var(--blue);
}

/* ---- Charts Row ---- */
.charts-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

/* ---- Activity Chart ---- */
.chart-container {
  width: 100%;
  height: 220px;
}

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

.chart-legend {
  display: flex;
  gap: 16px;
}

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

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

.legend-legitimate {
  background: var(--blue);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.legend-spam {
  background: var(--pink);
  box-shadow: 0 0 8px rgba(236, 72, 153, 0.5);
}

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

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

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

.category-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.category-pct {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.category-bar {
  height: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

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

.category-fill-phishing {
  background: linear-gradient(90deg, var(--purple), var(--pink));
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.3);
}

.category-fill-promo {
  background: linear-gradient(90deg, var(--blue), #06B6D4);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.category-fill-scam {
  background: linear-gradient(90deg, var(--orange), #FBBF24);
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.3);
}

.category-fill-malware {
  background: linear-gradient(90deg, var(--red), var(--pink));
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.category-fill-other {
  background: linear-gradient(90deg, rgba(255,255,255,0.3), rgba(255,255,255,0.15));
}

.category-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---- Threats Table ---- */
.table-card {
  margin-bottom: 24px;
}

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

.threats-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.threats-table td {
  padding: 12px 14px;
  font-size: 0.8125rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}

.threats-table tbody tr {
  transition: background 0.15s ease;
}

.threats-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

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

.time-cell {
  white-space: nowrap;
  color: var(--text-muted) !important;
}

.from-cell {
  font-family: 'Manrope', monospace;
  font-size: 0.8125rem !important;
  color: var(--text-primary) !important;
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-phishing {
  background: rgba(124, 58, 237, 0.15);
  color: #A78BFA;
  border: 1px solid rgba(124, 58, 237, 0.2);
}

.badge-scam {
  background: rgba(249, 115, 22, 0.15);
  color: #FB923C;
  border: 1px solid rgba(249, 115, 22, 0.2);
}

.badge-promo {
  background: rgba(59, 130, 246, 0.15);
  color: #60A5FA;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-malware {
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ---- Scores ---- */
.score {
  font-weight: 700;
  font-size: 0.8125rem;
}

.score-high {
  color: var(--red);
  text-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.score-medium {
  color: var(--orange);
  text-shadow: 0 0 12px rgba(249, 115, 22, 0.4);
}

/* ---- Actions ---- */
.action-blocked {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--red);
}

.action-quarantined {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--orange);
}

/* ---- Bottom Row ---- */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.domain-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.domain-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.domain-rank {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.domain-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.domain-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.domain-type {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.domain-count {
  font-size: 0.9375rem;
  font-weight: 700;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Quick Actions ---- */
.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.25s ease;
  text-align: left;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.action-btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-btn-purple {
  background: rgba(124, 58, 237, 0.12);
  color: var(--purple);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.1);
}

.action-btn-blue {
  background: rgba(59, 130, 246, 0.12);
  color: var(--blue);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.action-btn-pink {
  background: rgba(236, 72, 153, 0.12);
  color: var(--pink);
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.1);
}

.action-btn-orange {
  background: rgba(249, 115, 22, 0.12);
  color: var(--orange);
  box-shadow: 0 0 20px rgba(249, 115, 22, 0.1);
}

.action-btn-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.action-btn-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.action-btn-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

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

@media (max-width: 640px) {
  .stats-row {
    grid-template-columns: 1fr;
  }
  .actions-grid {
    grid-template-columns: 1fr;
  }
  .main-content {
    padding: 20px 16px 40px;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .user-info {
    display: none;
  }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
