/* AMEU Staff Directory (public page and admin screen) */

/* ---- Avatar: initials underneath, photo on top when there is one ---- */
.sd-avatar {
  position: relative; flex: none;
  width: 64px; height: 64px; border-radius: 50%; overflow: hidden;
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--gold);
}
.sd-avatar.sd-avatar--lg { width: 112px; height: 112px; }
.sd-avatar.sd-avatar--sm { width: 40px; height: 40px; box-shadow: 0 0 0 2px var(--gold); }
.sd-avatar img, .sd-initials { position: absolute; inset: 0; width: 100%; height: 100%; }
.sd-avatar img { object-fit: cover; object-position: center 25%; }
.sd-initials {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: .02em;
}
.sd-avatar--lg .sd-initials { font-size: 38px; }
.sd-avatar--sm .sd-initials { font-size: 14px; }

/* ---- Search bar ---- */
.sd-page { padding-top: 28px; padding-bottom: 20px; }
.sd-tools {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 10px;
  background: var(--white); border: 1px solid var(--gray-200); border-top: 3px solid var(--gold);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm);
}
.sd-search { position: relative; }
.sd-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gray-400); }
.sd-search .form-control { padding-left: 40px; }
.sd-tools .form-control { height: 46px; }
.sd-tools .btn { height: 46px; justify-content: center; }
.sd-summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 18px 2px 14px; color: var(--gray-600); font-size: 14px; }
.sd-summary a { font-weight: 600; }

/* ---- Cards ---- */
.sd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); gap: 16px; }
.sd-card {
  display: flex; flex-direction: column;
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: box-shadow var(--transition), transform var(--transition);
}
.sd-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.sd-card-top { display: flex; gap: 14px; align-items: center; padding: 18px 18px 12px; }
.sd-card-id { min-width: 0; }
.sd-name { font-family: var(--font-display); font-size: 16.5px; font-weight: 700; color: var(--green-dark); line-height: 1.3; overflow-wrap: anywhere; }
.sd-pos { font-size: 13.5px; color: var(--gray-800); margin-top: 3px; line-height: 1.4; overflow-wrap: anywhere; }
.sd-dept {
  display: inline-block; margin: 0 18px 12px; padding: 3px 10px; border-radius: 50px; align-self: flex-start;
  background: var(--green-pale); color: var(--green-primary); font-size: 12px; font-weight: 600; line-height: 1.5;
  max-width: calc(100% - 36px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sd-dept:hover { background: var(--gold-pale); color: var(--green-dark); }
.sd-contact { margin-top: auto; display: flex; border-top: 1px solid var(--gray-200); }
.sd-contact > * {
  flex: 1 1 0; min-width: 0; min-height: 46px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 6px; font-size: 13px; font-weight: 600; color: var(--green-primary);
  background: none; border: 0; cursor: pointer; font-family: var(--font-body);
}
.sd-contact > * + * { border-left: 1px solid var(--gray-200); }
.sd-contact > *:hover { background: var(--green-pale); color: var(--green-dark); }
.sd-contact i { color: var(--gold); }
.sd-contact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Profile popup ---- */
.sd-dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  border: 0; border-top: 5px solid var(--gold); border-radius: var(--radius-lg); padding: 0;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  margin: auto;   /* style.css resets every margin to 0, which pinned the popup to the top-left corner */
}
.sd-dialog::backdrop { background: rgba(13,61,34,.6); backdrop-filter: blur(2px); }
.sd-dialog-head { display: flex; gap: 18px; align-items: center; padding: 24px 24px 16px; background: var(--off-white); border-bottom: 1px solid var(--gray-200); }
.sd-dialog-head .sd-name { font-size: 20px; }
.sd-dialog-body { padding: 18px 24px 24px; }
.sd-dialog-body dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; font-size: 14.5px; margin-bottom: 14px; }
.sd-dialog-body dt { color: var(--gray-600); font-weight: 600; }
.sd-dialog-body dd { overflow-wrap: anywhere; }
.sd-dialog-body dd a { display: block; }
.sd-profile { font-size: 15px; line-height: 1.75; color: var(--gray-800); border-top: 1px solid var(--gray-200); padding-top: 14px; overflow-wrap: anywhere; }
.sd-profile p { margin: 0 0 12px; }
.sd-profile p:last-child { margin-bottom: 0; }
.sd-profile ul, .sd-profile ol { margin: 0 0 12px 20px; }
.sd-profile ul li { list-style: disc; }
.sd-profile ol li { list-style: decimal; }
.sd-profile strong, .sd-profile b { color: var(--green-dark); }
.sd-close { position: absolute; top: 10px; right: 12px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; font-size: 24px; line-height: 1; color: var(--gray-600); cursor: pointer; }
.sd-close:hover { background: var(--gray-200); color: var(--green-dark); }

/* ---- Paging & empty states ---- */
.sd-pager { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 24px; }
.sd-pager a, .sd-pager span { min-width: 40px; height: 40px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; border: 1px solid var(--gray-200); background: var(--white); font-size: 14px; font-weight: 600; }
.sd-pager .is-current { background: var(--green-primary); border-color: var(--green-primary); color: #fff; }
.sd-pager .is-gap { border: 0; background: none; min-width: 20px; padding: 0; }
.sd-empty { text-align: center; padding: 48px 16px; color: var(--gray-600); }
.sd-empty > i { font-size: 40px; color: var(--gold); margin-bottom: 12px; }

@media (max-width: 768px) {
  .sd-tools { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .sd-page { padding-top: 18px; }
}
@media (max-width: 480px) {
  .sd-card-top { padding: 14px 14px 10px; }
  .sd-dept { margin: 0 14px 10px; }
  .sd-dialog-head { flex-direction: column; text-align: center; padding: 22px 18px 14px; }
  .sd-dialog-body { padding: 16px 18px 20px; }
  .sd-dialog-body dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .sd-dialog-body dd { margin-bottom: 8px; }
}

.sd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
