/* ==========================================================
   Averroes Academic Publishing - styleSheet.css (v3)
   ملاحظة: يجب أن تبقى كل قواعد @import في أعلى الملف
   ========================================================== */
@import url("https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&family=Noto+Kufi+Arabic:wght@400;500;700&display=swap");
@import url("https://cdn.jsdelivr.net/npm/bootstrap@3.4.1/dist/css/bootstrap.min.css");
@import url("https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css");

/* ---------- المتغيرات والخط العام ---------- */
:root {
  --text-color: #2d3943;
  --muted: #6f7d8b;
}

body {
  font-family: "Merriweather", Georgia, serif;
  background: #ffffff;
  color: var(--text-color);
  line-height: 1.4;
}

/* لا نستخدم * { font-family } لأنها تكسر أيقونات Font Awesome و Glyphicons */
.fa,
.fa:before { font-family: FontAwesome !important; }
.glyphicon { font-family: "Glyphicons Halflings" !important; }

/* منع التمرير الأفقي (clip لا يعطّل position:sticky، و hidden احتياط للمتصفحات القديمة) */
html, body {
  background-color: #ffffff;
  overflow-x: hidden;
  overflow-x: clip;
}

/* ==========================================================
   المجلات العربية: خط Noto Kufi Arabic
   يعمل على أي صفحة lang="ar" (أو ar-IQ ...) أو dir="rtl"
   ========================================================== */
:lang(ar),
html[dir="rtl"] body {
  font-family: "Noto Kufi Arabic", "Merriweather", Georgia, serif;
}

:lang(ar) code,
:lang(ar) pre,
:lang(ar) kbd,
:lang(ar) samp { font-family: Menlo, Consolas, monospace; }

/* الأرقام والقوائم في العربية تحتاج ارتفاع سطر أكبر */
:lang(ar) body,
html[dir="rtl"] body { line-height: 1.8; }

/* letter-spacing يقطع اتصال الحروف العربية فنلغيه */
:lang(ar) .article-abstract,
:lang(ar) .article-references-content,
:lang(ar) .categories {
  letter-spacing: 0;
  text-transform: none;
}

:lang(ar) .article-abstract { line-height: 1.8; }
:lang(ar) .article-references-content { line-height: 1.8; }

/* خط Noto Kufi أعرض من Merriweather فنصغّر خط القائمة قليلًا */
:lang(ar) .navbar-default .navbar-nav > li > a { font-size: 1.3rem; }

/* عكس الهوامش الجانبية في الاتجاه من اليمين لليسار */
html[dir="rtl"] .author strong { margin-right: 0; margin-left: 4px; }
html[dir="rtl"] .open-access-icon img { margin-left: 0; margin-right: 6px; }
html[dir="rtl"] .navbar-form .form-group { margin-right: 0; margin-left: 3px; }
html[dir="rtl"] .sidebar-section.info-menu { padding-right: 0; padding-left: 6px; }

/* ---------- الشريط العلوي (Navbar) ---------- */
header.navbar {
  position: relative;
  z-index: 1000;
}

.navbar-default {
  background-color: #144161;
  border-color: #333;
  border-radius: 0 !important;
}

.navbar-default .navbar-nav > li > a {
  color: #ffffff;
  font-weight: 600;
  padding: 12px 18px;
  transition: color .2s, background .2s;
  font-size: 1.45rem;
}

.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li.active > a {
  color: #768998;
  background-color: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

.navbar-default .navbar-nav > li.active > a { position: relative; }

.navbar-default .navbar-nav > li.active > a:after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  height: 3px;
  background: #ffffff;
}

.navbar-default .dropdown-menu {
  background-color: #2a2a2a;
  border: 1px solid #444;
}

.navbar-default .dropdown-menu > li > a { color: #fff; }
.navbar-default .dropdown-menu > li > a:hover { background-color: #333; }

/* منع التفاف عناصر القائمة في الشاشات المتوسطة (1024-1280) */
@media (min-width: 769px) and (max-width: 1280px) {
  .navbar-default .navbar-nav > li > a {
    padding: 12px 10px;
    font-size: 1.3rem;
  }
  :lang(ar) .navbar-default .navbar-nav > li > a { font-size: 1.2rem; }
}

/* ---------- حقل البحث (ارتفاع 40px) ---------- */
.navbar-form {
  margin-top: 6px;
  margin-bottom: 6px;
}

.navbar-form .form-control,
.navbar-form .btn {
  height: 28px !important;        /* غيّر الرقم كما تريد: 36 / 40 / 44 */
  padding: 0 17px !important;
  font-size: 14px;
}

.navbar-form .form-control {
  line-height: 28px;              /* يساوي الارتفاع ليتوسط النص عموديًا */
  border-radius: 20px;
}

.navbar-form .form-group,
.navbar-form .btn {
  display: inline-flex;
  vertical-align: middle;
  align-items: center;
  justify-content: center;
}

.navbar-form .form-group { margin-right: 3px; }

.navbar-form .btn {
  background-color: #144161;
  color: #ffffff;
  border: none;
  transition: all 0.3s ease;
}

.navbar-form .btn:hover { background: #ffffff; color: #333333; }
.navbar-form .btn:active { background: #0f2f47; }

.pull-md-right { white-space: nowrap; }

/* زر قائمة الجوال */
.mobile-menu-bar {
  display: none;
  background: #b30000;
  text-align: right;
  padding: 10px 15px;
}

.mobile-menu-bar .navbar-toggle {
  border: none;
  background: transparent;
}

.mobile-menu-bar .icon-bar { background-color: #659489; }

@media (max-width: 767px) {
  .mobile-menu-bar { display: block; }
}

/* ---------- الهايدر ---------- */
header .container,
header.navbar .container {
  width: 100%;
  max-width: 100%;
}

.header-image-wrapper,
.header-overlay,
.img-responsive { cursor: pointer; }

.social-icons-header {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 10px;
  z-index: 2000;
}

.social-icons-header .social-icon {
  width: 30px;
  height: 30px;
  max-width: 30px;
  max-height: 30px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.social-icons-header .social-icon:hover { transform: scale(1.1); }

@media (max-width: 767px) {
  .social-icons-header { display: none !important; }
}

/* ---------- Breadcrumbs ---------- */
.cmp_breadcrumbs,
.breadcrumb { background-color: #ffffff; }

/* ---------- صورتا الهايدر والفوتر (نفس القياس ونفس النسبة) ---------- */
.header-image-wrapper img,
header img.img-responsive,
.footer .footer-image img,
footer.footer img {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  margin: 0 !important;
}

/* ---------- الفوتر ----------
   ملاحظة: عرض الفوتر الكامل داخل صفحات المجلات يضبطه سكربت fitFooter()
   الموجود في الـ template (يحسب الإزاحة تلقائيًا). */
footer.footer,
.footer {
  position: relative !important;
  background-color: #ffffff;
  color: #222;
  width: 100% !important;
  max-width: 100% !important;
  margin: 2rem 0 0 !important;
  padding: 20px 0 !important;
  display: block !important;
}

.footer > *,
footer.footer .container,
footer.footer .footer-image {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

footer.footer a { color: #222; }
footer.footer a:hover { color: #768998; }

/* ---------- هيكل الصفحة ---------- */
.pkp_structure_page,
.pkp_site_name,
.pkp_navigation_primary_wrapper,
.pkp_structure_footer_wrapper {
  max-width: 100% !important;
  width: 100% !important;
}

/* على الشاشات العريضة جدًا: عرض أقصى للمحتوى في الوسط */
.pkp_structure_content {
  display: flex !important;
  gap: 5px;
  width: 100% !important;
  max-width: 1600px !important;
  margin: 0 auto !important;
}

.pkp_structure_main {
  width: 75% !important;
  min-width: 0;
  order: 2;
}

.pkp_structure_main .page { background-color: #ffffff; }

.pkp_structure_sidebar {
  width: 25% !important;
  order: 1;
}

@media (min-width: 769px) {
  .pkp_structure_content { flex-direction: row !important; }
}

.pkp_block.block_custom {
  width: 280px !important;
  max-width: 280px !important;
  flex: 0 0 280px !important;
}

#customblock-sid .content {
  width: 300px !important;
  max-width: 100%;
  margin: 0 auto;
}

.row {
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

@media (min-width: 992px) {
  .col-md-8 { width: 66.5%; }
}

/* ---------- القائمة الجانبية ---------- */
#sidebar {
  position: sticky;
  top: 20px;
  align-self: flex-start;
}

.sidebar-section.info-menu {
  position: sticky;
  top: 100px;
  align-self: flex-start;
  z-index: 5;
  background: none;
  border-radius: 6px;
  color: white;
  font-size: 1rem;
  margin-bottom: 1px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 6px;
}

.sidebar-section.info-menu .section-header {
  background: #b30000;
  border-bottom: 3px solid #f5f7fa;
  font-weight: bold;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.sidebar-section.info-menu .section-footer {
  background: #579934;
  padding: 5px 10px;
  border-bottom: 1.5px solid #f5f7fa;
  color: #ffffff;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.sidebar-section.info-menu .section-item {
  padding: 5px 10px;
  border-bottom: 2px solid #000;
  background: #ffffff;
  font-size: 1.4rem;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.sidebar-section.info-menu .section-item a {
  display: inline-block;
  color: #000;
  text-decoration: none;
  transition: color 0.3s ease, transform 0.3s ease;
}

.sidebar-section.info-menu .section-item a:hover { transform: scale(1.1); }
.sidebar-section.info-menu .section-item:last-child { border-bottom: 3px solid #000; }

@media (max-width: 991px) {
  .sidebar-section.info-menu {
    width: 100%;
    box-sizing: border-box;
  }
}

.sidebar-section.submit-box {
  background: none;
  overflow: hidden;
  margin-top: 0;
  margin-bottom: 2px !important;
}

.sidebar-section.submit-box .submit-header {
  background: none;
  padding: 8px 12px 30px;
  font-weight: 600;
  color: #000;
  text-align: center;
  font-size: 1.5rem;
  position: relative;
}

.sidebar-section.submit-box .submit-action {
  padding: 8px 12px;
  font-weight: bold;
  color: #fff;
  font-size: 1.5rem;
  text-align: center;
  background: #579934;
  margin-bottom: 15px !important;
}

.sidebar-section.submit-box .submit-link {
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  font-size: 1.5rem;
  display: inline-block;
  transition: transform 0.3s ease;
}

.sidebar-section.submit-box .submit-link:hover { transform: scale(1.1); }

/* ---------- شبكة المجلات (الصفحة الرئيسية) ---------- */
.journals-grid {
  display: grid;
  column-gap: 3rem;
  row-gap: 3rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  justify-items: stretch;
}

@media (min-width: 1200px) {
  .journals-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
}

/* فجوة تتناسب مع عرض الشاشة (من 20px إلى 60px) بدل 60px الثابتة.
   إذا كان في كل مجموعة بطاقة جانبية .tall-card.sticky-side فجرّب:
   grid-template-columns: 250px repeat(3, 1fr);  */
.journals-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 3vw, 60px);
}

/* مهم: المجموعة (group1..group4) يجب أن تمتد على كل أعمدة .journals-grid،
   وإلا تُحشر في عمود واحد فتتقلص الأغلفة (width:100%) كما في الصفحة الرئيسية */
.journals-grid > .journals-group,
.journals-grid > [id^="group"] {
  grid-column: 1 / -1;
  width: 100%;
}

.journal-card {
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  text-align: center;
  padding: 0;
  font-size: 1.5rem;
  font-weight: 500;
  text-decoration: none;
  color: #102e43;
  position: relative;
  gap: 0.25rem;
  margin-bottom: 24px;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

/* غلاف مرن: يتقلص مع العمود ولا يتجاوز 250px، بنفس نسبة 250x365 */
.journal-card img {
  display: block;
  width: 100%;
  max-width: 250px;
  height: auto;
  aspect-ratio: 250 / 365;
  object-fit: cover;
  border-radius: 0;
  margin: 0 auto 10px;
}

.journal-card a img {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.journal-card:hover a img { transform: scale(1.03); }

.image-wrapper {
  margin: 0 auto 0.75rem;
  width: 100%;
  max-width: 250px;
  transition: transform .25s ease;
  will-change: transform;
}

.journal-card:hover .image-wrapper,
.journal-card:focus .image-wrapper { transform: translateY(-8px); }

.info {
  padding: 0.25rem 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* كانت 0.65rem = 6.5px لأن Bootstrap 3 يضبط html على 10px */
.categories {
  font-size: 1.1rem;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.title-link {
  text-decoration: none;
  color: #102e43;
  font-size: 1.3rem;
  font-weight: 700;
  display: block;
  margin-top: 3px;
  margin-bottom: 2px;
  transition: transform 0.2s;
  text-align: center;
}

.title-link:hover {
  text-decoration: underline;
  transform: scale(1.05);
}

.journal-links {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 0;
}

.journal-links a {
  text-decoration: none;
  color: #102e43;
  font-weight: 500;
  font-size: 1.2rem;
}

.journal-links a:hover {
  color: #4f81d9;
  text-decoration: underline;
}

.sticky-side {
  position: sticky;
  top: 100px;
  align-self: flex-start;
  z-index: 5;
  background: none;
  border-radius: 6px;
  overflow: visible;
  color: white;
  font-size: 1rem;
  margin-bottom: 1px;
  grid-column: 1;
  grid-row: 1 / span 3;
}

.tall-card { grid-row: span 1; }

.tall-card img {
  width: 320px !important;
  max-width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto;
  object-fit: cover;
}

.pagination-buttons {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 20px auto;
  text-align: center;
}

.page-button.active {
  background-color: #144161;
  color: white;
}

/* ---------- الأرشفة والشعارات ---------- */
.journal-archiving {
  text-align: center;
  margin: 20px 0;
  color: #2d3943;
}

.journal-archiving h4 {
  font-size: 1.4em;
  margin-bottom: 10px;
  color: #2d3943;
}

.journal-archiving img {
  max-width: 180px;
  height: auto;
  margin: 10px 0;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.journal-archiving img:hover { transform: scale(1.05); }
.journal-archiving a { text-decoration: none; }

.journal-archiving.alert {
  background-color: transparent !important;
  border: none !important;
  color: #2d3943;
}

.journal-archiving-row {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 15px;
}

.journal-archiving-logo {
  max-width: 100px;
  height: 86.15px;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.journal-archiving-logo:hover { transform: scale(1.1); }

.Archiving {
  background-color: #fff;
  padding: 15px;
  border-radius: 6px;
}

.Archiving .journal-archiving-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  justify-items: center;
}

.logo-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.logo-box img:hover { transform: scale(1.08); }

/* ---------- صفحة المقال ---------- */
.article-main {
  max-width: 900px;
  margin: 0 auto;
}

.article-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.article-title-text,
.open-access-icon {
  display: inline-flex;
  align-items: center;
}

.article-title-text {
  font-size: 25px;
  font-weight: bold;
}

.open-access-icon img {
  height: 20px;
  margin-left: 6px;
}

.alert.alert-info { display: none !important; }

.article-details .panel.panel-default.issue,
.article-details .panel.panel-default.section { display: none !important; }

div.panel-body p { display: none; }

.cover-image img {
  width: 128px;
  height: 181px;
  object-fit: cover;
}

.cover {
  width: 119px;
  height: 168px;
  overflow: hidden;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sections .section h2 {
  font-size: 24px;
  font-weight: bold;
}

.obj_article_summary .title { font-size: 18px; }
.obj_article_summary .authors { font-size: 14px; }

.article-summary-keywords h2,
.article-references h2 {
  font-size: 18px;
  font-weight: bold;
}

.article-references h2 { margin-bottom: 10px; }

.author {
  font-size: 13px;
  line-height: 1.4;
}

.author strong {
  font-size: 13px;
  font-weight: 600;
  margin-right: 4px;
}

.pkp_structure_main p {
  text-align: justify;
  line-height: 1.8;
}

.article-references-content {
  font-size: 14px;
  text-align: justify;
  line-height: 1.4;
  letter-spacing: -0.2px;
}

.article-references-content p { margin: 0; }

.article-abstract {
  font-size: 18px;
  text-align: justify;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.article-abstract p { margin: 0 0 6px 0; }
.article-abstract p:last-child { margin-bottom: 0; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.panel-body .btn {
  font-size: 11px;
  padding: 2px 5px;
  line-height: 1.2;
  background-color: #ffffff;
  border: 1px solid #ccc;
  color: #333;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.panel-body .btn:hover {
  background-color: #f0f0f0;
  color: #000;
  border-color: #999;
  cursor: pointer;
}

.galleys_links .pdf,
a.galley-link.pdf {
  font-size: 12px;
  padding: 5px 10px;
  background-color: #e5252a;
  border: none;
  border-radius: 4px;
  color: #ffffff;
  display: inline-block;
  text-align: center;
  transition: all 0.2s ease;
}

.galleys_links .pdf:hover,
a.galley-link.pdf:hover {
  background-color: #ab1115;
  color: #ffffff;
  text-decoration: none;
  cursor: pointer;
}

ul.galleys_links {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

ul.galleys_links li {
  margin: 0;
  padding: 0;
}

.read-more {
  font-size: 12px;
  padding: 8px 10px;
  background-color: #144161;
  border: none;
  border-radius: 4px;
}

a.register-button {
  display: none !important;
  visibility: hidden !important;
}

/* ---------- إخفاء النص للقارئات الشاشية ---------- */
.pkp_screen_reader {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ==========================================================
   الجوال (كل قواعد max-width:768px مجمّعة هنا)
   ========================================================== */
@media (max-width: 768px) {
  .pkp_structure_content {
    flex-direction: column !important;
    max-width: 100% !important;
  }

  .pkp_structure_main,
  .pkp_structure_sidebar { width: 100% !important; }

  #sidebar,
  .sticky-side,
  .journal-card.tall-card.sticky-side { display: none !important; }

  .journals-grid {
    grid-template-columns: 1fr !important;
    row-gap: 1.5rem;
    column-gap: 0;
  }

  .journals-group {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .journal-card {
    width: 250px !important;
    margin: 0 auto;
  }

  .journal-card img {
    width: 100% !important;
    height: auto !important;
    object-fit: cover;
  }
}

body.pkp_page_article.pkp_op_view { margin: 0; height: 100vh; overflow: hidden; }
.pkp_page_article .header_view { height: 3rem; line-height: 3rem; }
.pkp_page_article .galley_view,
.pkp_page_article #pdfCanvasContainer {
  position: absolute; top: 3rem; left: 0; right: 0; bottom: 0;
}
.pkp_page_article .galley_view iframe,
.pkp_page_article #pdfCanvasContainer iframe {
  display: block; width: 100%; height: 100%; min-height: 500px; border: 0;
}
