/* ==========================================================================
   Resource Plan Tab — resource.css
   ========================================================================== */

/* Project badges in resource plan table */
.rp-proj-badge {
  display: inline-block;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1E40AF;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 10px;
  margin: 1px 2px;
  white-space: nowrap;
}

/* Project column in estimates table — removed; project filter now lives in Resource Plan */

/* =========================================================================
   Resource Plan tab
   ========================================================================= */

/* Project filter bar inside Resource Plan */
.rp-proj-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
  flex-shrink: 0;
}

#tab-resource {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
#tab-resource .pane-header {
  flex-shrink: 0;
  padding: 24px 24px 12px;
}
#resource-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* 卡片容器 */
#rp-table,
#rp-heatmap {
  flex-shrink: 0;
  min-width: 0;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  overflow: clip; /* clip border-radius; does NOT create scroll container */
}

/* rp-table 需是 flex column 讓 .rp-scroll 能拿到剩餘高度 */
#rp-table {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 240px); /* 讓表格有固定上限，.rp-scroll 才能在其中垂直捲動 */
}

/* 同時負責 x/y 捲動的唯一容器 — sticky thead 固定在此 scroll viewport 頂端 */
.rp-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* ── Section wrapper (used for rp-proj-filter / empty states) ── */
.rp-section {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  overflow: hidden;
}

.rp-section-title {
  font-size: 15px;
  font-weight: 600;
  color: #1E293B;
  padding: 14px 18px 12px;
  border-bottom: 1px solid #F1F5F9;
  background: #F8FAFC;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.rp-section-sub {
  font-size: 12px;
  font-weight: 400;
  color: #94A3B8;
}

.rp-hint {
  padding: 10px 18px;
  font-size: 13px;
  color: #94A3B8;
  font-style: italic;
}

/* ── Assignment matrix table ──────────────────────────────── */
.rp-table {
  border-collapse: collapse;
  min-width: 100%;   /* expand beyond container when many epic columns */
  white-space: nowrap;
}
.rp-table th,
.rp-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
}
.rp-table thead th {
  background: #F8FAFC;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748B;
  position: sticky;
  top: 0;
  z-index: 3;  /* above tbody sticky cells (z-index:1~2) */
}
.rp-table tbody tr:hover { background: #F8FAFC; }
.rp-table tbody tr:last-child td { border-bottom: none; }

/* Frozen first column (member name) */
.rp-sticky-col {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
  box-shadow: 2px 0 4px rgba(0,0,0,0.06);
}
.rp-table thead .rp-sticky-col {
  background: #F8FAFC;
  z-index: 5;  /* top + left: highest layer */
}
.rp-table tbody tr:hover .rp-sticky-col { background: #F8FAFC; }

/* Frozen second column (Projects) */
.rp-sticky-proj {
  position: sticky;
  left: 180px;
  background: #fff;
  z-index: 1;
  box-shadow: 2px 0 4px rgba(0,0,0,0.06);
}
.rp-table thead .rp-sticky-proj {
  background: #F8FAFC;
  z-index: 4;  /* top + left (second col) */
}
.rp-table tbody tr:hover .rp-sticky-proj { background: #F8FAFC; }

/* Team + Estimates combined row */
.rp-team-est-row td {
  background: #FFFBEB;
  border-top: 2px solid #E2E8F0;
  border-bottom: 1px solid #FDE68A;
  padding: 5px 10px;
  vertical-align: middle;
}
.rp-team-est-row:hover td { background: #FEF9C3; }
.rp-team-name-cell {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #92400E;
}
.rp-team-est-row .rp-sticky-col,
.rp-team-est-row .rp-sticky-proj {
  background: #FFFBEB;
  z-index: 2;
}
.rp-team-est-row:hover .rp-sticky-col,
.rp-team-est-row:hover .rp-sticky-proj { background: #FEF9C3; }

/* Manager row — subtle separator from the rest of the team */
.rp-manager-row td {
  border-top: 1px dashed #CBD5E1;
}
.rp-manager-row .rp-sticky-col,
.rp-manager-row .rp-sticky-proj {
  background: #FAFBFF;
}
.rp-table .rp-manager-row:hover .rp-sticky-col,
.rp-table .rp-manager-row:hover .rp-sticky-proj { background: #F0F4FF; }


.rp-est-cell {
  text-align: center;
}
.rp-est-val {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #B45309;
  background: #FDE68A;
  border-radius: 4px;
  padding: 1px 6px;
  line-height: 1.6;
}
.rp-est-unit {
  font-size: 10px;
  font-weight: 400;
  margin-left: 1px;
  opacity: 0.8;
}
.rp-est-empty {
  color: #D1D5DB;
  font-size: 11px;
}

.rp-col-name    { width: 180px; min-width: 180px; }
.rp-col-project { min-width: 180px; }
.rp-col-epic    { min-width: 100px; max-width: 130px; text-align: center; }

.rp-epic-sum {
  font-size: 10px;
  font-weight: 400;
  color: #94A3B8;
  margin-top: 2px;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.rp-person-name {
  font-size: 13px;
  font-weight: 600;
  color: #1E293B;
}
.rp-person-sub {
  font-size: 11px;
  color: #94A3B8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

/* Default project select */
.rp-project-sel {
  width: 100%;
  min-width: 150px;
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #CBD5E1;
  border-radius: 5px;
  background: #fff;
  color: #1E293B;
  cursor: pointer;
  transition: border-color 0.15s;
}
.rp-project-sel:focus { outline: none; border-color: #3B82F6; }

/* Allocation % cell */
.rp-cell { text-align: center; padding: 5px 6px !important; }
.rp-assigned { background: rgba(59, 130, 246, 0.06); }

.rp-alloc-input {
  width: 58px;
  text-align: center;
  padding: 4px 4px;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.rp-alloc-input:focus { outline: none; border-color: #3B82F6; box-shadow: 0 0 0 2px rgba(59,130,246,.2); }
.rp-alloc-input.saving { border-color: #F59E0B; }
.rp-alloc-input.saved  { border-color: #10B981; }
.rp-alloc-input.error  { border-color: #DC2626; }

/* ── Conflict heatmap ─────────────────────────────────────── */
.rp-heat-table {
  border-collapse: collapse;
  width: 100%;
}
.rp-heat-table th,
.rp-heat-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #F1F5F9;
  white-space: nowrap;
}
.rp-heat-table thead th {
  background: #F8FAFC;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #64748B;
  position: sticky;
  top: 0;
  z-index: 2;
}
.rp-heat-table tbody tr:last-child td { border-bottom: none; }

.rp-heat-week       { min-width: 68px; text-align: center; }
.rp-heat-name-col-hdr { min-width: 160px; text-align: left; }
.rp-heat-name-col   { min-width: 160px; font-size: 13px; font-weight: 500; color: #1E293B; }
.heat-conflict-name { color: #991B1B; }
.rp-conflict-badge  { font-size: 10px; padding: 1px 5px; }

.rp-heat-cell {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s;
}
.heat-zero { background: #fff;      color: #CBD5E1; }
.heat-low  { background: #D1FAE5;   color: #065F46; }
.heat-med  { background: #FEF3C7;   color: #92400E; }
.heat-high { background: #FEE2E2;   color: #991B1B; font-weight: 700; }

/* ── Legend ───────────────────────────────────────────────── */
.rp-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  font-size: 12px;
  color: #64748B;
  border-top: 1px solid #F1F5F9;
  background: #FAFAFA;
}
.heat-swatch {
  display: inline-block;
  width: 16px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.08);
}
.heat-swatch.heat-low  { background: #D1FAE5; }
.heat-swatch.heat-med  { background: #FEF3C7; }
.heat-swatch.heat-high { background: #FEE2E2; }
