/* =========================================================
   dashboard-d1.css
   ---------------------------------------------------------
   Giao diện Dashboard phỏng theo file mẫu "d1.html" do người
   dùng cung cấp — KHÔNG bao gồm phần sidebar riêng của d1.html
   (dự án đã có sidebar cố định của chính nó ở 00-shell-open.html,
   vẫn được giữ nguyên).

   Toàn bộ selector bên dưới đều được lồng trong
   "#dashboardView .dashboard-d1" để:
     1) Không đụng tên class với style.css dùng chung toàn app
        (vd: .topbar, .stat-card, .table, .btn, .icon-btn... đang
        được rất nhiều màn hình khác tái sử dụng).
     2) Chỉ áp dụng cho đúng nội dung bên trong trang Dashboard.

   Các id chức năng (statTotal, monthlyTrendChart, v.v...) và các
   thuộc tính data-stat-type / data-i18n vẫn được giữ nguyên trong
   public/views/01-dashboard.html để không phá vỡ public/js/dashboard.js
   và public/js/app.js hiện có.
   ========================================================= */

#dashboardView .dashboard-d1 {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --pink: #ec4899;
  --purple: #8b5cf6;
  --dark: #1e293b;
  --gray: #64748b;
  --light: #f1f5f9;
  --white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
  --radius: 14px;

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#dashboardView .dashboard-d1 *,
#dashboardView .dashboard-d1 *::before,
#dashboardView .dashboard-d1 *::after {
  box-sizing: border-box;
}

/* ========== TOPBAR ========== */
#dashboardView .dashboard-d1 .topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 28px; gap: 20px; flex-wrap: wrap;
}
#dashboardView .dashboard-d1 .page-title h1 {
  font-size: 26px; font-weight: 800; color: var(--dark); letter-spacing: -0.5px; margin: 0;
}
#dashboardView .dashboard-d1 .page-title p {
  font-size: 14px; color: var(--gray); margin: 2px 0 0;
}
#dashboardView .dashboard-d1 .topbar-actions {
  display: flex; align-items: center; gap: 12px; margin: 0;
}
#dashboardView .dashboard-d1 .search-box { position: relative; display: flex; align-items: center; }
#dashboardView .dashboard-d1 .search-box i {
  position: absolute; left: 14px; color: var(--gray); font-size: 14px; pointer-events: none;
}
#dashboardView .dashboard-d1 .search-box input {
  padding: 10px 16px 10px 38px;
  border: 1px solid #e2e8f0; border-radius: 10px;
  background: white; font-size: 14px; font-family: inherit;
  width: 240px; outline: none; transition: all 0.2s;
}
#dashboardView .dashboard-d1 .search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
  width: 280px;
}
#dashboardView .dashboard-d1 .icon-btn {
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid #e2e8f0; background: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--gray); transition: all 0.2s; position: relative;
}
#dashboardView .dashboard-d1 .icon-btn i,
#dashboardView .dashboard-d1 .icon-btn svg { width: 16px; height: 16px; }
#dashboardView .dashboard-d1 .icon-btn:hover {
  background: var(--light); color: var(--primary); border-color: var(--primary-light);
}
#dashboardView .dashboard-d1 .icon-btn--primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white; border-color: transparent;
}
#dashboardView .dashboard-d1 .icon-btn--primary:hover {
  color: white; filter: brightness(1.05); transform: translateY(-2px);
}

/* ========== SECTION LABEL ========== */
#dashboardView .dashboard-d1 .section-label {
  font-size: 12px; font-weight: 700; color: var(--gray);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
#dashboardView .dashboard-d1 .section-label::before {
  content: ''; width: 3px; height: 14px;
  background: var(--primary); border-radius: 3px;
}

/* ========== STATS (4 chỉ số chính) ========== */
#dashboardView .dashboard-d1 .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px; margin-bottom: 28px;
}
#dashboardView .dashboard-d1 .stat-card {
  background: white; padding: 22px; border-radius: var(--radius);
  box-shadow: var(--shadow-sm); border: 1px solid #f1f5f9;
  transition: all 0.3s ease; position: relative; overflow: hidden;
  cursor: pointer;
}
#dashboardView .dashboard-d1 .stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
#dashboardView .dashboard-d1 .stat-card::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 100px; height: 100px; border-radius: 50%;
  opacity: 0.06; transform: translate(30%, -30%);
}
#dashboardView .dashboard-d1 .stat-card.c1::after { background: var(--primary); }
#dashboardView .dashboard-d1 .stat-card.c2::after { background: var(--success); }
#dashboardView .dashboard-d1 .stat-card.c3::after { background: var(--danger); }
#dashboardView .dashboard-d1 .stat-card.c4::after { background: var(--purple); }

#dashboardView .dashboard-d1 .stat-head {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 14px;
}
#dashboardView .dashboard-d1 .stat-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: white;
}
#dashboardView .dashboard-d1 .c1 .stat-icon { background: linear-gradient(135deg, #6366f1, #818cf8); }
#dashboardView .dashboard-d1 .c2 .stat-icon { background: linear-gradient(135deg, #10b981, #34d399); }
#dashboardView .dashboard-d1 .c3 .stat-icon { background: linear-gradient(135deg, #ef4444, #f87171); }
#dashboardView .dashboard-d1 .c4 .stat-icon { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }

#dashboardView .dashboard-d1 .stat-value {
  font-size: 30px; font-weight: 800; color: var(--dark);
  letter-spacing: -1px; line-height: 1.2;
}
#dashboardView .dashboard-d1 .stat-label { font-size: 13px; color: var(--gray); font-weight: 500; margin-top: 2px; }

/* ========== ALERT STATS (các chỉ số cần chú ý) ========== */
#dashboardView .dashboard-d1 .alerts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px; margin-bottom: 28px;
}
#dashboardView .dashboard-d1 .alert-card {
  padding: 20px; display: flex; align-items: center; gap: 16px;
}
#dashboardView .dashboard-d1 .alert-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
#dashboardView .dashboard-d1 .alert-card.a-warning::before { background: linear-gradient(180deg, #f59e0b, #fbbf24); }
#dashboardView .dashboard-d1 .alert-card.a-danger::before  { background: linear-gradient(180deg, #ef4444, #f87171); }
#dashboardView .dashboard-d1 .alert-card.a-pink::before    { background: linear-gradient(180deg, #ec4899, #f472b6); }
#dashboardView .dashboard-d1 .alert-card.a-purple::before  { background: linear-gradient(180deg, #8b5cf6, #a78bfa); }
#dashboardView .dashboard-d1 .alert-card.a-teal::before    { background: linear-gradient(180deg, #06b6d4, #22d3ee); }

#dashboardView .dashboard-d1 .alert-icon {
  width: 52px; height: 52px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; color: white; flex-shrink: 0;
}
#dashboardView .dashboard-d1 .a-warning .alert-icon { background: linear-gradient(135deg, #f59e0b, #fbbf24); box-shadow: 0 4px 12px rgba(245,158,11,0.3); }
#dashboardView .dashboard-d1 .a-danger  .alert-icon { background: linear-gradient(135deg, #ef4444, #f87171); box-shadow: 0 4px 12px rgba(239,68,68,0.3); }
#dashboardView .dashboard-d1 .a-pink    .alert-icon { background: linear-gradient(135deg, #ec4899, #f472b6); box-shadow: 0 4px 12px rgba(236,72,153,0.3); }
#dashboardView .dashboard-d1 .a-purple  .alert-icon { background: linear-gradient(135deg, #8b5cf6, #a78bfa); box-shadow: 0 4px 12px rgba(139,92,246,0.3); }
#dashboardView .dashboard-d1 .a-teal    .alert-icon { background: linear-gradient(135deg, #06b6d4, #22d3ee); box-shadow: 0 4px 12px rgba(6,182,212,0.3); }

#dashboardView .dashboard-d1 .alert-info { flex: 1; min-width: 0; }
#dashboardView .dashboard-d1 .alert-value {
  font-size: 24px; font-weight: 800; color: var(--dark); letter-spacing: -0.5px; line-height: 1.2;
}
#dashboardView .dashboard-d1 .alert-label {
  font-size: 12.5px; color: var(--gray); font-weight: 500; margin-top: 2px;
}

/* ========== CONTENT GRID (2 cột: chart + chart) ========== */
#dashboardView .dashboard-d1 .content-grid {
  display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 24px;
}
#dashboardView .dashboard-d1 .card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow-sm); border: 1px solid #f1f5f9; padding: 24px;
}
#dashboardView .dashboard-d1 .card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
#dashboardView .dashboard-d1 .card-title {
  font-size: 17px; font-weight: 700; color: var(--dark); letter-spacing: -0.3px;
}
#dashboardView .dashboard-d1 .card-title small {
  display: block; font-size: 12px; color: var(--gray); font-weight: 400; margin-top: 2px;
}

/* Vùng chứa canvas Chart.js — cần cha có kích thước cố định để
   Chart.js responsive:true co giãn đúng theo card, giống hệt cách
   public/css/style.css làm cho .chart-canvas-wrap ở các trang khác. */
#dashboardView .dashboard-d1 .d1-chart-canvas-wrap {
  position: relative; width: 100%; height: 280px;
}

/* ========== THỐNG KÊ NHÂN SỰ THEO BỘ PHẬN (danh sách thanh ngang) ========== */
#dashboardView .dashboard-d1 .dept-stats-list { display: flex; flex-direction: column; }
#dashboardView .dashboard-d1 .dept-stats-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid #f1f5f9;
}
#dashboardView .dashboard-d1 .dept-stats-item:last-child { border-bottom: none; padding-bottom: 2px; }
#dashboardView .dashboard-d1 .dept-stats-icon {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px;
}
#dashboardView .dashboard-d1 .dept-stats-info { flex: 1 1 auto; min-width: 0; }
#dashboardView .dashboard-d1 .dept-stats-name {
  font-size: 13.5px; font-weight: 700; color: var(--dark); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#dashboardView .dashboard-d1 .dept-stats-count { font-size: 11.5px; color: var(--gray); line-height: 1.3; }
#dashboardView .dashboard-d1 .dept-stats-bar-wrap { flex: 0 0 auto; width: 100px; }
#dashboardView .dashboard-d1 .dept-stats-bar-track {
  width: 100%; height: 6px; border-radius: 999px; background: #eef1f6; overflow: hidden;
}
#dashboardView .dashboard-d1 .dept-stats-bar-fill { height: 100%; border-radius: 999px; }
@media (max-width: 640px) {
  #dashboardView .dashboard-d1 .dept-stats-bar-wrap { display: none; }
}

/* ========== TABLE ========== */
#dashboardView .dashboard-d1 .table-wrap { overflow-x: auto; }
#dashboardView .dashboard-d1 table {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
}
#dashboardView .dashboard-d1 thead th {
  text-align: left; padding: 12px 14px;
  font-size: 11px; font-weight: 700; color: var(--gray);
  text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 2px solid #f1f5f9; white-space: nowrap;
}
#dashboardView .dashboard-d1 tbody td {
  padding: 14px; border-bottom: 1px solid #f8fafc; color: var(--dark);
}
#dashboardView .dashboard-d1 tbody tr { transition: background 0.15s; }
#dashboardView .dashboard-d1 tbody tr:hover { background: #fafbfc; }
#dashboardView .dashboard-d1 tbody tr:last-child td { border-bottom: none; }
#dashboardView .dashboard-d1 .table__empty {
  padding: 14px 4px; font-size: 12.5px; color: var(--gray); text-align: center;
}

/* Nhân viên gần đây — tái sử dụng đúng class do dashboard.js render
   (employee-cell / employee-cell__avatar...), chỉ đổi giao diện. */
#dashboardView .dashboard-d1 .employee-cell { display: flex; align-items: center; gap: 11px; }
#dashboardView .dashboard-d1 .employee-cell__avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 13px; flex-shrink: 0;
}
#dashboardView .dashboard-d1 .employee-cell__name { font-weight: 600; font-size: 13.5px; color: var(--dark); }
#dashboardView .dashboard-d1 .employee-cell__code { font-size: 12px; color: var(--gray); }

/* Trạng thái nhân viên (tag/tag--...) do dashboard.js render */
#dashboardView .dashboard-d1 .tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
}
#dashboardView .dashboard-d1 .tag::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
#dashboardView .dashboard-d1 .tag--dang_lam { background: rgba(16,185,129,0.1); color: #059669; }
#dashboardView .dashboard-d1 .tag--thu_viec { background: rgba(245,158,11,0.1); color: #d97706; }
#dashboardView .dashboard-d1 .tag--tam_nghi { background: rgba(100,116,139,0.14); color: #475569; }
#dashboardView .dashboard-d1 .tag--nghi_viec { background: rgba(239,68,68,0.1); color: #dc2626; }

/* Nút xem/sửa trong bảng (icon-action-btn) do dashboard.js render */
#dashboardView .dashboard-d1 .icon-action-btns { display: flex; gap: 6px; }
#dashboardView .dashboard-d1 .icon-action-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid #e2e8f0; background: white; color: var(--gray);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
#dashboardView .dashboard-d1 .icon-action-btn svg { width: 15px; height: 15px; }
#dashboardView .dashboard-d1 .icon-action-btn:hover {
  background: var(--primary); color: white; border-color: var(--primary); transform: translateY(-2px);
}

/* ========== BOTTOM GRID ========== */
#dashboardView .dashboard-d1 .bottom-grid {
  display: grid; grid-template-columns: 2fr 1fr; gap: 20px;
}

/* Hoạt động gần đây — khối minh hoạ, chưa có API cấp dữ liệu thật */
#dashboardView .dashboard-d1 .activity-empty {
  padding: 34px 10px; text-align: center; color: var(--gray); font-size: 13px;
}
#dashboardView .dashboard-d1 .activity-empty i {
  display: block; font-size: 26px; margin-bottom: 10px; color: #cbd5e1;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
  #dashboardView .dashboard-d1 .content-grid,
  #dashboardView .dashboard-d1 .bottom-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  #dashboardView .dashboard-d1 .topbar-actions { width: 100%; flex-wrap: wrap; }
  #dashboardView .dashboard-d1 .search-box { flex: 1; }
  #dashboardView .dashboard-d1 .search-box input { width: 100%; }
  #dashboardView .dashboard-d1 .search-box input:focus { width: 100%; }
  #dashboardView .dashboard-d1 .page-title h1 { font-size: 20px; }
  #dashboardView .dashboard-d1 .stat-value { font-size: 24px; }
  #dashboardView .dashboard-d1 .card { padding: 18px; }
}
