/* StudyNet — shared styles
   Palette echoes the Milestone-2 knowledge graph: purple entity nodes,
   teal attributes, light academic background. */

:root {
  --purple: #6b5bd2;
  --purple-dark: #4b3fa0;
  --purple-soft: #ece9fb;
  --teal: #2f8f86;
  --teal-soft: #e2f3f1;
  --ink: #1f2233;
  --muted: #6b7080;
  --line: #e4e3ef;
  --bg: #f7f7fb;
  --card: #ffffff;
  --good: #2f8f86;
  --warn: #c9871f;
  --soft-warn: #fbf2df;
  --radius: 14px;
  --shadow: 0 6px 22px rgba(40, 35, 90, 0.08);
  --shadow-lg: 0 14px 40px rgba(40, 35, 90, 0.14);
  --maxw: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--purple-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------- top navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #8b7fe6, var(--purple));
  box-shadow: 0 0 0 4px var(--purple-soft);
}
.brand small { font-weight: 600; color: var(--muted); font-size: .72rem; letter-spacing: .04em; }
.nav-links { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.nav-links a {
  padding: 8px 13px; border-radius: 9px; color: var(--muted);
  font-weight: 600; font-size: .92rem;
}
.nav-links a:hover { background: var(--purple-soft); color: var(--purple-dark); text-decoration: none; }
.nav-links a.active { background: var(--purple); color: #fff; }

/* ---------- generic layout ---------- */
main { padding: 38px 0 70px; }
h1 { font-size: 2.1rem; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h2 { font-size: 1.4rem; margin: 1.6em 0 .5em; }
h3 { font-size: 1.08rem; margin: 1.2em 0 .4em; }
p { margin: .6em 0; }
.lead { font-size: 1.12rem; color: #3a3f55; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }

.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; letter-spacing: .03em;
  background: var(--teal-soft); color: var(--teal);
}
.tag.purple { background: var(--purple-soft); color: var(--purple-dark); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 11px; border: 0; cursor: pointer;
  font-weight: 700; font-size: .98rem; font-family: inherit;
  background: var(--purple); color: #fff; transition: transform .05s ease, box-shadow .2s;
  box-shadow: 0 6px 16px rgba(107, 91, 210, .28);
}
.btn:hover { text-decoration: none; box-shadow: 0 10px 24px rgba(107, 91, 210, .38); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--purple-dark); border: 1.5px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--purple); }
.btn.teal { background: var(--teal); box-shadow: 0 6px 16px rgba(47, 143, 134, .28); }
.btn.sm { padding: 8px 14px; font-size: .88rem; }
.btn:disabled { opacity: .55; cursor: default; box-shadow: none; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.grid { display: grid; gap: 18px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 820px) { .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 26px 0 8px; }
.hero h1 { font-size: 2.7rem; }
.hero .lead { max-width: 660px; margin: 12px auto 26px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.pill-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 30px; }
.pill { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: .9rem; box-shadow: var(--shadow); }
.pill b { color: var(--purple-dark); }

.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; background: var(--purple-soft);
  color: var(--purple-dark); font-weight: 800; margin-bottom: 8px;
}

/* ---------- forms ---------- */
.field { margin-bottom: 18px; }
.field > label { display: block; font-weight: 700; margin-bottom: 7px; font-size: .95rem; }
.field .hint { font-weight: 500; color: var(--muted); font-size: .82rem; }
select, input[type=text] {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font: inherit; background: #fff; color: var(--ink);
}
select:focus, input:focus { outline: none; border-color: var(--purple); }

.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.chk {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px;
  border: 1.5px solid var(--line); border-radius: 9px; cursor: pointer; font-size: .9rem;
  background: #fff; user-select: none;
}
.chk:hover { border-color: var(--purple); }
.chk input { accent-color: var(--purple); width: 16px; height: 16px; }
.chk.on { background: var(--purple-soft); border-color: var(--purple); color: var(--purple-dark); font-weight: 600; }

/* availability grid */
.avail-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.avail-table th, .avail-table td { border: 1px solid var(--line); padding: 0; text-align: center; }
.avail-table th { background: var(--purple-soft); color: var(--purple-dark); padding: 6px 4px; font-size: .76rem; }
.avail-table td.rowhead { background: #faf9ff; font-weight: 700; color: var(--muted); padding: 4px 6px; white-space: nowrap; }
.slot { display: block; width: 100%; height: 26px; cursor: pointer; }
.slot.on { background: var(--teal); }
.slot:hover { background: var(--teal-soft); }
.slot.on:hover { background: var(--teal); }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--teal-soft); color: var(--teal); border-radius: 8px;
  padding: 4px 10px; font-size: .82rem; font-weight: 600;
}
.chip.purple { background: var(--purple-soft); color: var(--purple-dark); }
.chip.plain { background: #f1f1f7; color: var(--muted); }

/* ---------- match cards ---------- */
.match-card { display: grid; grid-template-columns: 132px 1fr; gap: 20px; align-items: start; }
.score-col { display: flex; justify-content: center; }
@media (max-width: 620px) { .match-card { grid-template-columns: 1fr; } .score-col { justify-content: flex-start; } }
.score-ring { position: relative; width: 120px; height: 120px; }
.score-ring .val { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring .num { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--ink); }
.score-ring .lab { font-size: .68rem; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.rank-badge { display: inline-block; background: var(--purple); color: #fff; font-weight: 800; border-radius: 8px; padding: 2px 9px; font-size: .8rem; margin-right: 8px; }
.partner-name { font-size: 1.2rem; font-weight: 800; }
.kv { margin: 12px 0; }
.kv .k { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.explain {
  background: var(--purple-soft); border-left: 4px solid var(--purple);
  border-radius: 8px; padding: 11px 14px; margin: 12px 0; font-size: .96rem; color: #353a52;
}
.bars { display: grid; gap: 6px; margin-top: 8px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 46px; gap: 8px; align-items: center; font-size: .8rem; }
.bar-track { background: #efeef7; border-radius: 999px; height: 9px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--purple); }
.bar-fill.teal { background: var(--teal); }

.privacy-note { font-size: .82rem; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.lock { color: var(--purple); }

/* opt-in */
.optin { border-top: 1px dashed var(--line); margin-top: 16px; padding-top: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.optin .status { font-size: .9rem; font-weight: 600; }
.status.pending { color: var(--warn); }
.status.connected { color: var(--good); }

/* ---------- peer reputation + rating ---------- */
.rep { margin-top: 4px; }
.rep.new { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rep-head { display: flex; align-items: center; gap: 8px; }
.stars { letter-spacing: 1px; font-size: 1.05rem; line-height: 1; }
.star { color: #dcdae8; }
.star.full { color: #e9a93c; }
.star.half { background: linear-gradient(90deg, #e9a93c 50%, #dcdae8 50%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.rep-nudge { margin-top: 8px; font-size: .82rem; font-weight: 700; display: inline-block;
  padding: 3px 10px; border-radius: 999px; }
.rep-nudge.up { background: var(--teal-soft); color: var(--teal); }
.rep-nudge.down { background: var(--soft-warn); color: var(--warn); }

.rate-form { margin-top: 14px; padding: 14px; border: 1px solid var(--line);
  border-radius: 10px; background: #faf9ff; }
.rate-title { font-weight: 800; margin-bottom: 10px; }
.rate-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 10px; margin-bottom: 6px; }
.rate-label { font-size: .9rem; font-weight: 600; }
.rate-stars { display: inline-flex; gap: 2px; }
.rate-star { border: 0; background: none; cursor: pointer; font-size: 1.5rem;
  line-height: 1; color: #dcdae8; padding: 0 2px; transition: color .1s; }
.rate-star:hover, .rate-star.on { color: #e9a93c; }
.rate-actions { margin-top: 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- callouts ---------- */
.callout { background: var(--teal-soft); border: 1px solid #cfe9e5; border-radius: var(--radius); padding: 18px 20px; }
.callout.warn { background: var(--soft-warn); border-color: #f0dcab; }
.callout.purple { background: var(--purple-soft); border-color: #ddd6f7; }

.banner { background: linear-gradient(120deg, var(--purple-soft), var(--teal-soft)); border-radius: var(--radius); padding: 20px 22px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

footer { border-top: 1px solid var(--line); padding: 26px 0; color: var(--muted); font-size: .86rem; }
footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- graph ---------- */
.graph-shell { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; overflow: hidden; }
.graph-shell svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.lg-dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.lg-box { width: 16px; height: 11px; border-radius: 3px; display: inline-block; border: 1.5px solid var(--teal); background: var(--teal-soft); }

table.simple { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.simple th, table.simple td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.simple th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

.notice { background: #fff; border: 1px dashed var(--purple); border-radius: var(--radius); padding: 20px; text-align: center; }

/* ---------- filter bar ---------- */
.filterbar { margin-bottom: 22px; }
.filterbar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.filterbar-head b { font-size: 1.05rem; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 18px; }
.flt { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--ink); }
.flt > span { white-space: nowrap; }
.flt select { flex: 1; padding: 7px 9px; }
.flt input[type=checkbox] { accent-color: var(--purple); width: 16px; height: 16px; }
.flt.disabled { opacity: .45; }
.flt.disabled input { cursor: not-allowed; }
