/* ===== NEUMORPHISM (SOFT UI) DESIGN SYSTEM ===== */

:root {
  --bg: #e0e5ec;
  --shadow-dark: #bebebe;
  --shadow-light: #ffffff;
  --accent: #5B9BD5;
  --accent-hover: #4a8bc4;
  --text-primary: #3a3f47;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --shadow-raised: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
  --shadow-raised-sm: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
  --shadow-pressed: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
  --shadow-pressed-deep: inset 6px 6px 12px var(--shadow-dark), inset -6px -6px 12px var(--shadow-light);
  --transition: 0.25s ease;
}

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

body {
  font-family: 'Nunito Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== UTILITY CLASSES ===== */

.neu-raised {
  background: var(--bg);
  box-shadow: var(--shadow-raised);
  border: none;
}

.neu-pressed {
  background: var(--bg);
  box-shadow: var(--shadow-pressed);
  border: none;
}

/* ===== TOP NAV ===== */

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  margin: 16px 16px 0;
  border-radius: var(--radius-lg);
  position: sticky;
  top: 16px;
  z-index: 100;
}

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

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

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

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

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  box-shadow: var(--shadow-raised-sm);
}

.nav-link.active {
  color: var(--accent);
  box-shadow: var(--shadow-pressed);
}

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

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  background: var(--bg);
  border: none;
}

.icon-btn:hover {
  box-shadow: var(--shadow-raised-sm);
}

.icon-btn:active {
  box-shadow: var(--shadow-pressed);
}

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

.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.user-area:hover {
  box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
}

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

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

/* ===== LAYOUT ===== */

.layout {
  display: flex;
  gap: 20px;
  padding: 20px 16px 30px;
  min-height: calc(100vh - 90px);
}

/* ===== SIDEBAR ===== */

.sidebar {
  width: 240px;
  min-width: 240px;
  border-radius: var(--radius-lg);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 96px;
  height: calc(100vh - 112px);
  overflow-y: auto;
}

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

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
}

.sidebar-item:hover {
  color: var(--text-primary);
}

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

.sidebar-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.sidebar-item:hover .sidebar-icon.neu-raised {
  box-shadow: var(--shadow-raised-sm);
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.plan-badge {
  padding: 14px;
  border-radius: var(--radius);
  text-align: center;
}

.plan-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.plan-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent);
}

.usage-section {
  padding: 0 4px;
}

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

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

.usage-value {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

.usage-track {
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  padding: 2px;
}

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

/* ===== MAIN CONTENT ===== */

.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 4px 0;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.btn-neu {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg);
  border: none;
  color: var(--text-secondary);
}

.btn-neu:hover {
  color: var(--text-primary);
  box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
}

.btn-neu:active {
  box-shadow: var(--shadow-pressed);
}

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

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

.btn-sm {
  padding: 7px 14px;
  font-size: 0.8rem;
}

/* ===== STAT CARDS ===== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.stat-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.stat-icon-wrap {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value-box {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

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

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

.stat-change.negative {
  color: var(--danger);
}

/* ===== TWO-COL LAYOUT ===== */

.two-col {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
}

/* ===== CHART PANEL ===== */

.chart-panel, .categories-panel, .threats-panel, .blocked-panel, .actions-panel {
  border-radius: var(--radius-lg);
  padding: 22px;
}

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

.panel-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

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

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

.chart-area {
  height: 250px;
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow-pressed);
}

.chart-area canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ===== CATEGORIES ===== */

.categories-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

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

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

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

.progress-track {
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  padding: 3px;
}

.progress-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.8s ease;
}

/* ===== THREATS TABLE ===== */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

.threats-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
}

.threats-table thead tr {
  border-radius: var(--radius-sm);
}

.threats-table thead tr.neu-pressed {
  box-shadow: var(--shadow-pressed);
}

.threats-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.threats-table th:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.threats-table th:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.threats-table td {
  padding: 12px 14px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg);
  vertical-align: middle;
}

.threats-table tbody tr {
  transition: var(--transition);
}

.threats-table tbody tr:hover td {
  box-shadow: var(--shadow-raised-sm);
}

.threats-table tbody tr td:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.threats-table tbody tr td:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sender-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary) !important;
  font-size: 0.8rem !important;
}

.tag {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-raised-sm);
}

.tag-phishing { color: var(--accent); }
.tag-scam { color: var(--warning); }
.tag-malware { color: var(--danger); }
.tag-marketing { color: #8b5cf6; }

.conf-bar {
  display: inline-block;
  width: 60px;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 8px;
  padding: 2px;
}

.conf-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}

.conf-val {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.status-badge {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.blocked {
  color: var(--danger);
  box-shadow: var(--shadow-pressed);
}

.status-badge.quarantine {
  color: var(--warning);
  box-shadow: var(--shadow-pressed);
}

/* ===== BOTTOM ROW ===== */

.bottom-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}

/* ===== BLOCKED DOMAINS ===== */

.blocked-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.blocked-rank {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-secondary);
}

.blocked-info {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
}

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

.blocked-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.blocked-bar-wrap {
  flex: 1;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  padding: 2px;
}

.blocked-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.8s ease;
}

/* ===== QUICK ACTIONS ===== */

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

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg);
  border: none;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.action-btn:hover {
  color: var(--accent);
  box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
}

.action-btn:active {
  box-shadow: var(--shadow-pressed-deep);
  transform: scale(0.97);
}

.action-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-raised-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: var(--transition);
}

.action-btn:active .action-icon {
  box-shadow: var(--shadow-pressed);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 1280px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .two-col {
    grid-template-columns: 1fr;
  }
  .bottom-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .sidebar {
    display: none;
  }
  .topnav {
    margin: 10px 10px 0;
    padding: 10px 16px;
  }
  .layout {
    padding: 14px 10px 24px;
  }
  .nav-links {
    display: none;
  }
}

@media (max-width: 680px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .topnav-left {
    gap: 12px;
  }
  .user-name {
    display: none;
  }
  .actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .blocked-info {
    flex: 0 0 140px;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* ===== SCROLLBAR ===== */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: var(--shadow-dark);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}
