/* =============================================================
   SECURITY DASHBOARD PREMIUM STYLES
   No Emojis allowed — Styled with modern HSL tokens and Material Symbols
   ============================================================= */

/* HEADER & ALERT BANNER */
.security-dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.dashboard-title {
  color: var(--cg-text-1, #ffffff);
}

.dashboard-subtitle {
  color: var(--cg-text-3, #94a3b8);
}

/* STAT CARDS */
.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1366px) {
  .stat-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .stat-cards-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--cg-bg-surface, #111111);
  border: 1px solid var(--cg-border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--cg-shadow-sm);
}

.stat-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: var(--cg-shadow-md);
}

/* Accent borders */
.stat-card.critical {
  border-left: 3px solid var(--cg-danger, #ef4444);
}
.stat-card.total {
  border-left: 3px solid rgba(255, 255, 255, 0.25);
}
.stat-card.resolved {
  border-left: 3px solid rgba(255, 255, 255, 0.25);
}
.stat-card.targets {
  border-left: 3px solid rgba(255, 255, 255, 0.25);
}

.stat-card-icon-container {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-content {
  flex: 1;
}

.stat-card-label {
  font-size: 13px;
  color: var(--cg-text-1, #ffffff);
  font-weight: 500;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--cg-text-1, #ffffff);
  line-height: 1.2;
  margin: 4px 0;
}

.stat-card-subtext {
  font-size: 12px;
  font-weight: 600;
}

/* CHARTS ROW & PANELS */
.dashboard-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1366px) {
  .dashboard-charts-row {
    grid-template-columns: 1fr;
  }
}

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

@media (max-width: 1366px) {
  .dashboard-bottom-row {
    grid-template-columns: 1fr;
  }
}

.dashboard-panel {
  background: var(--cg-bg-surface, #111111);
  border: 1px solid var(--cg-border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--cg-shadow-md);
}

.dashboard-panel-header {
  border-bottom: 1px solid var(--cg-border-subtle, rgba(255, 255, 255, 0.08));
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.dashboard-panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--cg-text-1, #ffffff);
}

.dashboard-panel-subtitle {
  font-size: 13px;
  color: var(--cg-text-3, #94a3b8);
  margin-top: 4px;
}

/* RISK SCORE GUAGE */
.risk-score-display-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 150px;
  height: 150px;
}

.risk-circle-svg-container {
  transform: rotate(-90deg);
}

.risk-circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 8;
}

.risk-circle-value {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-out, stroke 0.5s ease;
}

.risk-score-inner-text-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* RISK LIST */
.risk-target-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
}

.risk-target-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--cg-text-2, #cbd5e1);
  width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.risk-mini-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  overflow: hidden;
}

.risk-mini-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.risk-score-value {
  font-size: 13px;
  font-weight: 700;
  font-family: monospace;
  width: 28px;
  text-align: right;
}

/* DONUT CHART */
.severity-donut-chart-container {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: background 0.8s ease;
}

.donut-center-overlay {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 10;
  pointer-events: none;
  /* Horizontally + vertically centered within the wrapper */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* SEVERITY BARS LIST */
.severity-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.severity-label {
  width: 76px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.severity-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  overflow: hidden;
}

.severity-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.severity-count {
  width: 32px;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--cg-text-1, #ffffff);
  font-family: monospace;
}

/* ACTIVE SCANS LIST */
.active-scan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--cg-border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  margin-bottom: 8px;
  transition: border-color 0.2s ease;
}

.active-scan-row:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.scan-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
  margin-right: 16px;
}

.scan-target-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--cg-text-2, #cbd5e1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scan-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--cg-text-3, #94a3b8);
}

.scan-type {
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.scan-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 160px;
  flex-shrink: 0;
}

.scan-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  overflow: hidden;
}

.scan-progress-fill {
  height: 100%;
  background: var(--cg-info, #3b82f6);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.scan-progress-text {
  font-size: 12px;
  font-weight: 700;
  font-family: monospace;
  color: var(--cg-text-2, #cbd5e1);
  width: 36px;
  text-align: right;
}

.scan-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--cg-success, #10b981);
  border: 1px solid rgba(16, 185, 129, 0.2);
  flex-shrink: 0;
}

.scan-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--cg-success, #22c55e);
}

/* RECENT FINDINGS TABLE */
.recent-finding-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--cg-border-subtle, rgba(255, 255, 255, 0.08));
  gap: 12px;
}

.recent-finding-row:last-child {
  border-bottom: none;
}

.finding-severity-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  width: 76px;
  text-align: center;
  flex-shrink: 0;
}

.finding-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.finding-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--cg-text-2, #cbd5e1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finding-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--cg-text-3, #94a3b8);
}

.finding-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: capitalize;
  flex-shrink: 0;
}

.finding-status-badge.open {
  background: rgba(239, 68, 68, 0.1);
  color: var(--cg-danger, #ef4444);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.finding-status-badge.resolved,
.finding-status-badge.fixed {
  background: rgba(34, 197, 94, 0.1);
  color: var(--cg-success, #22c55e);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.finding-status-badge.accepted {
  background: rgba(59, 130, 246, 0.1);
  color: var(--cg-info, #3b82f6);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* SKELETON STATE */
.dashboard-skeleton {
  animation: skeletonPulse 1.5s ease-in-out infinite;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

@keyframes skeletonPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

/* EMPTY STATE */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--cg-text-3, #94a3b8);
  height: 100%;
  min-height: 200px;
}

.empty-icon-text {
  font-size: 32px;
  margin-bottom: 12px;
  color: var(--cg-text-3, #94a3b8);
  font-weight: 300;
}

.empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--cg-text-2, #cbd5e1);
  margin-bottom: 4px;
}

.empty-sub {
  font-size: 12px;
  color: var(--cg-text-3, #94a3b8);
}

/* ===== Security Dashboard Responsive Rules ===== */

.stat-card-value {
  font-size: clamp(20px, 2.2vw, 28px);
}

@media (max-width: 1280px) {
  .stat-cards-grid {
    gap: 12px;
  }
  .stat-card {
    padding: 14px;
    gap: 12px;
  }
}

@media (max-width: 1366px) {
  .dashboard-charts-row,
  .dashboard-bottom-row {
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .risk-score-display-container {
    width: 120px;
    height: 120px;
  }
  
  .severity-donut-chart-container {
    width: 120px;
    height: 120px;
  }
  
  .donut-center-overlay {
    width: 80px;
    height: 80px;
  }
}

@media (max-width: 640px) {
  .active-scan-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
  }
  
  .scan-progress {
    width: 100%;
  }
  
  .recent-finding-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 8px;
  }
  
  .finding-severity-badge {
    width: auto;
    padding: 2px 6px;
    text-align: left;
  }
  
  .risk-target-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px;
  }
  
  .risk-target-name {
    width: 100%;
  }
  
  .risk-mini-bar {
    width: 100%;
    height: 4px;
  }
  
  .risk-score-value {
    width: auto;
    text-align: left;
  }
}

/* =============================================================
   DASHBOARD REDESIGN 2026
   UI-only visual layer. Keeps existing IDs and JS-rendered hooks intact.
   ============================================================= */

#security-dashboard {
  position: relative;
  isolation: isolate;
  padding: 4px 0 10px;
}

#security-dashboard::before {
  content: "";
  position: absolute;
  inset: -18px -18px auto -18px;
  height: 360px;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(96, 165, 250, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, 0.028) 1px, transparent 1px),
    linear-gradient(135deg, rgba(59, 130, 246, 0.14), transparent 58%);
  background-size: 44px 44px, 44px 44px, auto;
  mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
}

.security-dashboard-header {
  position: relative;
  overflow: hidden;
  align-items: flex-start;
  gap: 18px;
  min-height: 142px;
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.88), rgba(6, 8, 13, 0.95) 62%),
    linear-gradient(90deg, rgba(59, 130, 246, 0.12), rgba(148, 163, 184, 0.04));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.security-dashboard-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.9), rgba(20, 184, 166, 0.56), rgba(148, 163, 184, 0.22));
}

.security-dashboard-header > * {
  position: relative;
  z-index: 1;
}

.dashboard-title {
  font-size: 38px;
  line-height: 0.98;
  letter-spacing: 0;
  margin: 0;
}

.dashboard-subtitle {
  max-width: 640px;
  margin-top: 10px !important;
  color: #9aa9bb !important;
  font-size: 14px;
  line-height: 1.6;
}

.dashboard-date-range {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: 7px !important;
  background: rgba(2, 6, 23, 0.58) !important;
  border-color: rgba(148, 163, 184, 0.18) !important;
  color: #cbd5e1 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.security-dashboard-header .cyber-btn-primary {
  min-height: 36px;
  border-radius: 7px !important;
  background: #f8fafc !important;
  color: #111827 !important;
  border: 1px solid rgba(255, 255, 255, 0.7) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

.security-dashboard-header .cyber-btn-primary:hover {
  transform: translateY(-1px);
  background: #ffffff !important;
}

.stat-cards-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  align-items: flex-end;
  padding: 18px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(8, 10, 14, 0.94)),
    rgba(8, 10, 14, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.13);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: rgba(96, 165, 250, 0.72);
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.08), transparent 42%);
  opacity: 0;
  transition: opacity 180ms ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(96, 165, 250, 0.28);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

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

.stat-card.critical::before {
  background: rgba(248, 113, 113, 0.9);
}

.stat-card-icon-container {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.76) !important;
  border-color: rgba(148, 163, 184, 0.16) !important;
  color: #9aa9bb !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.stat-card.critical .stat-card-icon-container {
  color: #fca5a5 !important;
  border-color: rgba(248, 113, 113, 0.24) !important;
  background: rgba(127, 29, 29, 0.18) !important;
}

.stat-card-content {
  position: relative;
  z-index: 1;
  padding-right: 58px;
}

.stat-card-label {
  color: #dbe6f4;
  font-size: 13px;
  font-weight: 700;
}

.stat-card-value {
  margin: 8px 0 3px;
  color: #f8fafc;
  font-size: 34px;
  line-height: 0.95;
  letter-spacing: 0;
}

.stat-card-subtext {
  color: #8aa0ba !important;
  font-size: 12px;
  font-weight: 700;
}

.stat-card.critical .stat-card-subtext {
  color: #fca5a5 !important;
}

.dashboard-charts-row,
.dashboard-bottom-row {
  gap: 18px;
}

.dashboard-panel {
  position: relative;
  overflow: hidden;
  min-height: 330px;
  padding: 24px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(13, 17, 24, 0.94), rgba(7, 9, 13, 0.96)),
    rgba(8, 10, 14, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.13);
  box-shadow: 0 22px 65px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.dashboard-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.44), transparent);
}

.dashboard-panel-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 58px;
  margin: -24px -24px 22px;
  padding: 18px 24px 16px;
  border-bottom-color: rgba(148, 163, 184, 0.12);
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.72), rgba(8, 10, 14, 0.2));
}

.dashboard-panel-title {
  color: #f8fafc;
  font-size: 16px;
  letter-spacing: 0;
}

.dashboard-panel-subtitle {
  color: #8393a8;
  font-size: 13px;
}

.risk-score-layout,
.severity-chart-layout {
  position: relative;
  z-index: 1;
  min-height: 210px;
}

.risk-score-display-container {
  width: 164px;
  height: 164px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.34);
}

.risk-target-row {
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.46);
  border-color: rgba(148, 163, 184, 0.1);
}

.risk-target-row:hover {
  border-color: rgba(96, 165, 250, 0.22);
  background: rgba(15, 23, 42, 0.64);
}

.risk-target-name {
  color: #cbd5e1;
  font-weight: 600;
}

.risk-mini-bar,
.severity-bar-track,
.scan-progress-bar {
  background: rgba(148, 163, 184, 0.11);
}

.severity-donut-wrapper {
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.32));
}

.donut-center-overlay {
  background: rgba(6, 8, 12, 0.96) !important;
  border-color: rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.severity-bar-row {
  min-height: 26px;
}

.severity-label {
  color: #cbd5e1 !important;
  font-size: 11px;
}

.severity-count {
  color: #e2e8f0;
}

#active-scans-container,
#recent-findings-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(96, 165, 250, 0.35) transparent;
}

.active-scan-row,
.recent-finding-row {
  position: relative;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(9, 12, 17, 0.72) !important;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.active-scan-row:hover,
.recent-finding-row:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.24);
  background: rgba(13, 18, 27, 0.9) !important;
}

.recent-finding-row {
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.finding-title,
.scan-target-name {
  color: #dbe6f4;
  font-weight: 650;
}

.finding-meta,
.scan-meta {
  color: #7f8fa3;
}

.finding-severity-badge,
.finding-status-badge,
.scan-status-badge {
  border-radius: 7px;
}

.empty-state {
  min-height: 245px;
  border: 1px dashed rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.28);
}

.empty-icon-text {
  color: #6f8096;
}

@media (max-width: 1366px) {
  .stat-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .security-dashboard-header {
    flex-direction: column;
    min-height: 0;
  }

  .security-dashboard-header > .flex {
    width: 100%;
    flex-wrap: wrap;
  }

  .dashboard-date-range,
  .security-dashboard-header .cyber-btn-primary {
    flex: 1 1 auto;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  #security-dashboard::before {
    inset: -12px -12px auto -12px;
  }

  .security-dashboard-header,
  .dashboard-panel,
  .stat-card {
    padding: 18px;
  }

  .dashboard-panel-header {
    margin: -18px -18px 18px;
    padding: 16px 18px;
  }

  .stat-cards-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-title {
    font-size: 28px;
  }

  .stat-card-value {
    font-size: 28px;
  }

  .stat-card-content {
    padding-right: 54px;
  }
}
