/*
 * Student Directory page template
 * Scoped under .sd so it does not clash with the theme's Tailwind build.
 */

.sd {
  --sd-navy: #173f5f;
  --sd-orange: #ef7d00;
  --sd-ink: #17212b;
  --sd-muted: #667085;
  --sd-line: #e5e7eb;
  --sd-bg: #f5f7fa;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--sd-ink);
  background: var(--sd-bg);
}

.sd *,
.sd *::before,
.sd *::after {
  box-sizing: border-box;
}

.sd a {
  color: var(--sd-navy);
  font-weight: 700;
}

.sd button:focus-visible,
.sd a:focus-visible,
.sd input:focus-visible,
.sd select:focus-visible {
  outline: 3px solid var(--sd-orange);
  outline-offset: 2px;
}

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

/* Intro */
.sd-intro {
  margin-bottom: 18px;
}

.sd-title {
  font-weight: 800;
  font-size: 28px;
  line-height: 1.12;
  letter-spacing: -0.3px;
  margin: 0;
  color: var(--sd-navy);
}

.sd-sub {
  font-size: 16px;
  line-height: 1.3;
  margin-top: 6px;
  color: var(--sd-ink);
}

.sd-internal-note {
  font-size: 11px;
  line-height: 1.35;
  margin-top: 9px;
  max-width: 470px;
  color: var(--sd-muted);
}

/* Controls */
.sd-controls {
  max-width: 1280px;
  margin: 0 auto 12px;
  padding: 32px 5vw 0;
}

.sd-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sd-tab {
  border: 1px solid #cfd6dd;
  background: #fff;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.3;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  color: var(--sd-navy);
}

.sd-tab.is-active {
  background: var(--sd-orange);
  border-color: var(--sd-orange);
  color: #fff;
}

.sd-searchrow {
  display: grid;
  grid-template-columns: 1fr 190px;
  gap: 10px;
}

.sd input,
.sd select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #cfd6dd;
  border-radius: 10px;
  background: #fff;
  font-size: 15px;
  line-height: 1.4;
}

.sd select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23173f5f' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  color: var(--sd-ink);
  text-overflow: ellipsis;
  cursor: pointer;
}

.sd select:hover {
  border-color: #9aa7b3;
}

.sd-hint {
  font-size: 12px;
  color: var(--sd-muted);
  margin: 9px 2px 0;
}

.sd-stats {
  max-width: 1280px;
  margin: 0 auto 12px;
  padding: 0 5vw;
  font-size: 13px;
  color: var(--sd-muted);
}

/* Cards */
.sd-grid {
  max-width: 1280px;
  margin: auto;
  padding: 0 5vw 50px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.sd-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--sd-line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 3px 14px #0f274014;
  display: flex;
  flex-direction: column;
}

.sd-photo {
  width: 100%;
  aspect-ratio: 285 / 325;
  object-fit: cover;
  display: block;
  background: #dce4ea;
}

.sd-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.sd-program {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sd-muted);
  font-weight: 700;
}

.sd-card h2 {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  margin: 4px 0 2px;
  color: var(--sd-navy);
}

.sd-preferred {
  font-size: 12px;
  color: var(--sd-muted);
  font-weight: 600;
  margin-top: 2px;
}

.sd-country {
  font-weight: 700;
  font-size: 14px;
  color: var(--sd-orange);
  margin: 7px 0;
}

.sd-meta {
  font-size: 12px;
  line-height: 1.4;
  margin: 5px 0;
}

.sd-label {
  font-weight: 700;
  color: var(--sd-navy);
}

.sd-links {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--sd-line);
  font-size: 12px;
}

.sd .sd-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 0;
  text-decoration: none;
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
  line-height: 1;
  background: var(--sd-navy);
  color: #fff;
}

.sd .sd-action-btn.sd-profile-btn {
  background: var(--sd-orange);
}

.sd .sd-action-btn:hover {
  filter: brightness(0.95);
}

.sd-empty {
  grid-column: 1 / -1;
  background: #fff;
  padding: 36px;
  border-radius: 14px;
  text-align: center;
  color: var(--sd-muted);
}

.sd-footer {
  max-width: 1280px;
  margin: auto;
  padding: 0 5vw 35px;
  color: var(--sd-muted);
  font-size: 12px;
}

/* Profile modal */
body.sd-no-scroll {
  overflow: hidden;
}

.sd-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: #07192bb8;
  z-index: 100000;
  padding: 24px;
  overflow: auto;
}

.sd-modal.is-open {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.sd-modal-panel {
  width: min(900px, 100%);
  background: #fff;
  border-radius: 18px;
  margin: 24px auto;
  overflow: hidden;
  box-shadow: 0 20px 70px #0006;
}

.sd-modal-head {
  background: var(--sd-navy);
  color: #fff;
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.sd-modal-name {
  font-size: 27px;
  font-weight: 800;
  line-height: 1.15;
}

.sd-modal-preferred {
  font-size: 14px;
  opacity: 0.8;
  margin-top: 5px;
}

.sd-modal-close {
  flex-shrink: 0;
  border: 0;
  background: #fff2;
  color: #fff;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.sd-modal-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 26px;
  padding: 24px;
}

.sd-modal-photo {
  width: 100%;
  border-radius: 14px;
  display: block;
}

.sd-modal-country {
  font-weight: 800;
  color: var(--sd-orange);
  margin: 12px 0;
}

.sd-modal-meta {
  font-size: 14px;
  line-height: 1.5;
  margin: 9px 0;
}

.sd-modal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.sd .sd-modal-actions a {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 9px;
  background: var(--sd-navy);
  color: #fff;
  text-decoration: none;
}

.sd-view-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sd-muted);
  margin-bottom: 8px;
}

.sd-modal-profile {
  font-size: 14px;
  line-height: 1.65;
}

.sd-modal-profile p {
  margin: 0 0 16px;
}

.sd-modal-profile p:last-child {
  margin-bottom: 0;
}

@media (max-width: 1024px) {
  .sd-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .sd-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sd-title {
    font-size: 24px;
  }

  .sd-sub {
    font-size: 14px;
  }

  .sd-internal-note {
    font-size: 10px;
  }

  .sd-searchrow {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .sd-modal-body {
    grid-template-columns: 1fr;
  }

  .sd-modal-photo {
    max-width: 260px;
    margin: auto;
  }
}

@media (max-width: 480px) {
  .sd-grid {
    grid-template-columns: 1fr;
  }
}
