/* ============================================
   DASHBOARD.CSS — Styles trang Dashboard
   Mitalab Product Evaluation Tracker — Sprint 4
   ============================================ */


/* ============================================
   SUMMARY CARDS — 5 thẻ thống kê
   ============================================ */

.dash-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.dash-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  border-left: 4px solid transparent;
  transition: box-shadow var(--transition), transform var(--transition);
}

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

/* Màu viền trái theo loại thẻ */
.dash-card.total     { border-left-color: #1976D2; }
.dash-card.active    { border-left-color: #FF6F00; }
.dash-card.completed { border-left-color: #2E7D32; }
.dash-card.overdue   { border-left-color: #C62828; }
.dash-card.tasks     { border-left-color: #6A1B9A; }

.dash-card-icon {
  font-size: 32px;
  flex-shrink: 0;
}

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

.dash-card-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

.dash-card-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badge đỏ cho overdue > 0 */
.dash-card.overdue .dash-card-value.has-overdue {
  color: var(--danger);
}


/* ============================================
   CHARTS GRID — 2×2
   ============================================ */

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

.dash-chart-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

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

.dash-chart-wrap {
  flex: 1;
  position: relative;
  min-height: 220px;
}

.dash-chart-wrap canvas {
  max-height: 280px;
}


/* ============================================
   BOTTOM SECTION — 2 bảng song song
   ============================================ */

.dash-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dash-section {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 260px;
}

.dash-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Bảng chung trong dashboard */
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dash-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 8px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.dash-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.dash-table tbody tr:hover {
  background: #F5F7FA;
}

.dash-table .project-link {
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
}

.dash-table .project-link:hover {
  text-decoration: underline;
}

/* Badge "Còn lại" theo màu */
.days-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.days-badge.green  { background: #E8F5E9; color: #2E7D32; }
.days-badge.yellow { background: #FFF8E1; color: #F57F17; }
.days-badge.red    { background: #FFEBEE; color: #C62828; }

/* Activity log entries */
.activity-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.activity-entry:last-child { border-bottom: none; }

.activity-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.activity-line {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-time {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.activity-action-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  margin-right: 4px;
}

.activity-action-badge.create { background: #E8F5E9; color: #2E7D32; }
.activity-action-badge.update { background: #E3F2FD; color: #1565C0; }
.activity-action-badge.delete { background: #FFEBEE; color: #C62828; }

/* Empty state trong section */
.dash-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 13px;
  gap: 8px;
}

.dash-empty-icon { font-size: 32px; }


/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton {
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: 4px;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skel-card {
  height: 88px;
  border-radius: var(--radius);
}

.skel-chart {
  height: 280px;
  border-radius: var(--radius);
}

.skel-table-row {
  height: 36px;
  margin-bottom: 8px;
}

.dash-skeleton-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.dash-skeleton-charts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.dash-skeleton-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dash-skeleton-section {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.dash-skeleton-section .skel-table-row:last-child {
  margin-bottom: 0;
}


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

@media (max-width: 1200px) {
  .dash-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

  .dash-charts {
    grid-template-columns: 1fr;
  }

  .dash-bottom {
    grid-template-columns: 1fr;
  }

  .dash-skeleton-cards  { grid-template-columns: repeat(2, 1fr); }
  .dash-skeleton-charts { grid-template-columns: 1fr; }
  .dash-skeleton-bottom { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .dash-cards {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .dash-card {
    padding: 14px;
    gap: 10px;
  }

  .dash-card-value { font-size: 22px; }
  .dash-card-icon  { font-size: 24px; }
}
