/* ============================================================
   MentorHub — design system
   ============================================================ */

:root {
  --accent: #6D5AE6;
  --accent-strong: #5746C9;
  --accent-soft: #EFECFD;
  --grad: linear-gradient(135deg, #6D5AE6 0%, #9B5AE6 55%, #C45AD6 100%);

  --bg: #F7F7FB;
  --surface: #FFFFFF;
  --surface-2: #F2F1F8;
  --border: #E7E5F0;
  --text: #17171F;
  --muted: #6E6E80;
  --danger: #D6455D;
  --danger-soft: #FBEAED;
  --success: #1E9E6A;
  --success-soft: #E6F6EF;
  --warn: #B97A12;
  --warn-soft: #FCF3E3;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(23, 23, 31, .05), 0 8px 24px rgba(23, 23, 31, .07);
  --shadow-lg: 0 12px 48px rgba(23, 23, 31, .18);

  --topbar-h: 60px;
  --bnav-h: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .35em; }
h1 { font-size: clamp(1.5rem, 3.5vw, 2rem); letter-spacing: -.02em; }
h2 { font-size: 1.05rem; letter-spacing: -.01em; }
p { margin: 0; }
.muted { color: var(--muted); font-size: .9em; }
.hidden { display: none !important; }

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(247, 247, 251, .85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  height: var(--topbar-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -.01em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--grad);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(109, 90, 230, .35);
}

.topnav { display: none; gap: 4px; flex: 1; }

.navlink {
  padding: 7px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: .9rem;
  transition: background .15s, color .15s;
}

.navlink:hover { color: var(--text); background: var(--surface-2); }
.navlink.active { color: var(--accent-strong); background: var(--accent-soft); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.net-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.net-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.net-pill.online .dot { background: var(--success); }
.net-pill.offline .dot { background: var(--danger); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  border-radius: 12px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  font-size: .92rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s, box-shadow .12s, background .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(109, 90, 230, .3);
}
.btn-primary:hover { background: var(--accent-strong); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(23, 23, 31, .04);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-ghost { background: transparent; color: var(--accent-strong); }
.btn-ghost:hover { background: var(--accent-soft); }

.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }

.btn-sm { padding: 8px 14px; font-size: .85rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* ===== Main layout ===== */
.main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 16px calc(var(--bnav-h) + env(safe-area-inset-bottom) + 24px);
  min-height: calc(100dvh - var(--topbar-h));
}

.view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.subtitle { color: var(--muted); max-width: 46ch; }

/* ===== Search & chips ===== */
.search-row { margin-bottom: 14px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--muted);
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  color: var(--text);
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }

.chip-row.selectable { flex-wrap: wrap; overflow: visible; }

.chip {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}

.chip:hover { border-color: var(--accent); color: var(--accent-strong); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-row.selectable .chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }

.tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: .72rem;
  font-weight: 700;
}

/* ===== Mentor cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.mentor-card { display: flex; flex-direction: column; gap: 12px; }

.mentor-head { display: flex; align-items: center; gap: 12px; }

.avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  letter-spacing: .02em;
}

.mentor-name { font-weight: 700; }
.mentor-title { color: var(--muted); font-size: .85rem; }
.rating { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 700; color: var(--warn); }
.rating svg { fill: var(--warn); }
.mentor-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.mentor-bio { color: var(--muted); font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mentor-actions { display: flex; gap: 8px; margin-top: auto; }

@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

/* ===== Stacks / sessions / goals ===== */
.stack { display: flex; flex-direction: column; gap: 12px; }

.row-card { display: flex; flex-direction: column; gap: 10px; }

.row-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.status {
  flex-shrink: 0;
  display: inline-block;
  border-radius: 999px;
  padding: 3px 11px;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.status-pending { background: var(--warn-soft); color: var(--warn); }
.status-accepted { background: var(--success-soft); color: var(--success); }
.status-declined { background: var(--danger-soft); color: var(--danger); }
.status-completed { background: var(--accent-soft); color: var(--accent-strong); }

.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .83rem; }
.meta strong { color: var(--text); font-weight: 600; }

.goal-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.goal-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--grad);
  transition: width .3s ease;
}

.steps { display: flex; flex-direction: column; gap: 6px; }

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.step input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.step.done span { text-decoration: line-through; color: var(--muted); }

.step-add { display: flex; gap: 8px; }
.step-add input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: .88rem;
  outline: none;
  background: var(--surface);
}
.step-add input:focus { border-color: var(--accent); }

.icon-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--danger); }

/* ===== Profile ===== */
.profile-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 820px) { .profile-grid { grid-template-columns: repeat(2, 1fr); align-items: start; } }

.form-card h2 { margin-bottom: 4px; }
.form-card > .muted { margin-bottom: 14px; }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 6px; }

.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}

.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 90, 230, .15);
}

.field textarea { resize: vertical; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: .9rem; margin-bottom: 16px; }
.kv .muted { align-self: center; }

.secret-note {
  background: var(--success-soft);
  color: var(--success);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: .85rem;
  margin-bottom: 12px;
  word-break: break-all;
}

.listing-link {
  display: block;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .8rem;
  word-break: break-all;
  margin-bottom: 12px;
  color: var(--accent-strong);
}

/* ===== Empty states ===== */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty svg { color: var(--border); margin-bottom: 12px; }
.empty h3 { color: var(--text); }
.empty .btn { margin-top: 14px; }

/* ===== Bottom nav ===== */
.bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: calc(var(--bnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
}

.bnav-item {
  position: relative;
  flex: 1;
  max-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  padding: 8px 0 6px;
  -webkit-tap-highlight-color: transparent;
}

.bnav-item.active { color: var(--accent-strong); }
.bnav-item.active svg { transform: translateY(-1px); }

.badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 26px);
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: .64rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

/* ===== Modal ===== */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(23, 23, 31, .5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  animation: pop .18s ease;
}

@keyframes pop {
  from { transform: scale(.96) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.onboard-hero { text-align: center; margin-bottom: 20px; }
.onboard-hero svg { color: var(--accent); margin-bottom: 8px; }

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

.modal-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== Toasts ===== */
.toasts {
  position: fixed;
  z-index: 80;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom) + 14px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: .88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: rise .2s ease;
  text-align: center;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

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

/* ===== Desktop ===== */
@media (min-width: 760px) {
  .topnav { display: flex; }
  .bottomnav { display: none; }
  .toasts { bottom: 24px; }
  .main { padding-top: 32px; }
  .view-head h1 { font-size: 2rem; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
