/* ── Reset & Variables ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-navy:    #0d2b5e;
  --c-blue:    #1a4a8a;
  --c-sky:     #e8eef8;
  --c-border:  #c8d6ec;
  --c-text:    #1a1a2e;
  --c-muted:   #6b7c9d;
  --c-white:   #ffffff;
  --shadow-sm: 0 1px 4px rgba(13,43,94,.10);
  --shadow-md: 0 3px 10px rgba(13,43,94,.13);
  --r-card:    14px;
  --r-bubble:  18px;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
html {
  background: #0a1e3d;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--c-sky);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  color: var(--c-text);
  font-size: 14px;
  box-shadow: 0 0 48px rgba(0,0,0,.45);
}

/* ── Header ────────────────────────────────────────────────────────────────── */
header {
  background: var(--c-navy);
  color: var(--c-white);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.28);
  z-index: 20;
}

/* ── Language switcher ─────────────────────────────────────────────────────── */
.lang-switcher {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.ls-btn {
  background: rgba(255,255,255,.10);
  border: 1.5px solid rgba(255,255,255,.25);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.6);
  cursor: pointer;
  letter-spacing: .4px;
  transition: background .13s, color .13s, border-color .13s;
}

.ls-btn.active {
  background: rgba(255,255,255,.92);
  color: var(--c-navy);
  border-color: transparent;
}

.ls-btn:not(.active):hover {
  background: rgba(255,255,255,.20);
  color: var(--c-white);
  border-color: rgba(255,255,255,.5);
}

.header-avatar {
  width: 40px; height: 40px;
  background: rgba(255,255,255,.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.header-info h1 { font-size: 15px; font-weight: 700; line-height: 1.2; }
.header-info p  { font-size: 11px; opacity: .7; margin-top: 1px; }

/* ── Breadcrumb ────────────────────────────────────────────────────────────── */
#breadcrumb {
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  padding: 7px 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--c-muted);
  flex-wrap: wrap;
  min-height: 34px;
  z-index: 10;
}

#breadcrumb:empty { display: none; }

.bc-item {
  color: var(--c-blue);
  cursor: pointer;
  white-space: nowrap;
  padding: 1px 3px;
  border-radius: 4px;
  transition: background .12s;
}
.bc-item:hover { background: var(--c-sky); }

.bc-sep { color: var(--c-border); user-select: none; }

.bc-current {
  color: var(--c-text);
  font-weight: 500;
  white-space: nowrap;
}

/* ── Chat area ─────────────────────────────────────────────────────────────── */
#chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Message bubbles ───────────────────────────────────────────────────────── */
.msg {
  max-width: 92%;
  padding: 12px 15px;
  border-radius: var(--r-bubble);
  line-height: 1.6;
  word-break: break-word;
  animation: fadeUp .2s ease both;
}

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

.msg.bot {
  background: var(--c-white);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: var(--shadow-sm);
}

.msg.user {
  background: var(--c-navy);
  color: var(--c-white);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  font-size: 13.5px;
}

/* ── Language selector ─────────────────────────────────────────────────────── */
.lang-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.lang-btn {
  flex: 1;
  min-width: 90px;
  padding: 10px 8px;
  background: var(--c-white);
  border: 2px solid var(--c-border);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  color: var(--c-navy);
  transition: border-color .13s, background .13s, transform .1s;
}
.lang-btn:hover {
  border-color: var(--c-navy);
  background: var(--c-sky);
  transform: translateY(-1px);
}

/* ── Main menu grid ────────────────────────────────────────────────────────── */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 12px;
}

.menu-card {
  background: var(--c-white);
  border: 2px solid var(--c-border);
  border-radius: var(--r-card);
  padding: 14px 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 5px;
  color: var(--c-navy);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  transition: border-color .13s, background .13s, box-shadow .13s, transform .1s;
  user-select: none;
}
.menu-card:hover {
  border-color: var(--c-navy);
  background: #f0f5ff;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.menu-card .card-icon { font-size: 26px; line-height: 1; }

/* ── Level selector ────────────────────────────────────────────────────────── */
.level-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.level-btn {
  background: var(--c-white);
  border: 2px solid var(--c-border);
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  text-align: left;
  color: var(--c-navy);
  transition: border-color .13s, background .13s;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.level-btn:hover { border-color: var(--c-navy); background: var(--c-sky); }
.level-btn .lvl-name { font-weight: 600; font-size: 14px; }
.level-btn .lvl-desc { font-size: 12px; color: var(--c-muted); }

/* ── Back buttons ──────────────────────────────────────────────────────────── */
.back-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--c-sky);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  background: transparent;
  border: 1.5px solid var(--c-border);
  border-radius: 20px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--c-blue);
  transition: border-color .13s, background .13s, color .13s;
}
.btn-back:hover { border-color: var(--c-navy); background: var(--c-sky); color: var(--c-navy); }

/* ── Scrollable list with filter ───────────────────────────────────────────── */
.list-wrap { margin-top: 10px; }

.filter-box {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--c-border);
  border-radius: 10px;
  font-size: 13px;
  outline: none;
  margin-bottom: 8px;
  background: var(--c-white);
  color: var(--c-text);
  transition: border-color .13s;
}
.filter-box:focus { border-color: var(--c-blue); }

.scroll-list {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.empty-msg { color: var(--c-muted); font-size: 13px; padding: 8px 0; }

/* ── Cards: programs & costs ───────────────────────────────────────────────── */
.prog-card, .cost-card {
  background: var(--c-sky);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.55;
}

.prog-card .card-name { font-weight: 600; color: var(--c-navy); font-size: 13px; }
.prog-card .card-meta { color: var(--c-muted); margin-top: 3px; }

.cost-card .card-name  { font-weight: 600; color: var(--c-navy); font-size: 13px; }
.cost-card .card-inst  { color: var(--c-muted); font-size: 11.5px; margin-top: 2px; }
.cost-card .card-price { font-size: 13.5px; font-weight: 700; color: var(--c-blue); margin-top: 5px; }
.cost-card .card-meta  { color: var(--c-muted); font-size: 11px; margin-top: 3px; font-style: italic; }

/* ── Scores table ──────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
  margin-top: 8px;
  border-radius: 8px;
  border: 1px solid var(--c-border);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 11.5px;
  min-width: 340px;
}

thead th {
  background: var(--c-navy);
  color: var(--c-white);
  padding: 8px 7px;
  text-align: center;
  font-weight: 600;
  white-space: pre-line;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody td {
  border: 1px solid var(--c-border);
  padding: 6px 8px;
  text-align: center;
  vertical-align: top;
}

tbody tr:nth-child(even) td { background: #f4f7fd; }
tbody td:first-child { text-align: left; font-weight: 500; line-height: 1.5; }

/* ── Contact card ──────────────────────────────────────────────────────────── */
.contact-card {
  background: var(--c-sky);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 8px;
  font-size: 13px;
}

.cc-header {
  background: var(--c-navy);
  color: var(--c-white);
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13.5px;
}

.cc-section {
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cc-section:last-child { border-bottom: none; }

.cc-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}

.cc-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.cc-label { color: var(--c-muted); font-size: 11.5px; }
.cc-value { color: var(--c-text); font-weight: 500; }
.cc-value a { color: var(--c-blue); text-decoration: none; }
.cc-value a:hover { text-decoration: underline; }

/* ── Scores table filter ───────────────────────────────────────────────────── */
.scores-filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

/* ── Typing indicator ──────────────────────────────────────────────────────── */
.typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 3px 0;
}
.typing span {
  width: 8px; height: 8px;
  background: var(--c-border);
  border-radius: 50%;
  animation: bounce 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(.75); opacity: .4; }
  40%           { transform: scale(1);   opacity: 1; }
}

/* ── Section title inside bot bubble ──────────────────────────────────────── */
.section-title {
  font-weight: 600;
  color: var(--c-navy);
  margin-bottom: 8px;
  font-size: 13.5px;
}

/* ── Paragraph inside bot bubble ──────────────────────────────────────────── */
.msg-text { white-space: pre-wrap; line-height: 1.65; }

/* ── Institute / campus filter chips ──────────────────────────────────────── */
.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.chip {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--c-border);
  background: #fff;
  color: var(--c-navy);
  white-space: nowrap;
  transition: background .15s, color .15s;
  user-select: none;
}
.chip:hover  { background: var(--c-border); }
.chip.active { background: var(--c-navy); color: #fff; border-color: var(--c-navy); }

/* ── Cost-type section separator ──────────────────────────────────────────── */
.cost-type-sep {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 4px 4px;
  border-top: 1px solid var(--c-border);
  margin-top: 4px;
}
.cost-type-sep:first-child { border-top: none; margin-top: 0; padding-top: 4px; }

/* ── FAQ group accordion ─────────────────────────────────────────────────── */
.faq-groups { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
.faq-group {
  border: 1.5px solid var(--c-border);
  border-radius: 10px;
  overflow: hidden;
}
.faq-group-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--c-navy);
  background: var(--c-sky);
  user-select: none;
  transition: background .15s;
}
.faq-group-hdr::after {
  content: "+";
  display: inline-block;
  margin-left: auto;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c-navy);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  line-height: 22px;
}
.faq-group.open .faq-group-hdr { background: #dce8f8; }
.faq-group.open .faq-group-hdr::after { content: "−"; background: #555; }
.faq-group-hdr:hover { background: var(--c-border); }
.faq-group-icon { font-size: 16px; flex-shrink: 0; line-height: 1; }
.faq-group-name { flex: 1; line-height: 1.3; }
.faq-group-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.25s ease;
  padding: 0 8px;
}
.faq-group.open .faq-group-body { max-height: 5000px; padding: 8px; }
.faq-loading { text-align: center; padding: 10px; color: var(--c-muted); font-size: 12px; }

/* ── FAQ accordion ───────────────────────────────────────────────────────── */
.faq-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.faq-item {
  background: var(--c-sky);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  overflow: hidden;
}
.faq-q {
  padding: 10px 12px;
  font-weight: 600;
  color: var(--c-navy);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.45;
}
.faq-q::after { content: "▾"; font-size: 11px; color: var(--c-muted); flex-shrink: 0; margin-top: 2px; }
.faq-item.open .faq-q::after { content: "▴"; }
.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
  font-size: 12.5px;
  color: var(--c-text);
  white-space: pre-wrap;
  line-height: 1.6;
  padding: 0 12px;
}
.faq-item.open .faq-a { max-height: 800px; padding: 0 12px 12px; }
