/*
 * KTP Member Login — shared styles
 * Palette: navy + white, with a single gold accent for the KTP mark.
 */

:root {
  --navy-950: #0a1329;
  --navy-900: #0e1b3d;
  --navy-800: #142352;
  --navy-700: #1c2f6b;
  --navy-600: #2a4189;
  --navy-500: #3d59ab;
  --navy-100: #e6eaf5;
  --navy-050: #f4f6fb;
  --white: #ffffff;
  --gold: #c9a24b;
  --gold-dark: #a9822f;
  --error: #b3261e;
  --error-bg: #fbeceb;
  --success: #1e7d4a;
  --success-bg: #eaf7f0;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow-card: 0 24px 60px -20px rgba(10, 19, 41, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--navy-900);
  background: var(--navy-950);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- Login page shell ---------------------------------------- */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(61, 89, 171, 0.35), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(201, 162, 75, 0.12), transparent 55%),
    linear-gradient(180deg, var(--navy-950), var(--navy-900));
}

.page-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
}

.card {
  width: 100%;
  max-width: 408px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 40px 36px 32px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--navy-800), var(--navy-600));
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
  margin-bottom: 14px;
  box-shadow: 0 0 0 4px var(--navy-100);
}

.brand h1 {
  margin: 0 0 4px;
  font-size: 21px;
  font-weight: 700;
  color: var(--navy-900);
  letter-spacing: -0.01em;
}

.brand p {
  margin: 0;
  font-size: 13.5px;
  color: var(--navy-600);
}

/* ---------- Form ------------------------------------------------------ */

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-800);
  margin-bottom: 6px;
}

.field input[type="email"],
.field input[type="password"],
.field input[type="text"],
.field input[type="url"] {
  width: 100%;
  padding: 11px 13px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--navy-900);
  background: var(--navy-050);
  border: 1.5px solid var(--navy-100);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder {
  color: #9aa6c4;
}

.field input:focus {
  background: var(--white);
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px rgba(61, 89, 171, 0.15);
}

.field input[aria-invalid="true"] {
  border-color: var(--error);
  background: var(--error-bg);
}

.field input:disabled {
  background: var(--navy-100);
  color: var(--navy-600);
  cursor: not-allowed;
}

.field-row {
  display: flex;
  gap: 14px;
}

.field-row .field {
  flex: 1;
  min-width: 0;
}

.password-row {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 4px;
  bottom: 4px;
  padding: 0 10px;
  background: transparent;
  border: none;
  color: var(--navy-600);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
}

.password-toggle:hover { background: var(--navy-100); }

.field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--navy-600);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
}

.remember-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--navy-700);
  cursor: pointer;
}

.remember-row label {
  font-size: 13.5px;
  color: var(--navy-800);
  cursor: pointer;
  user-select: none;
}

.btn-primary {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  color: var(--white);
  background: linear-gradient(160deg, var(--navy-700), var(--navy-900));
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.65; cursor: not-allowed; filter: none; }

.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--white);
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn-primary.is-loading .spinner { display: inline-block; }
.btn-primary.is-loading .btn-label { opacity: 0.85; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

.alert {
  display: none;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 18px;
}

.alert.is-visible { display: flex; }

.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(179, 38, 30, 0.18);
}

.alert-locked {
  background: #fff7e8;
  color: #8a5a12;
  border: 1px solid rgba(138, 90, 18, 0.18);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(30, 125, 74, 0.18);
}

.alert-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.form-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 12.5px;
  color: var(--navy-600);
  line-height: 1.6;
}

.form-footer a {
  color: var(--navy-700);
  font-weight: 600;
  text-decoration: none;
}

.form-footer a:hover { text-decoration: underline; }

.page-footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: rgba(230, 234, 245, 0.55);
}

/* ---------- Member portal shell (sidebar + content) -------------------- */

.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  background: var(--navy-050);
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--navy-900);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom, 0px));
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  margin-bottom: 28px;
}

.brand-mark-sm {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--navy-700), var(--navy-500));
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11.5px;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
}

.sidebar-brand-text {
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.3;
}

.sidebar-brand-text small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  cursor: pointer;
}

.sidebar-nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
}

.sidebar-nav-item .nav-dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: currentColor;
}

.sidebar-nav-item.is-active {
  background: rgba(255,255,255,0.1);
  color: var(--white);
}

.sidebar-nav-item.is-active .nav-dot {
  background: var(--gold);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.sidebar-user-email {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  word-break: break-all;
  margin-bottom: 10px;
}

.btn-signout {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: var(--white);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
}

.btn-signout:hover { background: rgba(255,255,255,0.12); }

.main-content {
  flex: 1;
  min-width: 0;
  padding: 40px 32px 60px;
}

/* ---------- Alumni directory -------------------------------------- */

.directory-card {
  width: 100%;
  max-width: 1320px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px 32px 20px;
  box-shadow: 0 8px 30px -12px rgba(10,19,41,0.15);
}

.profile-card {
  width: 100%;
  max-width: 560px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 8px 30px -12px rgba(10,19,41,0.15);
}

.profile-card .directory-header p {
  margin-bottom: 26px;
}

.links-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.links-list li {
  padding: 14px 4px;
  border-top: 1px solid var(--navy-100);
}

.links-list li:first-child {
  border-top: none;
}

.links-list .row-link {
  font-size: 15px;
}

.directory-header h2 {
  margin: 0 0 4px;
  color: var(--navy-900);
  font-size: 20px;
}

.directory-header p {
  margin: 0 0 24px;
  color: var(--navy-600);
  font-size: 13.5px;
}

.directory-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.search-input {
  flex: 2 1 220px;
  padding: 10px 13px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--navy-900);
  background: var(--navy-050);
  border: 1.5px solid var(--navy-100);
  border-radius: var(--radius-sm);
  outline: none;
  min-width: 0;
}

.search-input:focus {
  background: var(--white);
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px rgba(61, 89, 171, 0.15);
}

.filter-select {
  flex: 1 1 160px;
  padding: 10px 13px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--navy-900);
  background: var(--navy-050);
  border: 1.5px solid var(--navy-100);
  border-radius: var(--radius-sm);
  outline: none;
  min-width: 0;
  cursor: pointer;
}

.filter-select:focus {
  background: var(--white);
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px rgba(61, 89, 171, 0.15);
}

.btn-reset {
  flex: 0 0 auto;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--navy-700);
  background: var(--white);
  border: 1.5px solid var(--navy-100);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.btn-reset:hover {
  background: var(--navy-050);
  border-color: var(--navy-500);
}

.results-count {
  font-size: 12.5px;
  color: var(--navy-600);
  margin-bottom: 12px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-sm);
}

.alumni-table {
  width: 100%;
  min-width: 1000px;
  border-collapse: collapse;
  font-size: 13.5px;
}

.alumni-table thead th {
  position: sticky;
  top: 0;
  text-align: left;
  padding: 11px 14px;
  background: var(--navy-900);
  color: var(--white);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  user-select: none;
  white-space: nowrap;
}

/* Only headers wired up to sort (data-sort-key) look clickable. */
.alumni-table thead th[data-sort-key] {
  cursor: pointer;
}

.alumni-table thead th[data-sort-key]:hover,
.alumni-table thead th[data-sort-key]:focus-visible {
  background: var(--navy-800);
  outline: none;
}

.alumni-table thead th.is-sorted {
  background: var(--navy-700);
}

.sort-arrow {
  display: inline-block;
  width: 10px;
  margin-left: 4px;
}

.alumni-table thead th.is-sorted[aria-sort="ascending"] .sort-arrow::after {
  content: '\25B2';
  font-size: 9px;
}

.alumni-table thead th.is-sorted[aria-sort="descending"] .sort-arrow::after {
  content: '\25BC';
  font-size: 9px;
}

.alumni-table tbody tr {
  border-top: 1px solid var(--navy-100);
}

.alumni-table tbody tr:hover {
  background: var(--navy-050);
}

.alumni-table td {
  padding: 11px 14px;
  color: var(--navy-800);
  white-space: nowrap;
}

.alumni-table td.col-name {
  font-weight: 600;
  color: var(--navy-900);
}

.chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--navy-100);
  color: var(--navy-700);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.row-link {
  color: var(--navy-700);
  font-weight: 600;
  text-decoration: none;
}

.row-link:hover {
  text-decoration: underline;
}

.row-muted {
  color: #9aa6c4;
}

.email-cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--navy-500);
  border-radius: 6px;
  cursor: pointer;
}

.copy-btn:hover {
  background: var(--navy-100);
  color: var(--navy-700);
}

.copy-btn:focus-visible {
  outline: 2px solid var(--navy-500);
  outline-offset: 1px;
}

.copy-btn.is-copied {
  color: var(--success);
}

.copy-btn:disabled {
  cursor: default;
}

.empty-row td {
  text-align: center;
  color: var(--navy-600);
  padding: 32px 14px;
  white-space: normal;
}

@media (max-width: 720px) {
  .app-shell { flex-direction: column; }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .sidebar-brand { margin-bottom: 0; }
  .sidebar-nav-item { padding: 8px 10px; }

  .sidebar-footer {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .sidebar-user-email { display: none; }
  .btn-signout { width: auto; }

  .main-content { padding: 24px 16px 40px; }
}

@media (max-width: 640px) {
  .directory-card { padding: 24px 18px 16px; }
  .directory-toolbar { flex-direction: column; }
  .search-input, .filter-select, .btn-reset { flex: 1 1 auto; }
}

@media (max-width: 420px) {
  .card { padding: 32px 22px 26px; }
}

@media (max-width: 480px) {
  .field-row { flex-direction: column; gap: 0; }
}
