:root {
  --bg: #f2f4ef;
  --card: #ffffff;
  --ink: #172121;
  --muted: #516262;
  --accent: #cf5c36;
  --accent-soft: #f2d0c3;
  --line: #d8dfd1;
  --shadow: 0 20px 50px rgba(23, 33, 33, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 10%, #edf3dc 0%, transparent 35%),
    radial-gradient(circle at 90% 90%, #ffe4d8 0%, transparent 45%), var(--bg);
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  z-index: -1;
  filter: blur(12px);
  opacity: 0.4;
}

.bg-shape-1 {
  width: 240px;
  height: 240px;
  left: -70px;
  top: 12%;
  background: #e3ecce;
  animation: floatA 8s ease-in-out infinite;
}

.bg-shape-2 {
  width: 280px;
  height: 280px;
  right: -80px;
  bottom: 8%;
  background: #ffd7c6;
  animation: floatB 9s ease-in-out infinite;
}

@keyframes floatA {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-18px);
  }
}

@keyframes floatB {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(22px);
  }
}

.app {
  max-width: 1060px;
  margin: 40px auto;
  padding: 28px;
  background: color-mix(in srgb, var(--card) 88%, #f9fbf2 12%);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  animation: appear 0.55s ease;
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero h1 {
  margin: 8px 0;
  font-family: "Fraunces", serif;
  font-size: clamp(2rem, 4.5vw, 3rem);
  letter-spacing: -0.02em;
}

.badge {
  display: inline-block;
  margin: 0;
  background: var(--accent-soft);
  color: #6d2f1b;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}
.badge-link {
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.badge-link:hover {
  background: var(--accent);
  color: white;
}

.subtitle {
  margin-top: 0;
  color: var(--muted);
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) minmax(220px, 1.8fr) minmax(120px, 1fr) minmax(
      130px,
      1fr
    );
  gap: 12px;
  margin: 26px 0 16px;
}

.control-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.compact-field {
  max-width: 170px;
}

.controls label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
}

.controls select,
button {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
}

.controls select:focus {
  outline: 2px solid #f1b39c;
  border-color: var(--accent);
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

#summaryText {
  margin: 0;
  color: var(--muted);
}

button {
  background: var(--accent);
  color: white;
  border: none;
  font-weight: 700;
  cursor: pointer;
}

.prof-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 2px;
}

.prof-link:hover {
  text-decoration-color: var(--accent);
}

button:hover {
  filter: brightness(0.95);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

#pageText {
  margin: 0;
  color: var(--muted);
  min-width: 120px;
  text-align: center;
}

.pager button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

th,
td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #edf1e8;
  font-size: 0.94rem;
}

th {
  background: #f8faf4;
  color: #425252;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: #f9f6ef;
}

@media (max-width: 760px) {
  .app {
    margin: 18px;
    padding: 16px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .pager {
    justify-content: stretch;
  }

  .pager button {
    flex: 1;
  }

  #pageText {
    min-width: 0;
    flex: 1;
  }

  th,
  td {
    padding: 10px;
    font-size: 0.88rem;
  }
}

/* ── Multi-campus additions ───────────────────────────────────────────────── */

.hidden { display: none !important; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 14px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}
.crumb {
  padding: 4px 8px;
  border-radius: 6px;
}
.crumb-link {
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
}
.crumb-link:hover { text-decoration: underline; }
.crumb-sep { color: var(--muted); }
.crumb-filter { font-weight: 600; color: var(--ink); }

/* Step label */
.step-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 20px 0 14px;
}

/* Back button */
.back-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
}
.back-btn:hover { background: var(--accent-soft); }

/* University search + card grid */
.uni-search-wrap {
  margin-top: 8px;
  max-width: 500px;
}
#uniSearch {
  width: 100%;
  padding: 12px 16px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  color: var(--ink);
  background: white;
  border: 2px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s;
}
#uniSearch:focus {
  border-color: var(--accent);
  outline: 2px solid #f1b39c;
}
.uni-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}
.uni-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
  text-align: left;
  font: inherit;
  color: var(--ink);
}
.uni-card:hover {
  border-color: var(--accent);
  background: #fdf7f5;
  box-shadow: 0 2px 8px rgba(207, 92, 54, 0.1);
}
.uni-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
}
.uni-card-stats {
  font-size: 0.78rem;
  color: var(--muted);
}
.uni-grid-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 12px 0;
}
.loading-msg {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 12px;
}

.professor-launch {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.course-launch {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.professor-launch-card {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 82%, #f6faef 18%);
}

.course-launch-card {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 82%, #eef7fb 18%);
}

.professor-launch-card button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.course-launch-card button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Dept search */
.dept-search-wrap {
  margin-bottom: 14px;
}
#deptSearch {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 0.96rem;
  background: white;
}
#deptSearch:focus {
  outline: 2px solid #f1b39c;
  border-color: var(--accent);
}

/* Dept list */
.dept-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 4px;
}
.dept-group {}
.dept-group-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.dept-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 5px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  font-size: 0.92rem;
}
.dept-item:hover {
  border-color: var(--accent);
  background: #fdf7f5;
}
.dept-name { flex: 1; color: var(--ink); font-weight: 500; }
.dept-code {
  font-family: monospace;
  font-size: 0.82rem;
  color: var(--muted);
  background: #f0f2ec;
  padding: 2px 7px;
  border-radius: 5px;
}
.dept-count {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Empty state */
.empty-state {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 8px 0;
}

@media (max-width: 760px) {
  .uni-grid {
    grid-template-columns: 1fr;
    max-height: none;
  }
  .dept-list { max-height: none; }
  .professor-launch-card { grid-template-columns: 1fr; }
  .course-launch-card { grid-template-columns: 1fr; }
}

/* ── Filter Dropdown ─────────────────────────────────────────────────────── */

.filter-dropdown {
  position: relative;
}

.filter-dropdown-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 11px 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 0.94rem;
  color: var(--ink);
  font-weight: 400;
  cursor: pointer;
  text-align: left;
}

.filter-dropdown-btn:hover {
  border-color: var(--accent);
}

.filter-dropdown-btn.open,
.filter-dropdown-btn:focus {
  outline: 2px solid #f1b39c;
  border-color: var(--accent);
}

.filter-dropdown-btn.active-filter {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.filter-dropdown-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-dropdown-arrow {
  color: var(--muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.filter-dropdown-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 100%;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(23, 33, 33, 0.14);
  z-index: 200;
  overflow: hidden;
}

.filter-dropdown-search {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-bottom: 1px solid var(--line);
  font: inherit;
  font-size: 0.9rem;
  background: #fafbf8;
}

.filter-dropdown-search:focus {
  outline: none;
  background: white;
}

.filter-dropdown-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 210px;
  overflow-y: auto;
}

.filter-dropdown-list li {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.91rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.filter-dropdown-list li:hover {
  background: var(--accent-soft);
}

.filter-dropdown-list li[data-value=""] {
  color: var(--muted);
  font-style: italic;
}

.filter-dropdown-list li.selected {
  font-weight: 600;
  color: var(--accent);
}

/* ── About & Stats (landing page content) ──────────────────────────────── */

.about-section {
  margin-top: 40px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.7;
  color: var(--ink);
}
.about-section h2 {
  font-family: "Fraunces", serif;
  font-size: 1.25rem;
  margin: 32px 0 12px;
  color: var(--ink);
}
.about-section p {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0 0 16px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
}
.stat-card .stat-number {
  font-family: "Fraunces", serif;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--accent);
  display: block;
}
.stat-card .stat-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
  display: block;
}
.how-list {
  font-size: 0.95rem;
  color: var(--muted);
  padding-left: 20px;
  margin: 0 0 16px;
}
.how-list li {
  margin-bottom: 8px;
}
.faq-list {
  margin: 0 0 24px;
}
.faq-list dt {
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 16px;
  color: var(--ink);
}
.faq-list dd {
  margin: 4px 0 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ── University Directory Table (pre-rendered for SEO) ─────────────────── */

.directory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 16px 0 24px;
}
.directory-table th {
  text-align: left;
  font-weight: 700;
  color: var(--ink);
  padding: 8px 10px;
  border-bottom: 2px solid var(--line);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.directory-table td {
  padding: 6px 10px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.directory-table td:first-child {
  color: var(--ink);
  font-weight: 500;
}
.directory-table a {
  color: var(--accent);
  text-decoration: none;
}
.directory-table a:hover {
  text-decoration: underline;
}
@media (max-width: 600px) {
  .directory-table th:nth-child(n+3),
  .directory-table td:nth-child(n+3) {
    display: none;
  }
}

/* ── Per-University Landing Page ───────────────────────────────────────── */

.uni-page-subtitle {
  color: var(--muted);
  font-size: 1rem;
  margin: 4px 0 0;
}
.uni-page-stats {
  margin: 24px 0;
}
.uni-page-content {
  background: var(--card);
  border-radius: 20px;
  padding: 28px 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  line-height: 1.7;
}
.uni-page-content h2 {
  font-family: "Fraunces", serif;
  font-size: 1.2rem;
  margin: 28px 0 8px;
  color: var(--ink);
}
.uni-page-content h2:first-child {
  margin-top: 0;
}
.uni-page-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 20px 0 6px;
  color: var(--ink);
}
.uni-page-content p {
  font-size: 0.92rem;
  color: var(--muted);
}
.uni-page-content ul {
  padding-left: 20px;
  margin: 8px 0 16px;
}
.uni-page-content li {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.uni-page-content a {
  color: var(--accent);
  text-decoration: none;
}
.uni-page-content a:hover {
  text-decoration: underline;
}

/* ── Site Footer ────────────────────────────────────────────────────────── */

.site-footer {
  text-align: center;
  padding: 32px 0 16px;
  font-size: 0.85rem;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ── Feedback Page ──────────────────────────────────────────────────────── */

.feedback-card {
  background: var(--card);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
  max-width: 600px;
  margin: 0 auto;
}
.fb-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 500px) {
  .fb-row { grid-template-columns: 1fr; }
}
.fb-field {
  margin-bottom: 18px;
}
.fb-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
.fb-required {
  color: var(--accent);
}
.fb-field input,
.fb-field select,
.fb-field textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s;
}
.fb-field input:focus,
.fb-field select:focus,
.fb-field textarea:focus {
  border-color: var(--accent);
  outline: 2px solid #f1b39c;
}
.fb-field textarea {
  resize: vertical;
}
.fb-submit {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.fb-submit:hover {
  background: #b84e2d;
}
.fb-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.feedback-sent {
  text-align: center;
  padding: 24px 0;
}
.feedback-sent h2 {
  color: var(--ink);
  margin: 0 0 8px;
}
.feedback-sent p {
  color: var(--muted);
}
.fb-back-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.fb-back-link:hover {
  text-decoration: underline;
}
.feedback-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 10px;
  color: #991b1b;
  font-size: 0.9rem;
}

/* ── Privacy Policy Page ────────────────────────────────────────────────── */

.privacy-card {
  background: var(--card);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.7;
}
.privacy-card h2 {
  font-family: "Fraunces", serif;
  font-size: 1.2rem;
  margin: 28px 0 8px;
  color: var(--ink);
}
.privacy-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 16px 0 6px;
  color: var(--ink);
}
.privacy-card p,
.privacy-card li {
  font-size: 0.92rem;
  color: var(--muted);
}
.privacy-card ul {
  padding-left: 20px;
}
.privacy-card a {
  color: var(--accent);
  text-decoration: none;
}
.privacy-card a:hover {
  text-decoration: underline;
}
.privacy-updated {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

/* ── Cookie Consent Banner ──────────────────────────────────────────────── */

#cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--ink);
  color: #e8ebe4;
  z-index: 9999;
  padding: 16px 20px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}
.consent-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.consent-text {
  flex: 1;
  font-size: 0.88rem;
  margin: 0;
  min-width: 200px;
}
.consent-text a {
  color: var(--accent-soft);
  text-decoration: underline;
}
.consent-buttons {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.consent-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.consent-btn:hover {
  opacity: 0.85;
}
.consent-btn-accept {
  background: var(--accent);
  color: white;
}
.consent-btn-decline {
  background: transparent;
  color: #e8ebe4;
  border: 1px solid #e8ebe4;
}
