/*--------------------------------------------------------------
# Administrative Staff Directory
#
# One flat, filterable directory: an "All" tab, a "Faculty
# Administration" tab for staff not tied to one specific department, and
# one tab per department that actually has admin staff assigned (see
# .adm-tabs and AdmPage.get_context in team/models.py), each showing a
# responsive grid of .adm-card. Same avatar+badge visual language as the
# Teaching Staff, Department Structure and Faculty Organogram cards (see
# static/css/lecturer-directory.css, static/css/department-structure.css,
# static/css/organogram.css), but a single accent throughout -- there's
# no role tier to color-code here, just one list of peers.
--------------------------------------------------------------*/
.adm-directory {
  --adm-accent: var(--accent-color, #0d6efd);
  --adm-accent-soft: color-mix(in srgb, var(--adm-accent), white 85%);
  --adm-heading: var(--heading-color, #1b1f27);
  --adm-text-muted: var(--default-color, #5a6472);
  --adm-surface: var(--surface-color, #ffffff);
}

/*--------------------------------------------------------------
# Stat strip -- quick "how many staff, how many units" summary above the
# tabs.
--------------------------------------------------------------*/
.adm-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 2rem;
  color: var(--adm-text-muted);
  font-weight: 600;
}

.adm-stats strong {
  color: var(--adm-heading);
  font-weight: 700;
}

/*--------------------------------------------------------------
# Tabs -- pill nav, "All" + "Faculty Administration" + one per
# department, each carrying its own count badge. Wraps on narrow screens
# rather than scrolling, since the count is usually small enough that
# wrapping to a second line reads better than a hidden horizontal
# scroller.
--------------------------------------------------------------*/
.adm-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.adm-tabs .nav-item {
  /* Flex items default to min-width: auto (their content's unwrapped
     width acts as a shrink floor), which silently defeats max-width and
     white-space: normal below -- overriding it is what actually lets a
     long department name's pill shrink and wrap instead of overflowing
     the viewport on narrow screens. */
  min-width: 0;
  max-width: 100%;
}

.adm-tabs .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  text-align: center;
  white-space: normal;
  color: var(--adm-heading);
  background: color-mix(in srgb, var(--adm-heading), transparent 95%);
  border: 1px solid color-mix(in srgb, var(--adm-heading), transparent 88%);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.adm-tabs .nav-link:hover {
  border-color: color-mix(in srgb, var(--adm-accent), transparent 55%);
  color: var(--adm-accent);
}

.adm-tabs .nav-link.active {
  color: #fff;
  background: var(--adm-accent);
  border-color: var(--adm-accent);
}

.adm-tabs .nav-link .badge {
  font-weight: 700;
  color: inherit;
  background: color-mix(in srgb, currentColor, transparent 85%);
}

.adm-tabs .nav-link.active .badge {
  background: color-mix(in srgb, #fff, transparent 75%);
}

@media (prefers-reduced-motion: reduce) {
  .adm-tabs .nav-link {
    transition: none;
  }
}

/*--------------------------------------------------------------
# Card -- one identical shape for every admin staff member.
--------------------------------------------------------------*/
.adm-card {
  --adm-card-radius: 1.25rem;
  position: relative;
  background: linear-gradient(180deg, color-mix(in srgb, var(--adm-accent), var(--adm-surface) 95%) 0%, var(--adm-surface) 7rem);
  border: 1px solid color-mix(in srgb, var(--adm-accent), transparent 90%);
  border-radius: var(--adm-card-radius);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--adm-heading), transparent 93%), 0 10px 25px color-mix(in srgb, var(--adm-heading), transparent 95%);
}

/* Accent bar as its own layer (not `border-top`) so it can be a gradient
   without fighting `border-radius` rendering. */
.adm-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--adm-accent), color-mix(in srgb, var(--adm-accent), var(--adm-heading) 35%));
}

.adm-card:hover,
.adm-card:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 1.25rem 2.5rem color-mix(in srgb, var(--adm-accent), transparent 85%);
  border-color: color-mix(in srgb, var(--adm-accent), transparent 60%);
}

@media (prefers-reduced-motion: reduce) {
  .adm-card {
    transition: none;
  }
  .adm-card:hover,
  .adm-card:focus-within {
    transform: none;
  }
}

/* Photo + role/name/department, side by side. */
.adm-card-main {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
}

.adm-card-info {
  min-width: 0; /* let a long name ellipsis-wrap instead of forcing the card wider */
}

.adm-avatar-wrap {
  position: relative;
}

.adm-avatar {
  width: 4.25rem;
  height: 4.25rem;
  object-fit: cover;
  box-shadow: 0 0 0 4px var(--adm-accent-soft), 0 2px 6px color-mix(in srgb, var(--adm-heading), transparent 85%);
}

.adm-badge {
  position: absolute;
  right: -0.2rem;
  bottom: -0.2rem;
  width: 1.6rem;
  height: 1.6rem;
  font-size: 0.7rem;
  color: #fff;
  background: var(--adm-accent);
  border: 2px solid var(--adm-surface);
}

.adm-role {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--adm-accent);
}

.adm-name {
  font-size: 1.05rem;
  color: var(--adm-heading);
}

.adm-meta {
  margin-top: 0.15rem;
}

.adm-contact {
  font-size: 0.82rem;
  color: var(--adm-text-muted);
  border-top: 1px solid color-mix(in srgb, var(--adm-accent), transparent 88%);
}

.adm-contact a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.adm-contact a:hover,
.adm-contact a:focus-visible {
  color: var(--adm-accent);
  text-decoration: underline;
}
