/* ==================================== */
/* Dashboard Styles                     */
/* ==================================== */

.dashboard {
  width: 100%;
}

.dashboard[hidden] {
  display: none;
}

/* ==================================== */
/* HEADER                               */
/* ==================================== */
.dashboard-header {
  position: sticky;
  top: -24px;  /* Compensate for parent padding */
  z-index: 10;
  background: rgba(249, 245, 240, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin: -24px -24px 24px -24px;
  padding: 16px 24px;
}

.dashboard-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
  height: 1px;
  background: var(--border-light);
}

/* Single row layout: title left, login button right */
.dashboard-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Login button icon wrapper in dashboard */
.dashboard-header-row .login-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dashboard-header-row .login-btn-icon svg {
  width: 16px;
  height: 16px;
}

.dashboard-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 36px;
}

/* ==================================== */
/* SECTION                              */
/* ==================================== */
.dashboard-section {
  margin-bottom: 32px;
}

.dashboard-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.dashboard-section-icon {
  width: 20px;
  height: 20px;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.dashboard-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* ==================================== */
/* CARD GRID                            */
/* ==================================== */
.dashboard-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

/* ==================================== */
/* SCORE CARD                           */
/* ==================================== */
.dashboard-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.dashboard-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.dashboard-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  flex: 1;
}

.dashboard-card-badge {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-sidebar-hover);
  border-radius: var(--border-radius-sm);
  flex-shrink: 0;
}

.dashboard-card-badge svg {
  width: 14px;
  height: 14px;
  color: var(--accent-primary);
}

.dashboard-card-shortname {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==================================== */
/* HISTORY CARD                         */
/* ==================================== */
.dashboard-card--history {
  padding: 12px 14px;
}

.dashboard-card--history .dashboard-card-header {
  margin-bottom: 4px;
}

.dashboard-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-card-result {
  font-size: 14px;
  font-weight: 700;
}

.dashboard-card-result--low {
  color: #5D8A66;
}

.dashboard-card-result--intermediate {
  color: #ca8a04;
}

.dashboard-card-result--high {
  color: #ea580c;
}

.dashboard-card-result--critical {
  color: #C45C5C;
}

.dashboard-card-time {
  font-size: 11px;
  color: var(--text-muted);
}

.dashboard-card-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-sidebar-hover);
  padding: 2px 8px;
  border-radius: 10px;
}

.dashboard-card-risk {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
}

.dashboard-card-risk--low {
  background: rgba(93, 138, 102, 0.12);
  color: #5D8A66;
}

.dashboard-card-risk--intermediate {
  background: rgba(202, 138, 4, 0.12);
  color: #ca8a04;
}

.dashboard-card-risk--high {
  background: rgba(234, 88, 12, 0.12);
  color: #ea580c;
}

.dashboard-card-risk--critical {
  background: rgba(196, 92, 92, 0.12);
  color: #C45C5C;
}

/* ==================================== */
/* CATEGORY BLOCK                       */
/* ==================================== */
.dashboard-category {
  margin-bottom: 24px;
}

.dashboard-category:last-child {
  margin-bottom: 0;
}

.dashboard-category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.dashboard-category-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(217, 119, 87, 0.1);
  border-radius: var(--border-radius-sm);
}

.dashboard-category-icon svg {
  width: 16px;
  height: 16px;
  color: var(--accent-primary);
}

.dashboard-category-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.dashboard-category-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-sidebar-hover);
  padding: 2px 8px;
  border-radius: 10px;
}

/* ==================================== */
/* EMPTY STATE                          */
/* ==================================== */
.dashboard-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.dashboard-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  opacity: 0.4;
}

.dashboard-empty-text {
  font-size: 14px;
  margin: 0;
}

/* ==================================== */
/* RESPONSIVE                           */
/* ==================================== */
@media (max-width: 768px) {
  .dashboard-header {
    margin: -16px -16px 24px -16px;
    padding: 12px 16px;
    top: -16px;
  }

  .dashboard-section {
    margin-bottom: 24px;
  }

  .dashboard-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }

  .dashboard-card {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .dashboard-header {
    margin: -12px -12px 24px -12px;
    padding: 12px;
    top: -12px;
  }

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

  .dashboard-card-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .dashboard-card-name {
    font-size: 12px;
  }

  .dashboard-card-badge {
    width: 20px;
    height: 20px;
  }

  .dashboard-card-badge svg {
    width: 12px;
    height: 12px;
  }
}

/* ==================================== */
/* DARK THEME                           */
/* ==================================== */
[data-theme="dark"] .dashboard-card-result--low {
  color: #4ade80;
}

[data-theme="dark"] .dashboard-card-result--intermediate {
  color: #fbbf24;
}

[data-theme="dark"] .dashboard-card-result--high {
  color: #fb923c;
}

[data-theme="dark"] .dashboard-card-result--critical {
  color: #f87171;
}

[data-theme="dark"] .dashboard-card-risk--low {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

[data-theme="dark"] .dashboard-card-risk--intermediate {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

[data-theme="dark"] .dashboard-card-risk--high {
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
}

[data-theme="dark"] .dashboard-card-risk--critical {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
}
