/**
 * people.css
 *
 * Styles for PeopleWorker — grouped people list + supervisor detail view.
 * Uses CSS variables only. ThemeManager switches the theme freely.
 */

/* ── Panel shell ─────────────────────────────────────────────────────────── */
.people-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

/* ── Header row ─────────────────────────────────────────────────────────── */
.people-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.people-header svg { color: var(--text-secondary); flex-shrink: 0; }
.people-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.people-count {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 8px;
}

/* ── People refresh button ───────────────────────────────────────────────── */
.people-refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  flex-shrink: 0;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.people-refresh-btn:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
}
.people-refresh-btn:active { transform: scale(.90); }
.people-refresh-btn:disabled { opacity: .45; cursor: not-allowed; }

@keyframes people-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.people-refresh-spinning svg {
  animation: people-spin .7s linear infinite;
}

/* ── Search ──────────────────────────────────────────────────────────────── */
.people-search-wrap {
  position: relative;
  padding: 10px 16px;
  flex-shrink: 0;
}
.people-search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}
.people-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 10px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: .88rem;
  outline: none;
  transition: border-color .15s;
}
.people-search-input:focus { border-color: var(--accent); }

/* ── Scrollable list area ────────────────────────────────────────────────── */
.people-list-area {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 24px;
  -webkit-overflow-scrolling: touch;
}

/* ── Loading state ────────────────────────────────────────────────────────── */
.people-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 48px 0;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.people-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0;
  text-align: center;
}
.people-empty-icon { font-size: 2rem; margin-bottom: 8px; }
.people-empty-text { font-size: .85rem; color: var(--text-tertiary); margin: 0; }

/* ── Section header ──────────────────────────────────────────────────────── */
.people-section { margin-bottom: 4px; }
.people-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 0 6px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}
.people-section-icon  { font-size: .9rem; }
.people-section-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  flex: 1;
}
.people-section-count {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 7px;
}

/* ── Person card ─────────────────────────────────────────────────────────── */
.people-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md, 10px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  transition: background .12s, border-color .12s;
}
.people-card[role="button"]:hover,
.people-card[role="button"]:focus-visible {
  background: var(--bg-hover, var(--bg-elevated));
  border-color: var(--accent);
  outline: none;
}
.people-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.people-card-name {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.people-card-sub {
  font-size: .75rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.people-card-chevron {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ── Avatar ──────────────────────────────────────────────────────────────── */
.people-av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: .02em;
}
.av-color-blue   { background: #3b82f6; }
.av-color-green  { background: #22c55e; }
.av-color-purple { background: #a855f7; }
.av-color-orange { background: #f97316; }
.av-color-pink   { background: #ec4899; }
.av-color-teal   { background: #14b8a6; }

/* ── Badge ───────────────────────────────────────────────────────────────── */
.people-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 600;
  border-radius: 20px;
  padding: 2px 7px;
  margin-top: 2px;
  white-space: nowrap;
}
.people-badge--done    { background: var(--badge-done-bg,   #dcfce7); color: var(--badge-done-text,   #15803d); }
.people-badge--warn    { background: var(--badge-warn-bg,   #fef9c3); color: var(--badge-warn-text,   #854d0e); }
.people-badge--pending { background: var(--badge-pending-bg,#f3f4f6); color: var(--badge-pending-text,#374151); }

/* ── Supervisor detail ───────────────────────────────────────────────────── */
.people-detail { padding-top: 4px; }

.people-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 14px;
}
.people-back-btn:hover { opacity: .8; }

.people-detail-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 14px);
  margin-bottom: 8px;
}
.people-detail-av {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.people-detail-info { flex: 1; min-width: 0; }
.people-detail-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.people-detail-role {
  font-size: .75rem;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}
.people-detail-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--accent);
  text-decoration: none;
  margin-top: 4px;
}
.people-detail-link:hover { text-decoration: underline; }
