/* ========================================================================
   DNSai Dashboard — Styles
   Uses CSS custom properties from theme.css for dark/light mode support.
   ======================================================================== */

.dashboard {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* --- Summary Cards Row --- */
.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.summary-card:hover {
  box-shadow: var(--card-hover-shadow);
}

.summary-card--attention .summary-value {
  color: var(--color-warning);
}

.summary-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.summary-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

/* --- Charts Row --- */
.dashboard-charts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 20px;
  transition: box-shadow 0.3s ease;
}

.chart-card:hover {
  box-shadow: var(--card-hover-shadow);
}

.chart-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px;
}

.chart-container {
  position: relative;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
}

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

.chart-container--bar {
  max-width: 100%;
  height: 260px;
}

.chart-container--bar canvas {
  height: 100% !important;
}

/* --- Chart Legends --- */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: center;
  margin-top: 14px;
  font-size: 13px;
}

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

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-label {
  white-space: nowrap;
}

.legend-count {
  color: var(--text-muted);
  font-size: 12px;
}

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

.feed-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 20px;
  transition: box-shadow 0.3s ease;
  max-height: 440px;
  display: flex;
  flex-direction: column;
}

.feed-card:hover {
  box-shadow: var(--card-hover-shadow);
}

.change-feed,
.attention-panel {
  overflow-y: auto;
  flex: 1;
}

.feed-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 14px;
}

.feed-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 14px;
}

/* --- Change Feed Items --- */
.change-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-default);
  font-size: 13px;
}

.change-item:last-child {
  border-bottom: none;
}

.change-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background-color: var(--bg-surface);
  color: var(--color-info);
}

.change-body {
  flex: 1;
  min-width: 0;
}

.change-domain {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.change-detail {
  color: var(--text-muted);
  margin-top: 2px;
  font-size: 12px;
}

.change-detail .old-val {
  color: var(--color-error);
  text-decoration: line-through;
}

.change-detail .new-val {
  color: var(--color-success);
}

.change-time {
  flex-shrink: 0;
  color: var(--text-dimmed);
  font-size: 11px;
  white-space: nowrap;
  padding-top: 2px;
}

/* --- Attention Panel Items --- */
.attention-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-default);
  font-size: 13px;
}

.attention-item:last-child {
  border-bottom: none;
}

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

.attention-badge--critical {
  background-color: var(--color-error);
}

.attention-badge--warning {
  background-color: var(--color-warning);
}

.attention-label {
  flex: 1;
  color: var(--text-secondary);
}

.attention-count {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

/* --- Skeleton Loading --- */
.skeleton {
  background: var(--bg-surface);
  border-radius: 6px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

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

@media (max-width: 600px) {
  .dashboard {
    padding: 16px 12px 40px;
  }
  .dashboard-summary {
    grid-template-columns: 1fr;
  }
  .summary-value {
    font-size: 1.5rem;
  }
}
