/*
Theme Name: ملازمنا
Theme URI: https://example.com/molazimna
Author: Replit
Description: قالب عربي RTL لمكتبة الملازم والكتب والامتحانات، مع صفحات صفوف ومواد حقيقية قابلة للإدارة في WordPress وروابط Telegram وإعدادات للإعلانات والألوان.
Version: 1.4.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
Text Domain: molazimna
*/

:root {
  --mzn-primary: #16b9f4;
  --mzn-accent: #55d9ff;
  --mzn-ink: #18334a;
  --mzn-muted: #6d7f8e;
  --mzn-bg: #f4f8fb;
  --mzn-card: #fff;
  --mzn-border: #e5edf3;
  --mzn-radius: 18px;
  --mzn-shadow: 0 10px 30px rgba(31, 70, 100, .075);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--mzn-ink);
  background: var(--mzn-bg);
  font-family: Tahoma, Arial, "Noto Sans Arabic", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  direction: rtl;
}
a { color: var(--mzn-primary); text-decoration: none; }
a:hover { color: #086cae; }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; }
.site-shell { min-height: 100vh; display: flex; flex-direction: column; }
.container { width: min(1160px, calc(100% - 36px)); margin-inline: auto; }
.site-main { flex: 1; padding: 28px 0 64px; }

.announcement {
  background: var(--mzn-primary);
  color: #fff;
  font-size: 13px;
  text-align: center;
  padding: 5px 14px;
}
.announcement a { color: #fff; text-decoration: underline; }
.site-header {
  position: relative;
  background: linear-gradient(135deg, #08aeea 0%, #20c8f7 48%, #79e7ff 100%);
  border-bottom: 0;
  box-shadow: 0 8px 24px rgba(8,174,234,.22);
  overflow: hidden;
  position: sticky;
  top: 0;
  z-index: 30;
}
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(255,255,255,.30), rgba(255,255,255,0) 38%, rgba(255,255,255,.18) 72%, rgba(255,255,255,0));
  pointer-events: none;
}
.site-header::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 0;
  height: 2px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 0 12px rgba(255,255,255,.85);
  pointer-events: none;
}
.header-row {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; flex: 0 0 auto; position: relative; z-index: 1; }
.brand-mark { width: 56px; height: 56px; object-fit: contain; border-radius: 12px; }
.brand-name { font-size: 23px; line-height: 1.25; font-weight: 800; letter-spacing: -.5px; }
.brand-tagline { display: block; color: rgba(255,255,255,.88); font-size: 11px; font-weight: 400; margin-top: 2px; }
.brand-copy { color: #fff; text-shadow: 0 1px 8px rgba(0,67,104,.18); }
.brand-copy:hover { color: #fff; }
.custom-logo-link { display: flex; }
.custom-logo { max-height: 62px; width: auto; object-fit: contain; }
.primary-nav { display: flex; align-items: center; gap: 5px; }
.primary-nav ul { list-style: none; display: flex; align-items: center; gap: 5px; margin: 0; padding: 0; }
.primary-nav a, .page-menu a {
  display: inline-block;
  padding: 9px 12px;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.primary-nav a:hover, .primary-nav .current-menu-item > a { color: #0879b7; background: rgba(255,255,255,.88); box-shadow: 0 4px 12px rgba(0,75,120,.10); }
.header-actions { display: flex; gap: 9px; align-items: center; }
.search-icon { font-size: 20px; line-height: 1; padding: 9px; }
.menu-toggle { display: none; border: 1px solid rgba(255,255,255,.55); background: rgba(255,255,255,.18); border-radius: 10px; padding: 7px 12px; color: #fff; }
.grade-strip { background: #fff; border-bottom: 1px solid var(--mzn-border); }
.grade-strip-inner { display: flex; gap: 8px; align-items: center; min-height: 42px; overflow-x: auto; scrollbar-width: none; }
.grade-strip-inner::-webkit-scrollbar { display: none; }
.grade-strip a { flex: 0 0 auto; padding: 3px 12px; border: 1px solid #e4edf6; border-radius: 22px; background: #f4f8fd; color: #536a80; font-size: 12px; font-weight: 700; white-space: nowrap; }
.grade-strip a:hover { color: var(--mzn-primary); border-color: #c8def7; background: #edf5ff; }

.button, button.button, input[type="submit"] {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 10px 18px;
  color: #fff;
  background: var(--mzn-primary);
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.button:hover, input[type="submit"]:hover { background: #0876ba; color: #fff; transform: translateY(-1px); }
.button-secondary { background: #eaf6fd; color: var(--mzn-primary); }
.button-secondary:hover { background: #d8effc; color: #0876ba; }
.button-telegram { background: #168bd2; }
.button-telegram:hover { background: #0876ba; }

.hero {
  overflow: hidden;
  position: relative;
  padding: 45px 42px 38px;
  border: 1px solid #d7edf9;
  border-radius: 26px;
  background:
    radial-gradient(circle at 7% 15%, rgba(25,162,222,.13), transparent 24%),
    linear-gradient(125deg, #fff 8%, #f0f9ff 100%);
  box-shadow: var(--mzn-shadow);
}
.hero::after {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  border: 30px solid rgba(24,166,224,.07);
  border-radius: 50%;
  left: -90px;
  bottom: -140px;
}
.hero-copy { position: relative; z-index: 1; max-width: 730px; }
.eyebrow { color: var(--mzn-primary); font-size: 13px; font-weight: 800; margin: 0 0 8px; }
.hero h1 { margin: 0 0 10px; font-size: clamp(30px, 4vw, 46px); line-height: 1.35; letter-spacing: -.8px; }
.hero p { margin: 0 0 22px; max-width: 680px; color: var(--mzn-muted); font-size: 17px; }
.hero-search { display: flex; max-width: 670px; gap: 9px; padding: 7px; border: 1px solid #e4edf3; background: #fff; border-radius: 15px; box-shadow: 0 7px 22px rgba(32, 79, 111, .07); }
.hero-search input[type="search"] { flex: 1; min-width: 0; border: 0; outline: 0; padding: 8px 12px; }
.hero-buttons { display: flex; gap: 9px; margin-top: 14px; flex-wrap: wrap; }
.stats-row { position: relative; z-index: 1; display: flex; gap: 30px; margin-top: 30px; flex-wrap: wrap; }
.stat { display: flex; align-items: baseline; gap: 8px; }
.stat strong { font-size: 23px; color: var(--mzn-primary); }
.stat span { color: var(--mzn-muted); font-size: 13px; }

.ad-slot { margin: 20px auto; text-align: center; min-height: 0; overflow: hidden; }
.ad-slot:empty { display: none; }
.ad-label { color: #9aa7af; font-size: 11px; display: block; margin-bottom: 4px; }
.ad-content { display: flex; justify-content: center; align-items: center; }
.ad-content:empty { display: none; }

.section { margin-top: 42px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 17px; }
.section-heading h2 { margin: 0; font-size: 24px; line-height: 1.4; }
.section-heading p { color: var(--mzn-muted); margin: 4px 0 0; font-size: 14px; }
.text-link { font-weight: 800; font-size: 14px; white-space: nowrap; }
.grade-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.grade-card {
  display: flex;
  align-items: center;
  min-height: 83px;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--mzn-border);
  border-radius: 15px;
  color: var(--mzn-ink);
  background: #fff;
  box-shadow: 0 4px 16px rgba(26,68,97,.035);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.grade-card:hover { color: var(--mzn-primary); border-color: #acdafa; transform: translateY(-2px); box-shadow: var(--mzn-shadow); }
.grade-icon { flex: 0 0 43px; height: 43px; display: grid; place-items: center; background: #eaf7fe; color: var(--mzn-primary); border-radius: 13px; font-size: 20px; }
.grade-card strong { display: block; font-size: 14px; line-height: 1.55; }
.grade-card small { display: block; color: var(--mzn-muted); font-size: 11px; margin-top: 1px; }

.resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.resource-card { min-width: 0; background: #fff; border: 1px solid var(--mzn-border); border-radius: var(--mzn-radius); overflow: hidden; box-shadow: 0 6px 20px rgba(26,68,97,.04); }
.resource-card:hover { box-shadow: var(--mzn-shadow); }
.resource-cover { height: 158px; display: grid; place-items: center; overflow: hidden; background: linear-gradient(140deg, #e8f7ff, #f7fbfe); color: var(--mzn-primary); font-size: 43px; }
.resource-cover img { width: 100%; height: 100%; object-fit: cover; }
.resource-card-body { padding: 15px 17px 17px; }
.resource-type { display: inline-block; color: var(--mzn-primary); background: #edf8ff; border-radius: 20px; padding: 2px 10px; font-size: 11px; font-weight: 800; }
.resource-card h3 { margin: 9px 0 5px; font-size: 17px; line-height: 1.55; }
.resource-card h3 a { color: var(--mzn-ink); }
.resource-card h3 a:hover { color: var(--mzn-primary); }
.resource-meta { display: flex; flex-wrap: wrap; gap: 5px 12px; color: var(--mzn-muted); font-size: 12px; }
.resource-excerpt { color: #637788; font-size: 13px; margin: 8px 0 12px; }
.resource-card .button { min-height: 38px; padding: 7px 13px; font-size: 13px; }
.empty-state { padding: 30px 22px; text-align: center; border: 1px dashed #bfd7e5; background: #fbfdfe; border-radius: 16px; color: var(--mzn-muted); }
.empty-state strong { display: block; color: var(--mzn-ink); font-size: 18px; margin-bottom: 5px; }

.page-title { margin: 0 0 8px; font-size: clamp(25px, 3vw, 35px); line-height: 1.4; }
.page-lead { margin: 0 0 23px; color: var(--mzn-muted); }
.breadcrumb { color: #7c8e9a; font-size: 13px; margin: 0 0 13px; }
.breadcrumb a { color: var(--mzn-primary); }
.content-panel { background: #fff; border: 1px solid var(--mzn-border); border-radius: var(--mzn-radius); padding: clamp(19px, 4vw, 35px); box-shadow: 0 5px 18px rgba(26,68,97,.035); }
.archive-intro { padding: 25px; margin-bottom: 22px; border-radius: var(--mzn-radius); background: linear-gradient(115deg, #fff, #eff9fe); border: 1px solid #dceef8; }
.archive-intro h1 { margin: 0 0 5px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 9px; padding: 13px; margin: 18px 0; background: #fff; border: 1px solid var(--mzn-border); border-radius: 14px; }
.filter-bar input, .filter-bar select, .form-field input, .form-field select, .form-field textarea {
  min-height: 45px;
  width: 100%;
  padding: 9px 12px;
  color: var(--mzn-ink);
  border: 1px solid #dce6ed;
  border-radius: 10px;
  background: #fff;
}
.filter-bar input { flex: 1 1 240px; width: auto; }
.filter-bar select { flex: 0 1 210px; width: auto; }
.filter-bar .button { min-height: 44px; }
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.form-field .help { display: block; color: var(--mzn-muted); font-size: 12px; margin-top: 5px; }
.form-field textarea { min-height: 130px; resize: vertical; }
.notice { margin: 0 0 18px; padding: 12px 15px; border-radius: 11px; background: #ebf8ef; color: #1c7041; }
.notice-error { background: #fff0ee; color: #963c2f; }
.pagination { display: flex; justify-content: center; gap: 7px; margin-top: 25px; }
.pagination .page-numbers { min-width: 40px; padding: 7px 12px; text-align: center; border-radius: 9px; background: #fff; border: 1px solid var(--mzn-border); }
.pagination .current { color: #fff; background: var(--mzn-primary); }

.single-resource { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 25px; align-items: start; }
.single-main, .single-aside { min-width: 0; }
.single-main .content-panel { margin-bottom: 18px; }
.single-aside .content-panel { padding: 20px; }
.single-cover { width: 100%; max-height: 390px; object-fit: cover; border-radius: 14px; margin-bottom: 20px; }
.single-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 20px; }
.single-meta a, .meta-pill { background: #f0f7fb; padding: 4px 10px; border-radius: 20px; font-size: 12px; color: #587286; }
.download-panel { text-align: center; }
.download-panel h2 { font-size: 17px; margin: 0 0 8px; }
.download-panel .button { width: 100%; }
.download-note { color: var(--mzn-muted); font-size: 12px; margin: 11px 0 0; }
.page-content > *:first-child { margin-top: 0; }
.page-content > *:last-child { margin-bottom: 0; }

.site-footer { background: #15354d; color: #e5f1f8; padding: 36px 0 18px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 30px; }
.footer-brand { color: #fff; font-size: 22px; font-weight: 800; }
.footer-description { color: #bdd0dc; font-size: 13px; max-width: 450px; }
.footer-heading { color: #fff; margin: 0 0 11px; font-size: 15px; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin: 4px 0; }
.footer-links a { color: #bdd0dc; font-size: 13px; }
.footer-links a:hover { color: #fff; }
.copyright { margin-top: 28px; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.14); color: #a9bfcd; font-size: 12px; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.alignwide { max-width: 1080px; margin-inline: auto; }
.alignfull { max-width: none; margin-inline: calc(50% - 50vw); }
.wp-block-image img { border-radius: 12px; }
.wp-block-button__link { background: var(--mzn-primary); }

/* Single material pages follow the two-column library layout. */
.single-mzn_resource .announcement { display: none; }
.single-mzn_resource .site-main { background: #eef4fc; }
.single-mzn_resource .single-resource-page .container { width: min(1300px, calc(100% - 40px)); }
.single-mzn_resource .breadcrumb {
  display: block;
  padding: 9px 14px;
  margin: 0 0 14px;
  border: 1px solid #e5edf6;
  border-radius: 13px;
  background: rgba(255,255,255,.92);
  color: #65788d;
}
.single-mzn_resource .single-resource {
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
  gap: 16px;
}
.single-mzn_resource .single-main { order: 1; }
.single-mzn_resource .single-aside { order: 2; }
.resource-detail-card { padding: 24px 25px 20px; }
.resource-detail-card > .resource-type { display: table; margin: 0 0 8px auto; }
.resource-detail-card .page-title { text-align: center; font-size: clamp(24px, 2.5vw, 32px); margin: 0 0 8px; }
.single-description { color: #64758a; font-size: 14px; line-height: 1.8; text-align: center; margin: 0 auto 20px; max-width: 850px; }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.detail-tile {
  min-height: 78px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid #e8eef6;
  border-radius: 12px;
  background: #fff;
}
.detail-tile span, .count-tile span { color: #75869a; font-size: 11px; }
.detail-tile strong { color: #21354d; font-size: 13px; line-height: 1.55; }
.count-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 9px; }
.count-tile {
  min-height: 49px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid #e8eef6;
  border-radius: 11px;
  background: #f8fbff;
}
.count-tile strong { color: #334b67; font-size: 13px; }
.resource-actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 14px 0 9px; }
.resource-actions .button { min-height: 39px; padding: 7px 13px; border-radius: 10px; font-size: 12px; }
.button-light { color: #344e6b; background: #fff; border: 1px solid #e1e9f1; }
.button-light:hover { color: var(--mzn-primary); background: #f5f9fe; }
.button-disabled { color: #718096; background: #e8eef5; cursor: not-allowed; }
.share-row { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; color: #687b91; font-size: 11px; }
.share-row strong { font-weight: 700; }
.share-row a { padding: 3px 9px; border: 1px solid #e5ebf2; border-radius: 18px; color: #62758b; background: #fff; }
.share-row a:hover { color: var(--mzn-primary); border-color: #bfd8f8; }
.rating-box { margin-top: 15px; padding: 13px 15px; border: 1px solid #e6edf4; border-radius: 12px; background: #fbfdff; text-align: center; }
.rating-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: right; }
.rating-heading strong { font-size: 13px; }
.rating-heading span { color: #74859a; font-size: 11px; }
.rating-form { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 9px; }
.rating-stars { direction: ltr; display: inline-flex; gap: 4px; }
.rating-stars input { position: absolute; opacity: 0; pointer-events: none; }
.rating-stars label { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #e3eaf2; border-radius: 8px; background: #fff; color: #c0cad6; font-size: 19px; cursor: pointer; }
.rating-stars label:hover, .rating-stars input:checked + label { color: #f4aa27; border-color: #f2dba7; background: #fffaf0; }
.rating-stars input:focus-visible + label { outline: 2px solid var(--mzn-primary); outline-offset: 2px; }
.rating-submit { border: 0; padding: 6px 11px; border-radius: 8px; background: #eef4fc; color: #456078; font-size: 11px; cursor: pointer; }
.rating-thanks { margin: 8px 0 0; color: #5b7690; font-size: 12px; }
.resource-body { margin-top: 14px; }
.resource-body h2 { margin: 0 0 13px; font-size: 19px; }
.cover-card { overflow: hidden; border: 1px solid #e7edf4; border-radius: 17px; background: #fff; box-shadow: var(--mzn-shadow); }
.single-mzn_resource .single-cover { display: block; width: 100%; height: auto; max-height: none; aspect-ratio: .72; object-fit: cover; margin: 0; border-radius: 0; }
.cover-placeholder { display: grid; place-items: center; aspect-ratio: .72; background: linear-gradient(150deg, #f6faff, #eaf2fc); color: var(--mzn-primary); font-size: 64px; }
.side-ad { min-height: 330px; margin-top: 12px; padding: 9px; border: 1px solid #e5edf5; border-radius: 15px; background: rgba(255,255,255,.72); text-align: center; }
.side-ad .ad-label { margin-bottom: 6px; }
.side-ad .ad-content { display: flex; justify-content: center; align-items: center; overflow: hidden; }
.side-ad .ad-content:empty { min-height: 290px; }

@media (max-width: 920px) {
  .grade-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .primary-nav { display: none; position: absolute; top: 100%; inset-inline: 0; padding: 10px 18px 16px; background: #fff; border-bottom: 1px solid var(--mzn-border); box-shadow: 0 12px 18px rgba(20,55,80,.08); }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { display: grid; grid-template-columns: repeat(2, 1fr); }
  .primary-nav a { display: block; }
  .menu-toggle { display: inline-flex; }
}
@media (max-width: 680px) {
  .container { width: min(100% - 24px, 1160px); }
  .header-row { min-height: 70px; gap: 9px; }
  .grade-strip-inner { min-height: 39px; width: calc(100% - 24px); }
  .brand-mark { width: 46px; height: 46px; }
  .brand-name { font-size: 20px; }
  .brand-tagline { font-size: 10px; }
  .header-actions { gap: 3px; }
  .header-actions .button { display: none; }
  .hero { padding: 28px 20px; border-radius: 20px; }
  .hero p { font-size: 15px; }
  .hero-search { flex-wrap: wrap; }
  .hero-search input[type="search"] { flex-basis: 100%; min-height: 40px; }
  .hero-search .button { width: 100%; }
  .stats-row { gap: 14px 20px; }
  .stat { display: block; }
  .stat strong { display: block; font-size: 20px; line-height: 1.3; }
  .stat span { font-size: 11px; }
  .grade-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .grade-card { padding: 11px; gap: 8px; min-height: 73px; }
  .grade-icon { flex-basis: 36px; height: 36px; font-size: 17px; }
  .grade-card strong { font-size: 12px; }
  .resource-grid { grid-template-columns: 1fr; }
  .resource-cover { height: 175px; }
  .single-resource { grid-template-columns: 1fr; }
  .single-mzn_resource .single-resource-page .container { width: min(100% - 24px, 1300px); }
  .single-mzn_resource .single-resource { grid-template-columns: 1fr; gap: 13px; }
  .single-mzn_resource .single-aside { order: 1; }
  .single-mzn_resource .single-main { order: 2; }
  .single-mzn_resource .cover-card { max-width: 340px; margin-inline: auto; }
  .single-mzn_resource .single-cover, .single-mzn_resource .cover-placeholder { aspect-ratio: .78; }
  .single-mzn_resource .side-ad { min-height: 170px; }
  .single-mzn_resource .side-ad .ad-content:empty { min-height: 130px; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resource-detail-card { padding: 18px 15px; }
  .rating-heading { display: block; text-align: center; }
  .rating-heading span { display: block; margin-top: 3px; }
  .rating-form { flex-wrap: wrap; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 22px; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
  .section-heading h2 { font-size: 21px; }
  .section { margin-top: 32px; }
}
@media (max-width: 390px) {
  .grade-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-grid > :first-child { grid-column: auto; }
}