/* CAMPUS — city tabs, university grid, and detail modal content. */

.campus-intro { padding-bottom: 12px; }
.campus-grid-section { padding-top: 16px; }

.city-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 30px; }
.city-tab {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 0 18px;
  color: var(--muted);
  background: var(--surface);
  backdrop-filter: blur(18px);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}
.city-tab:hover { color: var(--text); background: var(--surface-strong); }
.city-tab[aria-selected="true"] {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--red-bright), var(--red));
}

.campus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.campus-card { border-radius: 10px; overflow: hidden; cursor: pointer; text-align: left; padding: 0; border: 1px solid var(--line); color: inherit; font: inherit; }
.campus-card .cc-cover { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #111; }
.campus-card .cc-cover img { width: 100%; height: 100%; object-fit: cover; opacity: 0.94; transition: transform 0.5s ease; }
.campus-card:hover .cc-cover img { transform: scale(1.05); }
.campus-card .cc-cover::after {
  position: absolute; inset: 0; content: "";
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.62));
}
.campus-card .cc-abbr {
  position: absolute; z-index: 1; top: 12px; left: 12px;
  border-radius: 10px; padding: 4px 10px;
  font-size: 0.72rem; font-weight: 900; letter-spacing: 0.04em;
  color: #fff; background: rgba(143, 9, 21, 0.86); backdrop-filter: blur(10px);
}
.campus-card .cc-body { padding: 16px 16px 18px; }
.campus-card .cc-body h3 { margin: 0; font-size: 1.16rem; line-height: 1.25; }
.campus-card .cc-view { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--gold); font-weight: 900; font-size: 0.86rem; }

/* ---- Modal content ---- */
.cm-section { padding: 6px 0 20px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.cm-section:last-child { border-bottom: 0; margin-bottom: 0; }
.cm-section h3 {
  margin: 0 0 14px; font-size: 1.05rem; color: var(--gold);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.cm-summary { margin: 0 0 14px; color: var(--muted); line-height: 1.7; }

.cm-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cm-figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.cm-figure img { width: 100%; height: 200px; object-fit: cover; }
.cm-figure figcaption { padding: 8px 10px; font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.cm-figure .cm-credit { display: block; margin-top: 3px; color: var(--subtle); font-size: 0.7rem; }

.cm-facts { display: grid; gap: 8px; margin: 0; }
.cm-fact { display: grid; grid-template-columns: minmax(120px, 0.5fr) 1fr; gap: 12px; }
.cm-fact dt { color: var(--subtle); font-weight: 800; font-size: 0.86rem; }
.cm-fact dd { margin: 0; color: var(--text); }

.cm-halal {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  border: 1px solid rgba(31, 157, 85, 0.4); border-radius: 12px; padding: 8px 12px;
  color: var(--text); background: rgba(31, 157, 85, 0.12); font-weight: 700; font-size: 0.9rem;
}
.cm-halal::before { content: "☪"; color: #1f9d55; }

.cm-highlights { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.cm-highlights li { position: relative; padding-left: 22px; color: var(--muted); line-height: 1.6; }
.cm-highlights li::before { position: absolute; left: 0; top: 0.5em; width: 8px; height: 8px; border-radius: 50%; content: ""; background: var(--red-bright); }

.cm-empty { color: var(--subtle); font-style: italic; }
.cm-apply-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; }
.cm-gallery--gap { margin-top: 12px; } /* was an inline style on the second gallery block */
.cm-official { color: var(--muted); font-weight: 800; border-bottom: 2px solid var(--line); }

@media (max-width: 560px) {
  .cm-gallery { grid-template-columns: 1fr; }
  .cm-fact { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------------- Nationwide university database explorer ---------------- */
.campus-db { padding-top: 24px; }

.db-controls {
  margin-top: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.db-search {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
}
.db-search:focus { border-color: var(--gold); outline: none; }

.db-selects { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.db-select { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; color: var(--muted); font-weight: 700; }
.db-select select {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.db-select select:focus { border-color: var(--gold); outline: none; }

.db-chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.db-chip {
  padding: 7px 13px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}
.db-chip:hover { background: var(--surface-strong); }
.db-chip[aria-pressed="true"] {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--red-bright), var(--red));
}
.db-reset {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--subtle);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}
.db-reset:hover { color: var(--text); }
.db-count { color: var(--subtle); font-size: 0.84rem; font-weight: 700; }

/* ---------- data-table view (database-console style) ---------- */
.db-results { margin-top: 20px; }
.db-table {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
/* shared column grid for header + rows + group captions */
.db-head,
.db-row {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.25fr) 0.9fr 0.8fr minmax(0, 1.7fr) 0.5fr;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
}
.db-head {
  position: sticky;
  top: 70px; /* clears the 69px fixed site header */
  z-index: 3;
  min-height: 38px;
  background: var(--bg-soft); /* opaque: sticky over scrolling rows */
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--subtle);
}
.db-group {
  position: sticky;
  top: 108px; /* header (70) + column head (38) */
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 16px;
  background: var(--bg); /* opaque, one step deeper than the head */
  border-bottom: 1px solid var(--line);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--subtle);
}
.db-group__meta { font-variant-numeric: tabular-nums; opacity: 0.8; }

.db-row {
  width: 100%;
  min-height: 44px;
  padding-top: 8px;
  padding-bottom: 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.db-row:last-child { border-bottom: 0; }
.db-row:hover { background: var(--surface-strong); }
.db-cell { min-width: 0; font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; }
.db-cell--name { display: flex; flex-direction: column; gap: 1px; white-space: normal; }
.db-cell--name b { font-size: 0.92rem; font-weight: 700; }
.db-cell__en { color: var(--subtle); font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-cell--region { color: var(--muted); white-space: nowrap; }
.db-cell--type, .db-cell--level { color: var(--muted); white-space: nowrap; }
.db-cell--tags { display: flex; flex-wrap: wrap; gap: 4px; overflow: visible; }
.db-cell--rank { text-align: right; color: var(--subtle); font-weight: 800; font-variant-numeric: tabular-nums; }

.db-badge {
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1.5;
}
.db-badge--flag { color: var(--gold); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); }
.db-badge--intl { color: #1f9d55; border: 1px solid color-mix(in srgb, #1f9d55 45%, transparent); }

.db-empty, .db-loading { color: var(--subtle); font-style: italic; padding: 18px 4px; }
.db-more-row { display: flex; justify-content: center; margin-top: 18px; }

/* narrow viewports: drop the low-signal columns, keep name / region / tags */
@media (max-width: 720px) {
  .db-head, .db-row {
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 10px;
  }
  .db-cell--type, .db-cell--level, .db-cell--rank { display: none; }
}

/* guest wall: random-100 Beijing preview banner + locked links */
.db-lock {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; margin: 0 0 16px; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
}
.db-lock span { color: var(--subtle); font-size: 0.9rem; line-height: 1.5; flex: 1 1 260px; }
.db-lock .button { flex: none; }
.udm-links--locked { color: var(--subtle); font-size: 0.88rem; }

/* ---------- database detail modal ---------- */
.unidb-dialog { width: min(720px, calc(100% - 28px)); }
.udm-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.udm-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 0 0 6px; }
.udm-item { display: grid; gap: 2px; }
.udm-item dt { color: var(--subtle); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.udm-item dd { margin: 0; color: var(--text); font-size: 0.92rem; line-height: 1.55; }
.udm-section { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.udm-section h3 { margin: 0 0 10px; font-size: 1rem; }
.udm-enroll { font-weight: 800; margin: 0 0 12px; }
.udm-enroll--yes { color: #1f9d55; }
.udm-enroll--no { color: var(--red-bright); }
.udm-enroll--unknown { color: var(--muted); }
.udm-links { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0 0; }
.udm-link { color: var(--gold); font-weight: 800; border-bottom: 2px solid var(--line); }
.udm-link:hover { border-color: var(--gold); }
.udm-disclaimer { color: var(--subtle); font-size: 0.8rem; line-height: 1.6; margin: 12px 0 0; }
.udm-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }

@media (max-width: 820px) {
  .db-selects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .db-row { flex-wrap: wrap; gap: 8px; }
  .db-row__main { flex-basis: 100%; }
  .db-row__meta { flex: 1 1 auto; }
  .udm-meta { grid-template-columns: 1fr; }
}
