/*
Theme Name: Maktaba PDF Pro
Theme URI: https://example.com/maktaba-pdf-pro
Author: Codex
Description: قالب عربي سريع لمكتبة كتب PDF مع دعم SEO ونوع محتوى الكتب.
Version: 1.5.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
Text Domain: maktaba-pdf-pro
*/

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #697586;
  --line: #e3e8ef;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --accent: #f59e0b;
  --danger: #b42318;
  --shadow: 0 12px 28px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  direction: rtl;
  background: var(--bg);
  color: var(--text);
  font-family: Tahoma, Arial, sans-serif;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
.wrap { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(248, 250, 247, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.nav {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 22px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
}
.menu {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 15px;
}
.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(390px, 100%);
}
.search-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--text);
}
.btn,
.search-form button,
.wp-block-search__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.btn:hover,
.search-form button:hover { background: var(--brand-dark); }
.btn.secondary { background: #edf4ef; color: var(--brand-dark); }
.btn.danger { background: var(--danger); }
.hero {
  padding: 38px 0 26px;
  background:
    linear-gradient(180deg, rgba(37, 99, 235, .08), rgba(244, 246, 248, 0) 72%),
    var(--bg);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 34px;
  align-items: center;
}
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1.2;
}
.hero p { margin: 0 0 24px; color: var(--muted); font-size: 18px; max-width: 620px; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 24px;
}
.stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}
.stat strong { display: block; font-size: 22px; color: var(--brand-dark); }
.shelf {
  min-height: 280px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.88), rgba(255,255,255,.20)),
    repeating-linear-gradient(90deg, #1d4ed8 0 32px, #f59e0b 32px 44px, #e5eefb 44px 76px);
  box-shadow: var(--shadow);
}
.section { padding: 26px 0; }
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.section h2,
.archive-title {
  margin: 0;
  font-size: 28px;
}
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 18px;
}
.book-grid.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.book-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.book-media-card {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 14px;
  min-height: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.book-media-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, .32);
  box-shadow: var(--shadow);
}
.media-cover {
  aspect-ratio: 2 / 3;
  border-radius: 7px;
  overflow: hidden;
  background: #e7eef8;
}
.media-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.media-tax {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}
.media-body h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
}
.media-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.book-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(20, 40, 31, .05);
  transition: transform .18s ease, box-shadow .18s ease;
}
.book-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.cover {
  aspect-ratio: 2 / 3;
  background: #e6ede8;
  display: grid;
  place-items: center;
  color: var(--muted);
  overflow: hidden;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.book-card-body { padding: 12px; }
.book-card h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.45; }
.meta { color: var(--muted); font-size: 13px; }
.rating { color: var(--accent); font-weight: 800; }
.book-single {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 34px;
  align-items: start;
  padding: 38px 0;
}
.book-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.book-single h1 { margin: 0 0 14px; font-size: clamp(30px, 4vw, 46px); line-height: 1.25; }
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 22px 0;
}
.fact {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
.fact span { display: block; color: var(--muted); font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.notice {
  border: 1px solid #f3b4ad;
  background: #fff4f2;
  color: var(--danger);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 16px;
}
.content-area {
  background: #fff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 28px 0;
}
.content-area h2 {
  margin: 0 0 14px;
  font-size: 24px;
}
.book-description-box {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .055);
  overflow: hidden;
}
.description-title {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fbff, #fff);
}
.description-title h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.4;
}
.description-title span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.description-content {
  padding: 20px;
  font-size: 16px;
  line-height: 2;
}
.description-content p:first-child { margin-top: 0; }
.description-content p:last-child { margin-bottom: 0; }
.book-end-categories {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.book-end-categories strong {
  display: block;
  margin-bottom: 10px;
  font-size: 15px;
}
.book-end-categories div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.book-end-categories a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--brand-dark);
  padding: 0 13px;
  font-size: 13px;
  font-weight: 800;
}
.book-end-categories a:hover {
  background: var(--brand);
  color: #fff;
}
.author-profile-box {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .07), rgba(255,255,255,0) 45%),
    #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .055);
}
.author-photo {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  background: #e7eef8;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--brand-dark);
  font-size: 46px;
  font-weight: 900;
}
.author-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.author-profile-body .eyebrow {
  display: inline-flex;
  margin-bottom: 4px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
}
.author-profile-body h2 {
  margin: 0 0 10px;
  font-size: 24px;
}
.author-bio {
  color: #364152;
  line-height: 1.95;
}
.author-bio p:first-child { margin-top: 0; }
.author-bio p:last-child { margin-bottom: 0; }
.author-source {
  display: inline-flex;
  margin-top: 12px;
  color: var(--brand-dark);
  font-weight: 800;
}
.copyright-report-box {
  margin-top: 18px;
  border: 1px solid #f7c76f;
  border-radius: 8px;
  background: #fffaf0;
  overflow: hidden;
}
.copyright-notice {
  padding: 16px 18px;
}
.copyright-notice h2 {
  margin: 0 0 8px;
  font-size: 21px;
  color: #92400e;
}
.copyright-notice p {
  margin: 4px 0;
  color: #5f4520;
}
.report-success {
  padding: 12px 18px;
  background: #ecfdf3;
  color: #067647;
  border-bottom: 1px solid #abefc6;
  font-weight: 800;
}
.report-details {
  border-top: 1px solid #f7c76f;
  background: #fff;
}
.report-details summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  color: var(--danger);
  font-weight: 900;
  cursor: pointer;
}
.report-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 18px 18px;
}
.report-form label {
  display: grid;
  gap: 6px;
}
.report-form label.wide {
  grid-column: 1 / -1;
}
.report-form span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.report-form input,
.report-form select,
.report-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  font-family: inherit;
}
.report-form textarea {
  resize: vertical;
}
.report-form button {
  width: max-content;
}
.related-section {
  padding-top: 12px;
}
.term-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.term-chip {
  min-height: 74px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  box-shadow: 0 5px 14px rgba(20, 40, 31, .04);
}
.term-chip:hover {
  border-color: rgba(30, 122, 92, .42);
  box-shadow: var(--shadow);
}
.term-chip strong {
  color: var(--brand-dark);
  line-height: 1.45;
}
.term-chip span {
  color: var(--muted);
  font-size: 13px;
}
.iqra-term-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.iqra-term-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.iqra-term-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, .32);
  box-shadow: var(--shadow);
}
.iqra-term-card a {
  display: block;
}
.iqra-term-covers {
  min-height: 118px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 14px 14px 0;
  background: linear-gradient(180deg, #eef4ff, #fff);
}
.iqra-term-covers span {
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  background: #dce7f7;
  overflow: hidden;
  box-shadow: 0 7px 15px rgba(15, 23, 42, .11);
}
.iqra-term-covers img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.iqra-term-covers span span {
  display: none;
}
.iqra-term-body {
  padding: 12px 14px 14px;
}
.iqra-term-body strong {
  display: block;
  font-size: 19px;
  line-height: 1.4;
}
.iqra-term-body small {
  display: block;
  margin-top: 4px;
  color: var(--brand-dark);
  font-weight: 800;
}
.iqra-term-body p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.site-footer {
  padding: 28px 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.pagination { margin-top: 24px; display: flex; gap: 8px; justify-content: center; }
.pagination .page-numbers {
  min-width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }
@media (max-width: 820px) {
  .nav { flex-wrap: wrap; padding: 12px 0; }
  .menu { order: 3; width: 100%; overflow-x: auto; padding-bottom: 4px; }
  .search-form { flex: 1 1 100%; }
  .hero-grid,
  .book-single { grid-template-columns: 1fr; }
  .author-profile-box { grid-template-columns: 1fr; }
  .report-form { grid-template-columns: 1fr; }
  .book-media-grid { grid-template-columns: 1fr; }
  .shelf { min-height: 190px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  .book-media-card { grid-template-columns: 92px 1fr; }
  .iqra-term-grid { grid-template-columns: 1fr; }
}
