/*
Theme Name: Derasatek KFCRIS-Style
Theme URI: https://alpha.derasatek.com/
Author: Derasatek
Author URI: https://alpha.derasatek.com/
Description: قالب مؤسسي تركوازي لموسوعة دراساتك للرسائل الجامعية، مستلهم في روحه ونظامه من المواقع المؤسسية (ترويسة بصفّين، قائمة داكنة منسدلة، سلايدر رئيسي، عناوين أقسام متمركزة، تذييل بأربعة أعمدة). لا ينسخ شعاراً ولا صوراً ولا محتوى من أي موقع آخر. يدعم نوع المحتوى drs_thesis وتصنيف drs_subject، والعربية RTL.
Version: 1.0.1
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: derasatek-kfcris-style
Tags: rtl, academic, education, thesis, library, responsive, custom-menu, featured-images
*/

/* ============================================================
   Derasatek KFCRIS-Style — نظام تركوازي مؤسسي
   لوحة kfcris: ترويسة #0F6B6E، قائمة #0A4A4E، أزرار #17807F،
   شريط عناوين #E9EFF0، حبر #1E2A2C، ثانوي #6B7A7D.
   حاوية 1170px، خط Tajawal، عناوين H2 متمركزة بخط تركوازي.
   ============================================================ */
:root {
  --brand: #0F6B6E;
  --brand-dark: #0A4A4E;
  --brand-btn: #17807F;
  --brand-light: #E9EFF0;
  --ink: #1E2A2C;
  --muted: #6B7A7D;
  --line: #E6ECEC;
  --white: #FFFFFF;
  --pink: #D6336C;
  --radius: 10px;
  --container: 1170px;
  --font: "Tajawal", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-serif: "Amiri", "Noto Naskh Arabic", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #fff;
  font-size: 16px;
  line-height: 1.7;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}
[dir="ltr"] body { direction: ltr; }
img { display: block; max-width: 100%; height: auto; }
a { text-decoration: none; color: inherit; }
a:hover { color: var(--brand-btn); }
h1, h2, h3, h4 { line-height: 1.5; margin: 0 0 16px; color: var(--ink); font-weight: 800; }
h1 { font-size: 32px; }
h2 { font-size: 28px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }
p { margin: 0 0 16px; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 15px; }
.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;
}

/* ---------- الأزرار ---------- */
.btn {
  display: inline-block; background: var(--brand-btn); color: #fff;
  padding: 10px 28px; border-radius: 999px; font-weight: 700; font-size: 15px;
  border: 0; cursor: pointer; font-family: var(--font); text-align: center;
}
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn-outline { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-outline:hover { background: var(--brand); color: #fff; }

/* ---------- الأقسام ---------- */
.section { padding: 48px 0; }
.section-head { text-align: center; margin-bottom: 28px; }
.section-head h2 { font-size: 28px; font-weight: 800; margin-bottom: 0; }
.section-head h2:after {
  content: ""; display: block; width: 60px; height: 3px;
  background: var(--brand-btn); margin: 12px auto 0;
}
.section-head .more { display: inline-block; margin-top: 12px; color: var(--brand-btn); font-weight: 700; font-size: 15px; }
.more-wrap { text-align: center; margin-top: 26px; }

/* ---------- الترويسة: الصف العلوي التركوازي ---------- */
.topbar { background: var(--brand); color: #fff; padding: 14px 0; }
.topbar .container { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 12px; color: #fff; }
.logo:hover { color: #fff; }
.logo-mark {
  width: 64px; height: 64px; border-radius: 50%; background: #fff; color: var(--brand);
  display: grid; place-items: center; font-weight: 900; font-size: 26px; flex: none;
  font-family: var(--font-serif);
}
.logo-mark img { width: 64px; height: 64px; border-radius: 50%; object-fit: contain; }
.logo-text b { display: block; font-family: var(--font-serif); font-size: 22px; line-height: 1.3; }
.logo-text span { font-size: 12px; opacity: .85; letter-spacing: 1px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top-search { display: flex; gap: 0; }
.top-search input[type="search"] {
  border: 0; padding: 9px 14px; border-radius: 0 999px 999px 0;
  font-family: var(--font); font-size: 14px; min-width: 200px; background: #fff; color: var(--ink);
}
.top-search button {
  border: 0; background: var(--brand-dark); color: #fff; padding: 9px 18px;
  border-radius: 999px 0 0 999px; cursor: pointer; font-family: var(--font); font-weight: 700; font-size: 14px;
}
.header-cart {
  display: inline-flex; align-items: center; gap: 6px; color: #fff; font-weight: 700;
  font-size: 14px; background: rgba(255, 255, 255, .18); border-radius: 999px; padding: 7px 16px;
}
.header-cart:hover { color: #fff; background: rgba(255, 255, 255, .28); }
.cart-count {
  background: #fff; color: var(--brand); border-radius: 999px; min-width: 22px;
  height: 22px; display: inline-grid; place-items: center; font-size: 13px; font-weight: 800; padding: 0 5px;
}

/* ---------- القائمة: الصف السفلي الداكن ---------- */
.navbar { background: var(--brand-dark); color: #fff; position: sticky; top: 0; z-index: 50; }
.navbar .container { display: flex; justify-content: center; }
.navbar ul { list-style: none; display: flex; justify-content: center; flex-wrap: wrap; }
.navbar ul ul { display: none; }
.navbar #primary-menu > ul > li { position: relative; }
.navbar a { display: block; padding: 15px 16px; font-weight: 700; font-size: 15px; white-space: nowrap; color: #fff; }
.navbar a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.menu-item-has-children > a:after, .has-sub > a:after { content: " ▼"; font-size: 10px; }
.sub-menu, .sub {
  position: absolute; top: 100%; right: 0; background: #fff; color: var(--ink);
  min-width: 260px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  border-radius: 0 0 8px 8px; display: none; z-index: 60; flex-direction: column;
}
.sub-menu li, .sub li { position: relative; }
.sub-menu a, .sub a { padding: 11px 16px; font-weight: 500; border-bottom: 1px solid #eef2f2; color: var(--ink); }
.sub-menu a:hover, .sub a:hover { background: var(--brand-light); color: var(--brand); }
.menu-item-has-children:hover > .sub-menu, .has-sub:hover > .sub { display: flex; }
.sub-menu .sub-menu, .sub .sub { top: 0; right: 100%; border-radius: 8px; }
.hamburger { display: none; background: none; border: 0; color: #fff; font-size: 26px; padding: 10px 15px; cursor: pointer; }

/* ---------- شريط عنوان الصفحات الداخلية ---------- */
.page-title { background: var(--brand-light); padding: 28px 0; }
.page-title h1, .page-title h2 { font-size: 24px; font-weight: 800; margin: 0; }
.page-title p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }

/* ---------- السلايدر الرئيسي ---------- */
.hero { padding: 22px 0 8px; }
.slider { position: relative; height: 420px; border-radius: 12px; overflow: hidden; background: var(--brand-dark); }
.slide {
  position: absolute; inset: 0; opacity: 0; transition: opacity .7s;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  display: flex; align-items: flex-end;
}
.slide.active { opacity: 1; }
.slide:after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, .55), transparent 55%);
}
.slide-content { position: absolute; right: 28px; left: 28px; bottom: 28px; z-index: 2; color: #fff; }
.slide-content .badge { margin-bottom: 10px; }
.slide-content h2 { font-size: 28px; line-height: 1.5; max-width: 820px; color: #fff; margin: 0; text-align: right; }
.slide-content h2:after { display: none; }
.slide-content h2 a { color: #fff; }
.slide-content h2 a span { background: rgba(15, 107, 110, .85); padding: 2px 10px; border-radius: 6px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.slide-content h2 a:hover { color: #fff; }
.slide-content p { opacity: .92; margin: 8px 0 0; }
.slide-content p a { color: #fff; font-weight: 700; }
.arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  background: rgba(0, 0, 0, .45); color: #fff; border: 0; width: 44px; height: 44px;
  border-radius: 50%; font-size: 20px; cursor: pointer; font-family: var(--font);
}
.arrow.prev { left: 14px; }
.arrow.next { right: 14px; }
.dots { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 3; display: flex; gap: 7px; }
.dots button { width: 10px; height: 10px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .55); cursor: pointer; padding: 0; }
.dots button.active { background: #fff; width: 26px; border-radius: 999px; }

/* ---------- شبكة الرسائل ---------- */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.thesis-card {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: #fff; display: flex; flex-direction: column; padding: 20px; min-height: 220px;
}
.thesis-card:hover { border-color: var(--brand-btn); }
.thesis-date { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.date-box { background: var(--brand); color: #fff; border-radius: 8px; text-align: center; padding: 8px 12px; flex: none; line-height: 1.2; }
.date-box .date-day { display: block; font-size: 20px; font-weight: 800; }
.date-box .date-month { display: block; font-size: 12px; }
.thesis-card h3 { font-size: 19px; margin: 0 0 8px; line-height: 1.6; }
.thesis-card h3 a { color: var(--ink); }
.thesis-card h3 a:hover { color: var(--brand-btn); }
.thesis-meta { font-size: 14px; color: var(--muted); margin: 0 0 14px; }
.thesis-meta a { color: var(--brand-btn); font-weight: 700; }
.thesis-card .card-foot {
  margin-top: auto; display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--line);
}
.badge {
  display: inline-block; font-size: 13px; font-weight: 700; padding: 4px 14px;
  border-radius: 999px; background: var(--brand-btn); color: #fff;
}
.badge.no-fulltext { background: #fff; color: var(--muted); border: 1px solid var(--muted); }

/* ---------- شارة وسطر المؤلف داخل السلايدر: تباين مضمون ----------
 * الشارة «بدون نص كامل» داخل السلايدر تأتي من حقن المقطع 8 بعد رابط
 * العنوان، والقاعدة العامة .badge.no-fulltext (خلفية بيضاء ونص رمادي)
 * لا تكفي وحدها على خلفية السلايدر التركوازية الداكنة، فتُفرض هنا
 * خلفية داكنة شفافة ونص أبيض: الأبيض على التركوازي الداكن #0A4A4E
 * تباينه ≈ 6.2:1، ومع تعتيم الأسود يرتفع أكثر — فوق حد 4.5:1.
 * القواعد تغطي أي صنف شارة يحقنه المقطع، لا صنفاً واحداً فقط، وتأتي
 * بعد قواعد .badge العامة حتى تتغلب عليها عند تساوي التخصيص.
 * سطر المؤلف/الجامعة يُفرض لونه أبيض شبه شفاف صراحةً بدل الاعتماد
 * على الوراثة وحدها. */
.slide-content .badge,
.slide-content .badge.no-fulltext,
.slide-content [class*="badge"],
.slide-content [class*="fulltext"] {
  background: rgba(0, 0, 0, .45);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .65);
}
.slide-content p { color: rgba(255, 255, 255, .95); opacity: 1; }

/* ---------- قائمة ببليوغرافية (نتائج البحث) ---------- */
.thesis-list { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.thesis-list li { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.thesis-list li:last-child { border-bottom: 0; }
.thesis-list h3 { font-size: 19px; margin: 0 0 6px; }
.thesis-list h3 a { color: var(--ink); }
.thesis-list h3 a:hover { color: var(--brand-btn); }
.thesis-list .thesis-meta { margin: 0; }

/* ---------- الفلاتر ---------- */
.filters { background: #fff; border: 1px solid var(--line); padding: 18px; border-radius: var(--radius); margin-bottom: 24px; }
.filters form { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; }
.filters label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.filters input, .filters select, .filters textarea {
  padding: 9px 12px; font-family: var(--font); font-size: 15px;
  border: 1px solid #cfd8d8; border-radius: 8px; background: #fff; min-width: 160px; color: var(--ink);
}
.results-count { font-size: 15px; font-weight: 700; color: var(--brand); }

/* ---------- الرحلة والخدمات ---------- */
.journey { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.journey-step { border-top: 3px solid var(--brand-btn); padding-top: 16px; }
.journey-step .step-num { font-size: 28px; font-weight: 800; color: var(--brand-btn); line-height: 1.2; display: block; }
.journey-step h3 { font-size: 18px; margin: 8px 0; }
.services-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.service-card { background: #fff; border: 1px solid var(--line); padding: 22px; border-radius: var(--radius); text-align: center; }
.service-card h3 { font-size: 18px; }
.service-card p { color: #445052; font-size: 15px; margin: 0; }

/* ---------- جدول ببليوغرافي ---------- */
.meta-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); margin-bottom: 24px; border-radius: var(--radius); }
.meta-table th, .meta-table td { text-align: right; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.meta-table th { width: 180px; background: var(--brand-light); font-size: 14px; }
.meta-table tr:last-child th, .meta-table tr:last-child td { border-bottom: 0; }
.citation-tabs { display: flex; gap: 8px; margin-bottom: 0; flex-wrap: wrap; }
.citation-tab {
  border: 1px solid var(--brand); background: #fff; color: var(--brand); border-radius: 999px;
  padding: 7px 20px; cursor: pointer; font-family: var(--font); font-weight: 700; font-size: 14px;
}
.citation-tab.is-active, .citation-tab:hover { background: var(--brand); color: #fff; }
.citation-box { background: #fff; border: 1px solid var(--line); border-right: 4px solid var(--brand-btn); padding: 16px 22px; margin-bottom: 24px; border-radius: 8px; }
.citation-box pre { white-space: pre-wrap; font-family: var(--font); font-size: 15px; margin: 0 0 14px; }
.export-links { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.export-links span { font-weight: 700; }

/* ---------- صفحة السلة ---------- */
.basket-page { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.basket-list { list-style: none; margin: 0 0 18px; padding: 0; }
.basket-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.basket-list li:last-child { border-bottom: 0; }
.basket-list a { color: var(--ink); font-weight: 700; }
.basket-list a:hover { color: var(--brand-btn); }
.basket-success { background: #e6f4ea; border: 1px solid #a3d9a5; color: #1e6b2e; padding: 12px 16px; border-radius: 8px; }
.basket-error { background: #fdecea; border: 1px solid #f5a9a0; color: #8f1d12; padding: 12px 16px; border-radius: 8px; }
.basket-form label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.basket-form input, .basket-form textarea {
  width: 100%; padding: 10px 12px; font-family: var(--font); font-size: 15px;
  border: 1px solid #cfd8d8; border-radius: 8px; margin-bottom: 14px; color: var(--ink);
}
.basket-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- ترقيم الصفحات ---------- */
.pagination { margin: 32px 0; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pagination a, .pagination span { padding: 8px 14px; border: 1px solid #cfd8d8; background: #fff; border-radius: 999px; color: var(--ink); }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- تنبيه السلة ---------- */
.cart-toast {
  position: fixed; bottom: 24px; right: 50%; transform: translateX(50%);
  background: var(--brand-dark); color: #fff; padding: 10px 22px; border-radius: 999px;
  font-weight: 700; z-index: 100; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}

/* ---------- التذييل ---------- */
.site-footer { background: var(--brand); color: #fff; margin-top: 20px; }
.site-footer .cols { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.2fr; gap: 30px; padding: 44px 0; }
.site-footer h3, .site-footer h4 { color: #fff; font-size: 18px; margin-bottom: 14px; }
.site-footer h3:after, .site-footer h4:after { display: none; }
.site-footer a { color: #fff; opacity: .92; }
.site-footer a:hover { color: #fff; opacity: 1; text-decoration: underline; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 8px; }
.site-footer p { opacity: .92; font-size: 15px; }
.news-box { display: flex; margin: 12px 0; }
.news-box input { flex: 1; border: 0; padding: 11px 14px; border-radius: 0 8px 8px 0; font-family: var(--font); min-width: 0; }
.news-box button { border: 0; background: var(--brand-dark); color: #fff; padding: 0 20px; border-radius: 8px 0 0 8px; cursor: pointer; font-weight: 700; font-family: var(--font); }
.footer-bottom { background: var(--brand-dark); text-align: center; padding: 14px; font-size: 14px; color: #fff; }

/* ---------- استجابة الجوال ---------- */
@media (max-width: 900px) {
  .grid3, .services-grid { grid-template-columns: 1fr 1fr; }
  .journey { grid-template-columns: 1fr 1fr; }
  .site-footer .cols { grid-template-columns: 1fr 1fr; }
  .slider { height: 380px; }
  .slide-content h2 { font-size: 22px; }
  .hamburger { display: block; }
  .navbar .container { justify-content: flex-start; flex-wrap: wrap; }
  .navbar #primary-menu > ul { display: none; flex-direction: column; width: 100%; }
  .navbar.open #primary-menu > ul { display: flex; }
  .navbar #primary-menu > ul > li { width: 100%; }
  .sub-menu, .sub { position: static; display: none; box-shadow: none; background: rgba(255, 255, 255, .08); border-radius: 0; }
  .sub-menu a, .sub a { color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .12); }
  .menu-item-has-children.open > .sub-menu, .has-sub.open > .sub { display: flex; }
}
@media (max-width: 560px) {
  .grid3, .services-grid, .journey { grid-template-columns: 1fr; }
  .site-footer .cols { grid-template-columns: 1fr; }
  .slider { height: 340px; }
  .slide-content { right: 16px; left: 16px; bottom: 16px; }
  .slide-content h2 { font-size: 19px; }
  .topbar .container { justify-content: center; text-align: center; }
  .top-search input[type="search"] { min-width: 140px; }
  .meta-table th { width: 120px; }
}

/* ---------- سلايدر الجوال (<= 600px): عنوان لا يتجاوز ولا يُقصّ ----------
 * كان عنوان الشريحة عند 19px وبحشوة جانبية 16px فقط يتجاوز عرض الشريحة
 * ويُقصّ عند الطرف ويتداخل مع الأسهم (44px). هنا: خط أصغر (17px)،
 * وحشوة جانبية 60px تتجاوز الأسهم المصغّرة (34px عند 8px من الطرف)،
 * والتفاف كلمات مفعّل ومنع للقص، ورفع المحتوى 34px عن الأسفل حتى لا
 * يتداخل سطر المؤلف مع النقاط. تأتي هذه القاعدة بعد قاعدتي 900px و560px
 * حتى تتغلب عليهما عند تساوي التخصيص.
 * عنوان طويل (~80 حرفاً عربياً) عند 360px: عرض المحتوى 360-30-120=210px،
 * أي ~24 حرفاً في السطر، فيلتف في ~4 أسطر (≈109px) + سطر المؤلف والشارة
 * (≈60px) = ~170px، أقل بكثير من ارتفاع السلايدر 360px. */
@media (max-width: 600px) {
  .slider { height: 360px; }
  .slide-content { right: 60px; left: 60px; bottom: 34px; }
  .slide-content h2 {
    font-size: 17px; line-height: 1.6; max-width: 100%;
    overflow-wrap: break-word; word-break: break-word;
  }
  .slide-content h2 a span { padding: 2px 6px; }
  .slide-content p { font-size: 13px; }
  .arrow { width: 34px; height: 34px; font-size: 16px; }
  .arrow.prev { left: 8px; }
  .arrow.next { right: 8px; }
}
