/* Employee records (Module 5): the directory's filter bar and list. */

/* Filter bar: a search box and pills that open a list of choices (Shopify-style); no card around it. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

.filter-search {
  display: flex;
  flex: 1 1 280px;
  align-items: center;
  gap: 0.5rem;
  max-width: 420px;
  height: 38px;
  margin: 0;
  padding: 0 0.85rem;
  background: var(--lb-surface);
  border: 1px solid var(--lb-border);
  border-radius: var(--lb-radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-search:focus-within {
  border-color: var(--lb-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--lb-primary-rgb), 0.12);
}

.filter-search i { color: var(--lb-muted); }

.filter-search input {
  flex: 1;
  min-width: 0;
  padding: 0;
  color: var(--lb-ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.filter-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* A pill: a button (opens choices) or a link (onboarding filters). Dashed until something is chosen. */
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 34px;
  padding: 0 0.8rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--lb-ink);
  white-space: nowrap;
  text-decoration: none;
  background: var(--lb-surface);
  border: 1px dashed var(--lb-border);
  border-radius: 999px;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.filter-pill:hover { color: var(--lb-ink); border-color: var(--lb-muted); }
.filter-pill:disabled { opacity: 0.5; cursor: not-allowed; border-color: var(--lb-border); color: var(--lb-muted); }
.filter-pill i { font-size: 11px; color: var(--lb-muted); }

.filter-pill.is-active {
  color: var(--lb-primary);
  background: var(--lb-primary-soft);
  border: 1px solid rgba(var(--lb-primary-rgb), 0.25);
}

.filter-pill-value { font-weight: 600; }

.filter-menu {
  min-width: 200px;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--lb-border-soft);
  border-radius: var(--lb-radius);
  box-shadow: var(--lb-shadow-lg);
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  padding: 7px 10px;
  cursor: pointer;
  border-radius: 8px;
}

.filter-option:hover { background: var(--lb-hover); }
.filter-option .form-check-input { margin: 0; }

/* Chips for the filters that are on, each with a remove button. */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.4rem 0.2rem 0.65rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--lb-ink);
  background: var(--lb-hover);
  border: 0;
  border-radius: 999px;
}

.filter-chip i { font-size: 16px; color: var(--lb-muted); }
.filter-chip:hover i { color: var(--lb-danger); }

.filter-clear { font-size: 13px; font-weight: 600; text-decoration: none; }

/* The list: rows divided by hairlines; the whole row is a link. */
.people-list {
  overflow: hidden;
  background: var(--lb-surface);
  border: 1px solid var(--lb-border-soft);
  border-radius: var(--lb-radius-lg);
}

.employee-row {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 1.2fr) 96px 190px 16px;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  color: var(--lb-ink);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

/* Edit and Delete at the right; they sit above the row's own link (the name). A row without them has no such column. */
.employee-row-actions { position: relative; z-index: 2; display: flex; gap: 0.35rem; justify-content: flex-start; }
.employee-row-actions form { margin: 0; }
.employee-row:not(:has(.employee-row-actions)) { grid-template-columns: 44px minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 1.2fr) 96px 16px; }

.employee-row + .employee-row { border-top: 1px solid var(--lb-border-soft); }
.employee-row:hover { color: var(--lb-ink); background: var(--lb-row-hover); }

.employee-row-main,
.employee-row-job,
.employee-row-meta { display: flex; flex-direction: column; min-width: 0; }

.employee-row-main > span,
.employee-row-job > span,
.employee-row-meta > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.employee-row-name { font-weight: 600; }
.employee-row-sub { font-size: 12.5px; color: var(--lb-muted); }
.employee-row-status { text-align: right; }
.employee-row-chevron { font-size: 12px; color: var(--lb-border); transition: transform 0.15s ease, color 0.15s ease; }
.employee-row:hover .employee-row-chevron { color: var(--lb-primary); transform: translateX(2px); }

/* Tablets: drop the code column. Phones: name and status only, job under the name. */
@media (max-width: 1199.98px) {
  .employee-row { grid-template-columns: 44px minmax(0, 1.4fr) minmax(0, 1.2fr) 96px 190px 16px; }
  .employee-row:not(:has(.employee-row-actions)) { grid-template-columns: 44px minmax(0, 1.4fr) minmax(0, 1.2fr) 96px 16px; }
  .employee-row-meta { display: none; }
}

@media (max-width: 576px) {
  .employee-row, .employee-row:not(:has(.employee-row-actions)) { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 0.75rem; padding: 0.75rem 0.9rem; }
  .employee-row-actions { grid-column: 1 / -1; order: 9; }
  .employee-row-job,
  .employee-row-chevron { display: none; }
}

/* Empty lists: a big quiet icon, one line, and the next step. */
.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--lb-muted);
}

.empty-state > i { display: inline-flex; align-items: center; justify-content: center; width: 4rem; height: 4rem; margin-bottom: 0.75rem; font-size: 1.75rem; color: var(--lb-accent-strong); background: var(--lb-accent-soft); border-radius: 50%; }
.empty-state p { margin-bottom: 0.75rem; }

/* Profile */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.profile-meta .bi {
  margin-right: 0.25rem;
}

.profile-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  white-space: nowrap;
}

/* Label on the left, value on the right; stacked on phones. */
.profile-fields {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 0.75rem 1.5rem;
  margin: 0;
}

.profile-fields dt {
  color: var(--lb-muted);
  font-weight: 600;
}

.profile-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 576px) {
  .profile-fields { grid-template-columns: 1fr; gap: 0.15rem; }
  .profile-fields dd { margin-bottom: 0.6rem; }
}

/* Track record timeline: a line with one dot per entry, coloured by category. */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.5rem;
  border-left: 2px solid var(--lb-border);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 0.3rem;
  left: calc(-1.5rem - 7px);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--lb-data);
  box-shadow: 0 0 0 3px #fff;
}

.timeline-conduct::before {
  background: var(--lb-accent);
}

/* Attendance entries (e.g. late 5 times in a month): a problem, so red. */
.timeline-attendance::before {
  background: #B42318;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-self: flex-start;
}

@media (max-width: 576px) {
  .profile-header { flex-wrap: wrap; }
  .profile-actions { width: 100%; }
}

/* Documents: a coloured edge for expired (red) and expiring within 30 days (amber). */
.document-expired { box-shadow: inset 4px 0 0 var(--bs-danger); }
.document-expiring { box-shadow: inset 4px 0 0 var(--bs-warning); }

/* Employees dashboard: charts drawn in HTML/CSS (one colour, one measure each, so no chart library). */
.column-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding-top: 0.5rem;
  border-bottom: 1px solid var(--lb-border);
}

.column-chart-col {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  outline: none;
}

/* The bar starts at the baseline, with rounded top corners only. */
.column-chart-bar {
  min-height: 2px;
  background: var(--lb-data);
  border-radius: 4px 4px 0 0;
}

.column-chart-bar.is-empty {
  background: var(--lb-border);
}

.column-chart-label {
  position: absolute;
  bottom: -1.4rem;
  width: 100%;
  font-size: 0.7rem;
  color: var(--lb-muted);
  text-align: center;
}

.column-chart { margin-bottom: 1.6rem; }

/* Hover or keyboard focus shows the month's number. */
.column-chart-col:hover .column-chart-bar,
.column-chart-col:focus-visible .column-chart-bar { background: var(--lb-primary); }

.column-chart-col:hover::after,
.column-chart-col:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  z-index: 2;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  color: #fff;
  white-space: nowrap;
  background: var(--lb-ink);
  border-radius: 4px;
  transform: translateX(-50%);
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bar-list-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.bar-list-track {
  height: 8px;
  overflow: hidden;
  background: var(--lb-border-soft);
  border-radius: 999px;
}

.bar-list-bar {
  height: 100%;
  min-width: 2px;
  background: var(--lb-data);
  border-radius: 999px;
}

/* Document review: Verify, the reject reason and Reject on one line, all the same height. */
.document-review,
.document-review-reject { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }

.document-review form { margin: 0; }

.document-review .form-control { width: 240px; max-width: 100%; }

/* Reviewing a document on the page: a large dialog, the file on the left, details and Verify / Reject on the right. */
.doc-viewer {
  width: min(1100px, 94vw);
  max-width: none;
  height: min(86vh, 800px);
  padding: 0;
  overflow: hidden;
  color: var(--lb-ink);
  background: var(--lb-surface);
  border: 0;
  border-radius: var(--lb-radius-lg);
  box-shadow: var(--lb-shadow-lg);
}
.doc-viewer::backdrop { background: rgba(var(--lb-primary-rgb), 0.6); backdrop-filter: blur(2px); }
.doc-viewer-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; height: 100%; }
.doc-viewer-stage { display: flex; align-items: center; justify-content: center; min-width: 0; overflow: auto; background: var(--lb-bg); }
.doc-viewer-frame { width: 100%; height: 100%; border: 0; }
.doc-viewer-image { max-width: 100%; max-height: 100%; object-fit: contain; }
.doc-viewer-side { display: flex; flex-direction: column; padding: 1.1rem; overflow-y: auto; border-left: 1px solid var(--lb-border-soft); }
.doc-viewer-decide { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--lb-border-soft); }
.doc-viewer-decide form { margin: 0; }
@media (max-width: 767.98px) {
  .doc-viewer-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .doc-viewer-side { border-left: 0; border-top: 1px solid var(--lb-border-soft); max-height: 45%; }
}

/* Something at the right end of the filter bar (the date range button), lined up with the filters. */
.filter-bar-extra { margin-left: auto; }

/* Onboarding as rows: the Employees list's row with two more columns (checklist progress and the invitation). */
.employee-row.onboarding-row { grid-template-columns: 44px minmax(0, 1.4fr) minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 9.5rem) 16px; }
.onboarding-row-progress { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.onboarding-row .employee-row-status { text-align: right; }
@media (max-width: 1199.98px) {
  .employee-row.onboarding-row { grid-template-columns: 44px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 9.5rem) 16px; }
  .onboarding-row .employee-row-job { display: none; }
}
@media (max-width: 576px) {
  .employee-row.onboarding-row { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .onboarding-row .employee-row-meta, .onboarding-row-progress { display: none; }
}
