/* ============================================================
   المكتبة المعرفية — تعتمد app.css
   ============================================================ */

.lib-page { max-width: 1360px; margin: 0 auto; padding: 30px 48px 72px; }
.lib-grid { display: grid; grid-template-columns: 280px 1fr; gap: 34px; align-items: start; }
.lib-grid > * { min-width: 0; }

/* ---------- الفهرس ---------- */
.lib-index {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 0 12px; position: sticky; top: 24px;
  max-height: calc(100vh - 48px); overflow: auto;
}
.lib-index__t {
  font-size: 15px; font-weight: 700; color: var(--green);
  padding: 0 22px 12px; border-bottom: 1px solid var(--line);
}
.lib-search { padding: 12px 22px 4px; }
.lib-search input {
  width: 100%; min-width: 0; height: 40px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  font: inherit; font-size: 14px; padding: 0 12px; color: inherit;
}
.lib-search input:focus { border-color: var(--green); outline: 0; }
.lib-cat { padding: 12px 22px 2px; }
.lib-cat__n { font-size: 13px; font-weight: 700; color: var(--gold-press); }
.lib-link {
  display: block; width: 100%; text-align: right; font: inherit;
  font-size: 13.5px; padding: 8px 10px; margin: 2px -10px 0;
  border-radius: 8px; color: var(--ink-2); font-weight: 500;
  background: none; border: 0; cursor: pointer; line-height: 1.7;
}
.lib-link:hover { background: #F4F8F6; color: var(--green); }
.lib-link[aria-current="true"] { background: var(--green-soft); color: var(--green); font-weight: 700; }
.lib-empty { padding: 16px 22px; font-size: 13.5px; color: var(--hint); line-height: 1.9; }

/* ---------- المقال ---------- */
.art__badge {
  display: inline-flex; font-size: 12.5px; font-weight: 700;
  background: var(--green-soft); color: var(--green);
  border-radius: 20px; padding: 5px 14px;
}
.art h1 { margin: 14px 0 0; font-size: 32px; font-weight: 700; color: var(--green); line-height: 1.5; }
.art__sum { margin: 14px 0 0; font-size: 16.5px; color: var(--ink-2); line-height: 2; max-width: 760px; }
.art__meta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--hint); margin: 16px 0 24px;
}

.opinions {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.opinions table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.opinions th {
  text-align: right; padding: 14px 20px; font-weight: 700;
  background: var(--green-soft); color: var(--green); width: 25%;
}
.opinions th + th, .opinions td + td { border-inline-start: 1px solid var(--line); }
.opinions thead th + th { border-inline-start-color: #D9E6E2; }
.opinions td { padding: 18px 20px; border-top: 1px solid var(--line); vertical-align: top; }
.op__text { font-size: 15px; font-weight: 700; line-height: 1.75; }
.op__ref {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--gold-press); margin-top: 10px;
}
.op__try {
  display: block; margin-top: 12px; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--green); background: none; border: 0; padding: 0; cursor: pointer;
  text-align: right; border-bottom: 1px dashed var(--green); line-height: 1.8;
}
.op__try:hover { color: var(--green-dark); }

.defs {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.defs table { width: 100%; border-collapse: collapse; font-size: 15px; }
.defs td { padding: 15px 20px; border-top: 1px solid var(--line); line-height: 1.9; }
.defs tr:first-child td { border-top: 0; }
.defs td.k { background: #F4F8F6; font-weight: 700; color: var(--green); width: 26%; vertical-align: top; }

.art__body { max-width: 760px; font-size: 15.5px; line-height: 2.1; color: var(--ink-2); margin-top: 26px; }
.art__body p { margin: 0 0 14px; }
.art__body p:last-child { margin-bottom: 0; }

.cta {
  background: var(--green); border-radius: var(--radius); padding: 26px 30px;
  margin-top: 30px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.cta__t { position: relative; font-size: 19px; font-weight: 700; color: #fff; }
.cta__d { position: relative; font-size: 14px; color: #CFE0DA; margin-top: 6px; line-height: 1.8; }
.cta__go {
  position: relative; height: 48px; display: inline-flex; align-items: center;
  padding: 0 30px; border-radius: var(--radius);
  background: var(--green-soft); color: var(--green);
  font-size: 15px; font-weight: 700; flex: none; border: 0; font-family: inherit; cursor: pointer;
}
.cta__go:hover { background: #fff; color: var(--green-dark); }

.art__nav {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 26px; flex-wrap: wrap;
}
.art__nav button {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--green);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 12px 20px; cursor: pointer; line-height: 1.6; text-align: right;
}
.art__nav button:hover { border-color: var(--green); }
.art__nav button:disabled { opacity: .4; cursor: not-allowed; }

@media (max-width: 1000px) {
  .lib-grid { grid-template-columns: 1fr; gap: 22px; }
  .lib-index { position: static; max-height: none; }
  .lib-page { padding: 24px 20px 56px; }
}
@media (max-width: 620px) {
  .lib-page { padding: 20px 14px 48px; }
  .art h1 { font-size: 23px; }
  .art__sum { font-size: 15px; }
  .opinions table, .opinions thead, .opinions tbody, .opinions tr { display: block; }
  .opinions thead { display: none; }
  .opinions td { display: block; border-inline-start: 0; }
  .opinions td::before {
    content: attr(data-m); display: block; font-size: 12.5px; font-weight: 700;
    color: var(--green); margin-bottom: 6px;
  }
  .defs td.k { width: auto; }
  .defs tr { display: block; border-top: 1px solid var(--line); }
  .defs td { display: block; border-top: 0; }
  .cta__go { width: 100%; justify-content: center; }
}
