/* Faith Essentials — shared component base (Untitled-UI-flavored).
   Depends on tokens.css. Variations may add their own CSS but should build on these classes
   so all three prototypes share one visual language. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--fe-font);
  background: var(--fe-bg);
  color: var(--fe-text-primary);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0; }
img { max-width: 100%; display: block; }
.muted { color: var(--fe-text-secondary); }
.tertiary { color: var(--fe-text-tertiary); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: var(--fe-space-s); }
.col { display: flex; flex-direction: column; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--fe-space-s); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: var(--fe-space-m); }

/* ---------- App shell: left sidebar + content ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.app.with-rail { grid-template-columns: 264px 1fr 320px; }
.sidebar {
  background: var(--fe-white);
  border-right: 1px solid var(--fe-border);
  padding: var(--fe-space-m);
  display: flex; flex-direction: column; gap: var(--fe-space-m);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; padding: 4px; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; background: var(--grad-fiqh); display: grid; place-items: center; color: #fff; font-weight: 800; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fe-text-tertiary); margin: var(--fe-space-m) 4px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--fe-radius-sm);
  color: var(--fe-text-secondary); font-weight: 600; cursor: pointer;
}
.nav-item .ico { width: 20px; text-align: center; opacity: .8; }
.nav-item:hover { background: var(--fe-bg); color: var(--fe-text-primary); }
.nav-item.active { background: var(--fe-brand-50); color: var(--fe-brand); }
.content { padding: var(--fe-space-l) var(--fe-space-xl); max-width: 1100px; }
.rail { background: var(--fe-white); border-left: 1px solid var(--fe-border); padding: var(--fe-space-m); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--fe-space-l); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; font-family: inherit;
  font-weight: 700; font-size: 14px; padding: 11px 18px; border-radius: var(--fe-radius-pill); transition: .15s; }
.btn-primary { background: var(--fe-brand); color: #fff; }
.btn-primary:hover { background: var(--fe-brand-700); }
.btn-ghost { background: var(--fe-bg); color: var(--fe-text-primary); }
.btn-ghost:hover { background: var(--fe-border); }
.btn-outline { background: #fff; color: var(--fe-text-primary); border: 1px solid var(--fe-border-strong); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 13px; font-size: 13px; }

/* ---------- Pills / chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--fe-radius-pill);
  background: #fff; border: 1px solid var(--fe-border); color: var(--fe-text-secondary); font-weight: 600; font-size: 13px; cursor: pointer; }
.chip.active { background: var(--fe-text-primary); color: #fff; border-color: var(--fe-text-primary); }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--fe-radius-pill);
  font-size: 12px; font-weight: 700; background: var(--fe-brand-50); color: var(--fe-brand); }
.badge.info { background: var(--fe-info-tint); color: var(--fe-info); }
.badge.soft { background: var(--fe-bg); color: var(--fe-text-secondary); }

/* ---------- Cards ---------- */
.card { background: var(--fe-card-bg); border: 1px solid var(--fe-border); border-radius: var(--fe-radius); box-shadow: var(--fe-shadow-card); }
.card-pad { padding: var(--fe-space-m); }
.grid { display: grid; gap: var(--fe-space-m); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Stat / KPI */
.stat { display: flex; align-items: center; gap: 14px; }
.stat .num { font-size: 28px; font-weight: 800; }
.stat .ico-tile { width: 44px; height: 44px; border-radius: 12px; background: var(--fe-brand-50); color: var(--fe-brand); display: grid; place-items: center; font-size: 20px; }

/* Course card — TYPOGRAPHIC gradient thumbnail (NO photos / NO AI imagery) */
.course-card { overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.course-card:hover { transform: translateY(-2px); box-shadow: var(--fe-shadow-pop); }
.thumb { aspect-ratio: 16/9; display: flex; align-items: flex-end; padding: 14px; color: #fff; position: relative; }
.thumb h3 { font-size: 18px; text-transform: uppercase; letter-spacing: .02em; text-shadow: 0 1px 12px rgba(0,0,0,.35); }
.thumb::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 120% at 80% 0%, rgba(255,255,255,.18), transparent 50%); }
.thumb-fiqh { background: var(--grad-fiqh); } .thumb-spiritual-development { background: var(--grad-spiritual); }
.thumb-belief { background: var(--grad-belief); } .thumb-contemporary-life { background: var(--grad-contemporary); }
.thumb-historical-narrative { background: var(--grad-historical); } .thumb-worship-enhancement { background: var(--grad-worship); }
.thumb-islamic-sciences { background: var(--grad-sciences); }

/* Scholar avatar — MONOGRAM (never a fabricated face). Real photo slots in later. */
.avatar { width: 40px; height: 40px; border-radius: var(--fe-radius-pill); display: grid; place-items: center;
  color: #fff; font-weight: 800; background: var(--grad-belief); flex: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 20px; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }

/* Progress */
.progress { height: 8px; border-radius: var(--fe-radius-pill); background: var(--fe-border); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--fe-brand); border-radius: var(--fe-radius-pill); }

/* Streak flame */
.streak { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--fe-radius-pill);
  background: linear-gradient(135deg, #fff4d6, #ffe2b3); color: #9a5b00; font-weight: 800; }

/* Verse card */
.verse { background: linear-gradient(135deg, #2a1a4a, #3b2566); color: #fff; border-radius: var(--fe-radius-lg); padding: var(--fe-space-ml); }
.verse .ar { font-size: 24px; text-align: right; direction: rtl; line-height: 1.9; margin: 8px 0; }

/* Lesson list */
.lesson { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--fe-radius-sm); cursor: pointer; }
.lesson:hover { background: var(--fe-bg); }
.lesson .play { width: 34px; height: 34px; border-radius: var(--fe-radius-pill); background: var(--fe-brand-50); color: var(--fe-brand); display: grid; place-items: center; }
.lesson.done .play { background: var(--fe-success); color: #fff; }

/* ---------- Chat panel (works with mock-chat.js) ---------- */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 8px 2px; }
.msg { max-width: 88%; padding: 12px 14px; border-radius: var(--fe-radius); font-size: 14px; }
.msg.user { align-self: flex-end; background: var(--fe-brand); color: #fff; border-bottom-right-radius: 6px; }
.msg.bot { align-self: flex-start; background: var(--fe-bg); color: var(--fe-text-primary); border-bottom-left-radius: 6px; }
.cite { display: inline-flex; align-items: center; gap: 6px; margin: 6px 6px 0 0; padding: 4px 10px; border-radius: var(--fe-radius-pill);
  background: #fff; border: 1px solid var(--fe-border); font-size: 12px; font-weight: 600; color: var(--fe-brand); }
.chat-input { display: flex; gap: 8px; margin-top: 10px; }
.chat-input input { flex: 1; border: 1px solid var(--fe-border-strong); border-radius: var(--fe-radius-pill); padding: 12px 16px; font-family: inherit; font-size: 14px; }
.chat-input input:focus { outline: 2px solid var(--fe-brand-50); border-color: var(--fe-brand); }

/* Search input */
.search { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--fe-border-strong);
  border-radius: var(--fe-radius-pill); padding: 11px 18px; }
.search input { border: 0; outline: 0; flex: 1; font-family: inherit; font-size: 15px; background: transparent; }

/* Responsive: collapse to single column on small screens */
@media (max-width: 1000px) {
  .app, .app.with-rail { grid-template-columns: 1fr; }
  .sidebar, .rail { position: static; height: auto; }
  .content { padding: var(--fe-space-m); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
