/* ============================================
   SpamJammer - Organic / Nature-Inspired Theme
   ============================================ */

:root {
  --forest-green: #166534;
  --forest-green-light: #1a7a3e;
  --ochre: #B45309;
  --ochre-light: #D97706;
  --warm-cream: #FEF3C7;
  --warm-cream-light: #FFFBEB;
  --terracotta: #C2410C;
  --terracotta-light: #EA580C;
  --sage: #6B8E6B;
  --sage-light: #8AAE8A;
  --warm-brown: #8B6914;
  --earth-dark: #3D2B1F;
  --earth-medium: #5C4033;
  --parchment: #FAF6F0;
  --parchment-dark: #F0E8DC;
  --bark: #4A3728;

  --text-primary: #2D1F14;
  --text-secondary: #6B5744;
  --text-muted: #9C8B7A;
  --border-color: #E8DDD0;
  --border-light: #F0E8DC;

  --shadow-sm: 0 1px 3px rgba(61, 43, 31, 0.08);
  --shadow-md: 0 4px 12px rgba(61, 43, 31, 0.1);
  --shadow-lg: 0 8px 24px rgba(61, 43, 31, 0.12);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

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

  --font-heading: 'Fraunces', Georgia, serif;
  --font-body: 'Libre Franklin', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background-color: var(--parchment);
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Floating Leaves */
.floating-leaves {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.leaf {
  position: absolute;
  animation: leafFloat 20s ease-in-out infinite;
}

.leaf-1 { top: 8%; left: 5%; animation-delay: 0s; animation-duration: 22s; }
.leaf-2 { top: 25%; right: 8%; animation-delay: -5s; animation-duration: 18s; }
.leaf-3 { top: 55%; left: 12%; animation-delay: -10s; animation-duration: 25s; }
.leaf-4 { top: 72%; right: 15%; animation-delay: -7s; animation-duration: 20s; }
.leaf-5 { top: 40%; left: 60%; animation-delay: -12s; animation-duration: 23s; }

@keyframes leafFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-15px) rotate(5deg); }
  50% { transform: translateY(8px) rotate(-3deg); }
  75% { transform: translateY(-10px) rotate(4deg); }
}

/* Top Navigation */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topnav-height);
  background: linear-gradient(135deg, var(--forest-green) 0%, var(--forest-green-light) 100%);
  z-index: 100;
  box-shadow: 0 2px 12px rgba(22, 101, 52, 0.25);
}

.topnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 24px;
}

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

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

.logo-text {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--warm-cream);
  letter-spacing: -0.02em;
}

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

.nav-link {
  color: rgba(254, 243, 199, 0.7);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-xl);
  font-size: 0.87rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.nav-link:hover {
  color: var(--warm-cream);
  background: rgba(254, 243, 199, 0.1);
}

.nav-link.active {
  color: var(--forest-green);
  background: var(--warm-cream);
  font-weight: 600;
}

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

.notification-btn {
  position: relative;
  background: rgba(254, 243, 199, 0.12);
  border: none;
  color: var(--warm-cream);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.notification-btn:hover {
  background: rgba(254, 243, 199, 0.2);
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--terracotta);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--forest-green);
}

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

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(254, 243, 199, 0.3);
}

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

.user-name {
  color: var(--warm-cream);
  font-weight: 600;
  font-size: 0.87rem;
  line-height: 1.2;
}

.user-role {
  color: rgba(254, 243, 199, 0.55);
  font-size: 0.73rem;
}

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  position: fixed;
  top: var(--topnav-height);
  left: 0;
  bottom: 0;
  background: var(--warm-cream-light);
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  z-index: 50;
}

.sidebar-inner {
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--topnav-height));
}

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

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

.sidebar-link:hover {
  background: rgba(22, 101, 52, 0.06);
  color: var(--forest-green);
}

.sidebar-link.active {
  background: rgba(22, 101, 52, 0.1);
  color: var(--forest-green);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--forest-green);
  border-radius: 0 3px 3px 0;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--terracotta);
  color: white;
  font-size: 0.67rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.sidebar-decoration {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

/* Plan Card */
.plan-card {
  background: linear-gradient(145deg, rgba(22, 101, 52, 0.05), rgba(107, 142, 107, 0.08));
  border: 1px solid rgba(22, 101, 52, 0.12);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-top: auto;
}

.plan-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.plan-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--forest-green);
}

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

.plan-usage-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-track {
  height: 8px;
  background: rgba(22, 101, 52, 0.1);
  border-radius: 20px;
  position: relative;
  overflow: visible;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--forest-green), var(--sage));
  border-radius: 20px;
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-leaf {
  position: absolute;
  top: -8px;
  transform: translateX(-50%);
  animation: leafBob 3s ease-in-out infinite;
}

@keyframes leafBob {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(0); }
  50% { transform: translateX(-50%) translateY(-3px) rotate(5deg); }
}

.plan-upgrade {
  display: block;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--forest-green);
  text-decoration: none;
  padding: 8px;
  border: 1px solid rgba(22, 101, 52, 0.2);
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

.plan-upgrade:hover {
  background: var(--forest-green);
  color: var(--warm-cream);
  border-color: var(--forest-green);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 0 32px 40px;
  position: relative;
}

.wavy-divider, .wavy-divider-bottom {
  width: 100%;
  line-height: 0;
  margin-bottom: 8px;
}

.wavy-divider svg, .wavy-divider-bottom svg {
  width: 100%;
  height: 40px;
}

.wavy-divider-bottom {
  margin-top: 20px;
  margin-bottom: 0;
}

.content-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-top: 8px;
}

.content-header h1 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--earth-dark);
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.87rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.date-display {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.87rem;
  color: var(--text-secondary);
  background: var(--warm-cream);
  padding: 8px 16px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
}

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

.stat-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.4s ease;
}

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

.stat-decoration {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 60px;
  height: 40px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.stat-icon-messages {
  background: rgba(22, 101, 52, 0.1);
  color: var(--forest-green);
}

.stat-icon-spam {
  background: rgba(194, 65, 12, 0.1);
  color: var(--terracotta);
}

.stat-icon-fp {
  background: rgba(180, 83, 9, 0.1);
  color: var(--ochre);
}

.stat-icon-rate {
  background: rgba(107, 142, 107, 0.15);
  color: var(--sage);
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--earth-dark);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.73rem;
  font-weight: 600;
  margin-top: 6px;
}

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

/* Cards */
.card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

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

.card-header h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--earth-dark);
}

.card-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.view-all {
  font-size: 0.8rem;
  color: var(--forest-green);
  text-decoration: none;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(22, 101, 52, 0.2);
  transition: all 0.3s ease;
}

.view-all:hover {
  background: var(--forest-green);
  color: white;
}

/* Chart Card */
.chart-container {
  position: relative;
  height: 260px;
}

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

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

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

/* Two Column Layout */
.two-col {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

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

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

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

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

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

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

.threats-table td {
  padding: 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

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

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

.threats-table tr:hover {
  background: rgba(254, 243, 199, 0.3);
}

.source-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.82rem;
}

.source-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.source-icon.phishing { background: var(--terracotta); }
.source-icon.bulk { background: var(--ochre); }
.source-icon.malware { background: var(--forest-green); }
.source-icon.scam { background: var(--sage); }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--radius-xl);
  font-size: 0.73rem;
  font-weight: 600;
}

.badge-critical {
  background: rgba(194, 65, 12, 0.1);
  color: var(--terracotta);
}

.badge-high {
  background: rgba(180, 83, 9, 0.1);
  color: var(--ochre);
}

.badge-medium {
  background: rgba(107, 142, 107, 0.15);
  color: var(--earth-medium);
}

/* Categories Chart */
.categories-chart {
  display: flex;
  align-items: center;
  gap: 24px;
}

.donut-container {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.donut-container canvas {
  width: 140px;
  height: 140px;
}

.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.donut-total {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--earth-dark);
  line-height: 1.2;
}

.donut-label {
  font-size: 0.67rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.categories-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}

.cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cat-name {
  flex: 1;
  color: var(--text-secondary);
}

.cat-value {
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-heading);
}

/* Blocked Domains */
.blocked-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.blocked-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.blocked-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  flex-shrink: 0;
}

.blocked-info {
  flex: 1;
  min-width: 0;
}

.blocked-domain {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  display: block;
  margin-bottom: 4px;
}

.blocked-bar-track {
  height: 6px;
  background: var(--parchment-dark);
  border-radius: 20px;
  overflow: hidden;
}

.blocked-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--ochre), var(--terracotta));
  border-radius: 20px;
  transition: width 1s ease;
}

.blocked-count {
  font-family: var(--font-heading);
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 48px;
  text-align: right;
}

/* Quick Actions */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: white;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

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

.action-scan:hover {
  border-color: var(--forest-green);
  color: var(--forest-green);
  background: rgba(22, 101, 52, 0.04);
}

.action-whitelist:hover {
  border-color: var(--sage);
  color: var(--sage);
  background: rgba(107, 142, 107, 0.06);
}

.action-report:hover {
  border-color: var(--ochre);
  color: var(--ochre);
  background: rgba(180, 83, 9, 0.04);
}

.action-rules:hover {
  border-color: var(--warm-brown);
  color: var(--warm-brown);
  background: rgba(139, 105, 20, 0.04);
}

.action-block:hover {
  border-color: var(--terracotta);
  color: var(--terracotta);
  background: rgba(194, 65, 12, 0.04);
}

.action-release:hover {
  border-color: var(--forest-green);
  color: var(--forest-green);
  background: rgba(22, 101, 52, 0.04);
}

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

  .two-col {
    grid-template-columns: 1fr;
  }

  .actions-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .nav-links {
    display: none;
  }

  .user-details {
    display: none;
  }

  .actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .main-content {
    padding: 0 16px 24px;
  }

  .topnav-inner {
    padding: 0 16px;
  }

  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .categories-chart {
    flex-direction: column;
  }

  .actions-grid {
    grid-template-columns: 1fr 1fr;
  }
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Smooth transitions for all interactive elements */
a, button {
  transition: all 0.3s ease;
}

/* Selection color */
::selection {
  background: rgba(22, 101, 52, 0.15);
  color: var(--earth-dark);
}
