/* =========================================================
   MAURITANIE MÉDICALE
   Health Sciences Theme — OJS 3.5 / Bootstrap 5
   Custom CSS v1.3 — RTL-safe Full-width Header
   ---------------------------------------------------------
   هوية بصرية:
   Primary Blue      #3F6F9F
   Dark Blue         #2E557E
   Deep Blue         #244767
   Cover Light Blue  #BDD9FD
   Gold              #FDBA08
   Dark Brown/Black  #1D1715
   ---------------------------------------------------------
   الأقسام التحريرية المعتمدة:
   ART = Articles originaux / المقالات الأصلية / Original Articles
   THE = Thèses et Mémoires / الأطروحات والمذكرات / Theses and Dissertations
   BC  = Communications brèves / مقالات موجزة / Brief Communications
   CAS = Cas cliniques / الحالات السريرية / Case Reports
   LET = Lettre à la rédaction / رسالة إلى هيئة التحرير / Letter to the Editor
   ========================================================= */

:root {
    --mm-primary: #3F6F9F;
    --mm-primary-dark: #2E557E;
    --mm-primary-deep: #244767;
    --mm-blue-light: #BDD9FD;
    --mm-blue-pale: #EEF6FF;
    --mm-gold: #FDBA08;
    --mm-gold-dark: #D99A00;
    --mm-gold-pale: #FFF5D2;
    --mm-dark: #1D1715;
    --mm-text: #252A30;
    --mm-muted: #66727E;
    --mm-white: #FFFFFF;
    --mm-bg: #F7FAFE;
    --mm-border: #D7E3F1;
    --mm-border-strong: #B9CCE2;
    --mm-shadow: 0 6px 20px rgba(36, 71, 103, .10);
}

/* =========================================================
   1. الأساس العام
   ========================================================= */

html,
body {
    background: var(--mm-bg);
}

body {
    color: var(--mm-text);
    font-family: "Fira Sans", Tahoma, "Segoe UI", Arial, sans-serif;
    line-height: 1.72;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--mm-primary-dark);
    transition: color .18s ease, background-color .18s ease, border-color .18s ease;
}

a:hover,
a:focus {
    color: var(--mm-primary-deep);
}

img {
    max-width: 100%;
    height: auto;
}

p,
li,
td,
th,
a,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: anywhere;
}

/* =========================================================
   2. الرأسية الرئيسية — Health Sciences
   ========================================================= */

.main-header {
    background: var(--mm-white);
    border-top: 7px solid var(--mm-gold);
    border-bottom: 1px solid var(--mm-border);
    box-shadow: 0 2px 10px rgba(36, 71, 103, .06);
}

.main-header > .container {
    max-width: 1380px;
}

/* شعار المجلة */
.navbar-logo {
    padding-top: 14px;
    padding-bottom: 10px;
    text-align: center;
}

.navbar-logo a,
.navbar-brand {
    text-decoration: none !important;
}

.navbar-logo img,
.navbar-brand img {
    display: block;
    width: auto;
    max-width: min(100%, 920px);
    max-height: 155px;
    margin: 0 auto;
    object-fit: contain;
}

.navbar-logo-text {
    color: var(--mm-primary-deep);
    font-size: clamp(25px, 3vw, 42px);
    font-weight: 800;
    letter-spacing: .01em;
}

/* =========================================================
   3. شريط التنقل الرئيسي
   ========================================================= */

.main-header .navbar {
    margin-top: 6px;
    padding: 0;
    background: var(--mm-primary-dark);
    border-top: 3px solid var(--mm-gold);
    border-radius: 0;
}

.main-header .navbar-collapse {
    min-height: 52px;
}

#primaryNav,
#primaryNav-userNav,
#userNav {
    margin: 0;
    padding: 0;
}

#primaryNav .nav-item,
#primaryNav-userNav .nav-item,
#userNav .nav-item {
    margin: 0;
}

#primaryNav .nav-item > a,
#primaryNav-userNav .nav-item > a,
#userNav .nav-item > a,
.main-header .navbar .nav-link {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 13px 15px;
    color: var(--mm-white) !important;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    text-decoration: none;
}

#primaryNav .nav-item > a:hover,
#primaryNav .nav-item > a:focus,
#primaryNav-userNav .nav-item > a:hover,
#primaryNav-userNav .nav-item > a:focus,
#userNav .nav-item > a:hover,
#userNav .nav-item > a:focus,
.main-header .navbar .nav-link:hover,
.main-header .navbar .nav-link:focus {
    background: var(--mm-gold);
    color: var(--mm-dark) !important;
}

/* القوائم المنسدلة */
#primaryNav li,
#primaryNav-userNav li {
    position: relative;
}

#primaryNav li > ul,
#primaryNav-userNav li > ul {
    min-width: 245px;
    padding: 6px 0;
    background: var(--mm-white);
    border: 1px solid var(--mm-border);
    border-top: 4px solid var(--mm-gold);
    border-radius: 0 0 5px 5px;
    box-shadow: var(--mm-shadow);
}

#primaryNav li > ul li > a,
#primaryNav-userNav li > ul li > a {
    display: block;
    padding: 10px 14px;
    color: var(--mm-primary-deep) !important;
    background: var(--mm-white);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.45;
    text-decoration: none;
}

#primaryNav li > ul li > a:hover,
#primaryNav li > ul li > a:focus,
#primaryNav-userNav li > ul li > a:hover,
#primaryNav-userNav li > ul li > a:focus {
    background: var(--mm-gold-pale);
    color: var(--mm-dark) !important;
}

/* زر الهاتف */
.main-header .navbar-toggler {
    margin: 7px 10px;
    border: 1px solid rgba(255,255,255,.75);
    background: transparent;
}

.main-header .navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(253,186,8,.35);
}

/* =========================================================
   4. قائمة المستخدم واللغة
   ========================================================= */

#userNav {
    display: flex;
    justify-content: flex-end;
    gap: 3px;
    margin-top: 7px;
}

#userNav .nav-item > a {
    min-height: 36px;
    padding: 7px 11px;
    border-radius: 4px;
    background: var(--mm-dark);
    font-size: 12px;
}

#userNav .nav-item > a:hover,
#userNav .nav-item > a:focus {
    background: var(--mm-gold);
    color: var(--mm-dark) !important;
}

#languageLargeNav,
#languageSmallNav {
    font-size: 13px;
}

/* =========================================================
   5. الصفحة الرئيسية والصورة البارزة
   ========================================================= */

.homepage-image {
    position: relative;
    overflow: hidden;
    max-height: 510px;
    background: var(--mm-primary-deep);
}

.homepage-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(29,23,21,.05), rgba(36,71,103,.34));
    pointer-events: none;
}

.homepage-image img {
    display: block;
    width: 100%;
    max-height: 510px;
    object-fit: cover;
    object-position: center;
    filter: saturate(.88) contrast(.96);
}

.container-homepage-issue {
    max-width: 1280px;
}

.homepage-issue-current {
    margin-top: 28px;
    color: var(--mm-primary-dark);
    font-weight: 800;
    text-transform: none;
}

.homepage-issue-identifier {
    color: var(--mm-dark);
    font-weight: 800;
}

.homepage-issue-published {
    color: var(--mm-muted);
}

.homepage-issue-cover {
    border: 1px solid var(--mm-border);
    box-shadow: var(--mm-shadow);
}

.homepage-issue-description-wrapper,
.homepage-journal-description,
.homepage-additional-content {
    color: var(--mm-text);
}

.homepage-issue-description .h2,
.homepage-issue-galleys .h3 {
    color: var(--mm-primary-deep);
}

/* الإعلانات */
.homepage-announcement {
    padding-top: 18px;
    padding-bottom: 18px;
}

.homepage-announcement-title {
    color: var(--mm-primary-deep);
    font-weight: 750;
}

.homepage-announcement-date {
    color: var(--mm-muted);
}

/* =========================================================
   6. الأزرار العامة وملفات PDF
   ========================================================= */

.btn,
a.btn,
button.btn {
    border-radius: 5px;
    font-weight: 700;
}

.btn-primary,
a.btn-primary,
button.btn-primary,
.cmp_button,
.obj_galley_link,
a.obj_galley_link,
.article-details-galley a {
    background: var(--mm-primary-dark) !important;
    border-color: var(--mm-primary-deep) !important;
    color: var(--mm-white) !important;
}

.btn-primary:hover,
.btn-primary:focus,
a.btn-primary:hover,
a.btn-primary:focus,
.cmp_button:hover,
.cmp_button:focus,
.obj_galley_link:hover,
.obj_galley_link:focus,
.article-details-galley a:hover,
.article-details-galley a:focus {
    background: var(--mm-gold) !important;
    border-color: var(--mm-gold-dark) !important;
    color: var(--mm-dark) !important;
}

/* =========================================================
   7. فهرس العدد والأقسام التحريرية
   ========================================================= */

.issue-wrapper {
    margin-top: 22px;
}

.sections .section,
.issue-toc-section,
.obj_issue_toc .section {
    margin-bottom: 34px;
}

/* عنوان كل قسم داخل العدد */
.sections .section > h2,
.sections .section > h3,
.sections .section > h4,
.issue-toc-section-title,
.obj_issue_toc .section > h2,
.obj_issue_toc .section > h3,
.obj_issue_toc .section > h4 {
    margin: 0 0 18px;
    padding: 10px 14px;
    color: var(--mm-primary-deep);
    background: linear-gradient(90deg, var(--mm-blue-pale), var(--mm-white));
    border-inline-start: 5px solid var(--mm-gold);
    border-bottom: 1px solid var(--mm-border);
    font-weight: 800;
    line-height: 1.4;
}

/* قائمة المقالات */
.cmp_article_list,
.articles {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cmp_article_list > li,
.articles > li {
    margin-bottom: 12px;
    padding: 17px 18px;
    background: var(--mm-white);
    border: 1px solid var(--mm-border);
    border-radius: 6px;
    transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}

.cmp_article_list > li:hover,
.articles > li:hover {
    border-color: var(--mm-border-strong);
    box-shadow: var(--mm-shadow);
    transform: translateY(-1px);
}

.obj_article_summary .title,
.obj_article_summary .title a,
.article-summary-title,
.article-summary-title a {
    color: var(--mm-primary-deep) !important;
    font-weight: 750;
    line-height: 1.55;
}

.obj_article_summary .authors,
.article-summary-authors {
    color: var(--mm-muted);
}

.obj_article_summary .pages,
.obj_article_summary .published {
    color: var(--mm-muted);
}

/* DOI في فهرس العدد */
.obj_article_summary .doi a,
.article-summary-doi a {
    color: var(--mm-primary-dark);
    font-size: .92em;
}

/* =========================================================
   8. شارات الأقسام الاختيارية
   تستخدم إذا أضيفت داخل محتوى مخصص
   ========================================================= */

.mm-section-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 9px;
    color: var(--mm-primary-deep);
    background: var(--mm-gold-pale);
    border: 1px solid #F0D47B;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
}

.mm-section-badge strong {
    min-width: 34px;
    padding-inline-end: 7px;
    border-inline-end: 1px solid rgba(36,71,103,.25);
    color: var(--mm-dark);
}

/* =========================================================
   9. صفحة مستقلة للأقسام — mm-sections-grid
   ========================================================= */

.mm-sections-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 24px 0;
}

.mm-section-card {
    padding: 18px;
    background: var(--mm-white);
    border: 1px solid var(--mm-border);
    border-top: 4px solid var(--mm-gold);
    border-radius: 7px;
    box-shadow: 0 3px 12px rgba(36,71,103,.06);
}

.mm-section-card-code {
    display: inline-block;
    min-width: 46px;
    margin-bottom: 8px;
    padding: 5px 8px;
    background: var(--mm-primary-dark);
    color: var(--mm-white);
    border-radius: 4px;
    font-weight: 800;
    text-align: center;
}

.mm-section-card h2,
.mm-section-card h3 {
    margin: 4px 0 6px;
    color: var(--mm-primary-deep);
    font-size: 18px;
    font-weight: 800;
}

.mm-section-card p {
    margin: 3px 0;
    color: var(--mm-muted);
    font-size: 14px;
}

/* =========================================================
   10. صفحة المقال — Health Sciences selectors
   ========================================================= */

.article-details {
    color: var(--mm-text);
}

.article-details .page-header {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--mm-border);
}

.article-details-fulltitle {
    color: var(--mm-dark);
    font-weight: 800;
    line-height: 1.35;
}

.article-details-issue-identifier a {
    color: var(--mm-primary-dark);
    font-weight: 700;
}

.article-details-issue-section {
    display: inline-block;
    margin-top: 8px;
    padding: 5px 9px;
    color: var(--mm-primary-deep);
    background: var(--mm-gold-pale);
    border-inline-start: 4px solid var(--mm-gold);
    font-weight: 750;
}

.article-details-doi a {
    color: var(--mm-primary-dark);
    font-weight: 650;
}

.article-details-published {
    color: var(--mm-muted);
}

.authors-string {
    color: var(--mm-text);
}

.authors-string a {
    color: var(--mm-primary-dark);
    font-weight: 700;
}

/* الكتلة الجانبية للمقال */
.article-details-sidebar {
    padding: 18px;
    background: var(--mm-blue-pale);
    border: 1px solid var(--mm-border);
    border-radius: 7px;
}

.article-details-block {
    margin-bottom: 26px;
}

.article-details-heading {
    margin-bottom: 12px;
    padding-bottom: 7px;
    color: var(--mm-primary-deep);
    border-bottom: 2px solid var(--mm-gold);
    font-weight: 800;
}

.article-details-cover img {
    border: 1px solid var(--mm-border-strong);
    box-shadow: var(--mm-shadow);
}

.article-details-keywords-value span {
    color: var(--mm-text);
}

.article-details-author {
    border-color: var(--mm-border) !important;
}

.article-details-author-affiliation {
    color: var(--mm-muted);
}

.article-details-bio-toggle {
    color: var(--mm-primary-dark);
}

/* الملخص والمراجع */
.article-details-abstract,
.article-details-references,
.article-details-license {
    line-height: 1.8;
}

.article-details-abstract p,
.article-details-references p,
.article-details-license p {
    text-align: justify;
    text-justify: inter-word;
}

/* =========================================================
   11. صفحات عامة، العناوين، البحث، النماذج
   ========================================================= */

.page-content h1,
.page-content h2,
.page-content h3,
.page h1,
.page h2,
.page h3 {
    color: var(--mm-primary-deep);
}

.page-content h1,
.page h1 {
    font-weight: 800;
}

.page-content p,
.page p,
.additional_content p {
    line-height: 1.82;
}

.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
    border-color: var(--mm-border-strong);
    border-radius: 5px;
}

.form-control:focus,
.form-select:focus,
input:focus,
textarea:focus,
select:focus {
    border-color: var(--mm-primary);
    box-shadow: 0 0 0 3px rgba(63,111,159,.12);
}

/* =========================================================
   12. الأرشيف وأغلفة الأعداد
   ========================================================= */

.page_issue_archive .issue-summary,
.issue-summary,
.obj_issue_summary {
    padding: 16px;
    background: var(--mm-white);
    border: 1px solid var(--mm-border);
    border-radius: 6px;
}

.page_issue_archive img,
.issue-summary img,
.obj_issue_summary img {
    border: 1px solid var(--mm-border);
    box-shadow: 0 4px 14px rgba(36,71,103,.10);
}

/* =========================================================
   13. التذييل
   Health Sciences يضع Custom Blocks في التذييل
   ========================================================= */

footer,
.main-footer,
.pkp_structure_footer_wrapper,
.pkp_structure_footer {
    background: var(--mm-dark) !important;
    color: var(--mm-white) !important;
    border-top: 5px solid var(--mm-gold);
}

footer a,
.main-footer a,
.pkp_structure_footer_wrapper a,
.pkp_structure_footer a {
    color: var(--mm-gold) !important;
}

footer a:hover,
footer a:focus,
.main-footer a:hover,
.main-footer a:focus,
.pkp_structure_footer_wrapper a:hover,
.pkp_structure_footer_wrapper a:focus {
    color: var(--mm-white) !important;
}

footer .container,
.main-footer .container,
.pkp_structure_footer {
    max-width: 1280px;
}

.pkp_footer_content,
.footer-content {
    line-height: 1.7;
}

/* تنسيق الكتل المخصصة إذا ظهرت في Footer */
footer .pkp_block,
.main-footer .pkp_block,
.pkp_structure_footer .pkp_block {
    background: transparent;
    color: var(--mm-white);
    border: 0;
}

footer .pkp_block .title,
.main-footer .pkp_block .title,
.pkp_structure_footer .pkp_block .title {
    color: var(--mm-gold);
    font-weight: 800;
}

footer .pkp_block a,
.main-footer .pkp_block a,
.pkp_structure_footer .pkp_block a {
    color: var(--mm-white) !important;
}

/* =========================================================
   14. البحث
   ========================================================= */

.page-search .search-results,
.page_search .search_results {
    margin-top: 22px;
}

.page-search .search-results li,
.page_search .search_results li {
    padding: 14px 0;
    border-bottom: 1px solid var(--mm-border);
}

/* =========================================================
   15. اللغة والاتجاه
   ========================================================= */

html[lang^="ar"] body,
body[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

html[lang^="fr"] body,
html[lang^="en"] body,
body[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

/* العربية */
html[lang^="ar"] #primaryNav,
html[lang^="ar"] #primaryNav-userNav,
html[lang^="ar"] #userNav,
body[dir="rtl"] #primaryNav,
body[dir="rtl"] #primaryNav-userNav,
body[dir="rtl"] #userNav {
    direction: rtl;
}

html[lang^="ar"] #primaryNav li > ul,
html[lang^="ar"] #primaryNav-userNav li > ul,
body[dir="rtl"] #primaryNav li > ul,
body[dir="rtl"] #primaryNav-userNav li > ul {
    text-align: right;
}

/* الفرنسية والإنجليزية */
html[lang^="fr"] #primaryNav,
html[lang^="fr"] #primaryNav-userNav,
html[lang^="fr"] #userNav,
html[lang^="en"] #primaryNav,
html[lang^="en"] #primaryNav-userNav,
html[lang^="en"] #userNav,
body[dir="ltr"] #primaryNav,
body[dir="ltr"] #primaryNav-userNav,
body[dir="ltr"] #userNav {
    direction: ltr;
}

html[lang^="fr"] #primaryNav li > ul,
html[lang^="fr"] #primaryNav-userNav li > ul,
html[lang^="en"] #primaryNav li > ul,
html[lang^="en"] #primaryNav-userNav li > ul,
body[dir="ltr"] #primaryNav li > ul,
body[dir="ltr"] #primaryNav-userNav li > ul {
    text-align: left;
}

/* Justify مع آخر سطر سليم */
html[lang^="ar"] .article-details-abstract p,
html[lang^="ar"] .article-details-references p,
html[lang^="ar"] .page-content p,
html[lang^="ar"] .page p {
    text-align: justify;
    text-align-last: right;
}

html[lang^="fr"] .article-details-abstract p,
html[lang^="fr"] .article-details-references p,
html[lang^="fr"] .page-content p,
html[lang^="fr"] .page p,
html[lang^="en"] .article-details-abstract p,
html[lang^="en"] .article-details-references p,
html[lang^="en"] .page-content p,
html[lang^="en"] .page p {
    text-align: justify;
    text-align-last: left;
    hyphens: auto;
}

/* =========================================================
   16. إمكانية الوصول
   ========================================================= */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--mm-gold);
    outline-offset: 2px;
}

/* =========================================================
   17. الأجهزة اللوحية
   ========================================================= */

@media (max-width: 991.98px) {
    .navbar-logo {
        padding-top: 10px;
        padding-bottom: 8px;
    }

    .navbar-logo img {
        max-height: 120px;
    }

    .main-header .navbar {
        padding: 4px 0;
    }

    .main-header .navbar-collapse {
        background: var(--mm-primary-dark);
    }

    #primaryNav .nav-item > a,
    #primaryNav-userNav .nav-item > a,
    .main-header .navbar .nav-link {
        min-height: 44px;
        padding: 10px 13px;
    }

    #primaryNav li > ul,
    #primaryNav-userNav li > ul {
        border-top-width: 1px;
        border-radius: 0;
        box-shadow: none;
    }

    .article-details-sidebar {
        margin-top: 22px;
    }

    .mm-sections-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   18. الهواتف
   ========================================================= */

@media (max-width: 575.98px) {
    body {
        font-size: 15px;
    }

    .main-header {
        border-top-width: 5px;
    }

    .navbar-logo img,
    .navbar-brand img {
        max-height: 92px;
    }

    .navbar-logo-text {
        font-size: 25px;
    }

    .homepage-image {
        max-height: 320px;
    }

    .homepage-image img {
        min-height: 240px;
        max-height: 320px;
    }

    .homepage-issue-current {
        margin-top: 20px;
    }

    .cmp_article_list > li,
    .articles > li {
        padding: 13px;
    }

    .sections .section > h2,
    .sections .section > h3,
    .sections .section > h4,
    .issue-toc-section-title,
    .obj_issue_toc .section > h2,
    .obj_issue_toc .section > h3,
    .obj_issue_toc .section > h4 {
        padding: 9px 11px;
        font-size: 18px;
    }

    .article-details-fulltitle {
        font-size: 25px;
    }

    .article-details-sidebar {
        padding: 14px;
    }

    .mm-section-card {
        padding: 15px;
    }
}

/* =========================================================
   19. تقليل الحركة
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* =========================================================
   20. الرأسية النهائية — عرض كامل بلا تشويه أو قص
   Mauritanie Médicale / Health Sciences
   النسبة الأصلية للصورة: 1850 × 326 ≈ 5.67485:1
   النسخة المحسنة: 2000 × 352 px
   ========================================================= */

/*
 * مهم:
 * لا نستخدم aspect-ratio مفروضًا ولا object-fit: cover،
 * لأن ذلك كان يسبب قص أعلى وأسفل الصورة وتشويه الشعارين.
 */

/* إخراج منطقة الشعار وحدها من حدود container */
.main-header .navbar-logo {
    position: relative !important;
    left: 50% !important;
    width: 100vw !important;
    max-width: none !important;
    margin-left: -50vw !important;
    margin-right: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
    overflow: visible !important;
    text-align: center !important;
}

/* دعم RTL */
html[dir="rtl"] .main-header .navbar-logo,
body[dir="rtl"] .main-header .navbar-logo {
    left: 50% !important;
    margin-left: -50vw !important;
    margin-right: 0 !important;
}

/* رابط البانر */
.main-header .navbar-logo > a {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* الصورة: تمدد عرضيًا مع المحافظة التامة على نسبتها */
.main-header .navbar-logo img,
.main-header .navbar-logo .img-fluid,
.main-header .navbar-brand img {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;

    /* منع أي قص أو تمديد غير متناسب */
    aspect-ratio: auto !important;
    object-fit: contain !important;
    object-position: center center !important;
}

/* إزالة الفراغ بين البانر والقائمة */
.main-header .navbar {
    margin-top: 0 !important;
}

/* إلغاء القيود القديمة الموجودة في أقسام tablet/mobile */
@media (max-width: 991.98px) {
    .main-header .navbar-logo {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .main-header .navbar-logo img,
    .main-header .navbar-logo .img-fluid,
    .main-header .navbar-brand img {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        aspect-ratio: auto !important;
        object-fit: contain !important;
    }
}

@media (max-width: 575.98px) {
    .main-header .navbar-logo img,
    .main-header .navbar-logo .img-fluid,
    .main-header .navbar-brand img {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
    }
}

/* =========================================================
   21. إصلاح نهائي للرأسية في العربية RTL
   الحل: جعل حاوية Health Sciences نفسها بعرض الصفحة
   بدلاً من سحب .navbar-logo بواسطة left/margin.
   هذا يمنع انزياح البانر في العربية.
   ========================================================= */

/* حاوية الرأسية الكاملة */
@media (min-width: 992px) {
    .main-header > .container,
    .main-header .container {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;

        /* مساحة مستقلة للغة والحساب أعلى البانر */
        padding: 58px 0 0 0 !important;
    }

    /*
     * إلغاء طريقة full-bleed السابقة (left:50% / -50vw)
     * لأنها قد تنزاح عند تفعيل RTL.
     */
    .main-header .navbar-logo,
    html[dir="rtl"] .main-header .navbar-logo,
    body[dir="rtl"] .main-header .navbar-logo,
    html[dir="ltr"] .main-header .navbar-logo,
    body[dir="ltr"] .main-header .navbar-logo {
        display: block !important;
        position: static !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;

        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;

        float: none !important;
        clear: both !important;
        text-align: center !important;
        line-height: 0 !important;
        overflow: hidden !important;
    }

    .main-header .navbar-logo > a {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* الصورة بعرض الصفحة مع المحافظة على نسبتها الأصلية */
    .main-header .navbar-logo img,
    .main-header .navbar-logo .img-fluid {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;

        margin: 0 !important;
        padding: 0 !important;

        aspect-ratio: auto !important;
        object-fit: contain !important;
        object-position: center center !important;
    }

    /* أدوات المستخدم واللغة تبقى في الشريط الأبيض العلوي */
    .main-header #userNav {
        top: 12px !important;
        right: 24px !important;
        left: auto !important;
        z-index: 20 !important;
    }

    .main-header .language-toggle,
    .main-header #languageLargeNav {
        top: 12px !important;
        left: 24px !important;
        right: auto !important;
        z-index: 20 !important;
    }

    /* شريط القائمة أسفل البانر مباشرة */
    .main-header .navbar {
        width: calc(100% - 48px) !important;
        max-width: none !important;
        margin: 0 24px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* العربية: لا نسمح لأي قواعد RTL بعكس موضع البانر */
@media (min-width: 992px) {
    html[lang^="ar"] .main-header .navbar-logo,
    html[dir="rtl"] .main-header .navbar-logo,
    body[dir="rtl"] .main-header .navbar-logo {
        direction: rtl !important;
        left: auto !important;
        right: auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    html[lang^="ar"] .main-header .navbar-logo img,
    html[dir="rtl"] .main-header .navbar-logo img,
    body[dir="rtl"] .main-header .navbar-logo img {
        direction: ltr !important; /* الصورة نفسها لا تحتاج قلب الاتجاه */
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
    }
}

/* الهاتف واللوحي: نترك آلية Health Sciences المحمولة مع منع قص الصورة */
@media (max-width: 991.98px) {
    .main-header > .container,
    .main-header .container {
        width: 100% !important;
        max-width: 100% !important;
    }

    .main-header .navbar-brand img,
    .main-header .navbar-brand .img-fluid {
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        object-fit: contain !important;
    }
}

/* =========================================================
   22. توافق محافظ مع الهواتف — إضافة إلى v1.3 دون تغيير الهوية
   Mobile layout safeguards only (no colors / fonts / effects)
   ========================================================= */

@media only screen and (max-width: 767.98px) {
    /* إصلاح تموضع البانر في RTL و LTR: منع انزياح 100vw/-50vw
       على الهاتف دون تغيير الصورة أو ألوان الرأسية أو نسبها. */
    .main-header .navbar-logo,
    html[dir="rtl"] .main-header .navbar-logo,
    body[dir="rtl"] .main-header .navbar-logo {
        position: static !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* اجعل الأعمدة قابلة للانكماش داخل عرض الهاتف. */
    .container,
    .container-fluid,
    .row > [class*="col-"],
    .article-details,
    .article-details-sidebar,
    .homepage-journal-description,
    .homepage-additional-content,
    .homepage-issue-description-wrapper,
    .page-content {
        min-width: 0;
    }

    /* منع الملفات المرئية والمضمنة من إحداث تمرير أفقي للصفحة. */
    .page-content img,
    .article-details img,
    .homepage-additional-content img,
    footer img,
    .main-footer img,
    .page-content video,
    .article-details video,
    .page-content iframe,
    .article-details iframe {
        max-width: 100%;
    }

    /* الروابط الطويلة، DOI والعناوين لا توسع العرض خارج الشاشة. */
    .article-details-doi,
    .article-details-doi a,
    .article-details-fulltitle,
    .article-details-references,
    .obj_article_summary .title,
    .homepage-additional-content,
    .pkp_footer_content,
    .footer-content {
        overflow-wrap: anywhere;
    }

    /* تجنب تجاوز حقول البحث والدخول والاتصال عرض عمودها. */
    .page-content input,
    .page-content select,
    .page-content textarea,
    .article-details input,
    .article-details select,
    .article-details textarea {
        max-width: 100%;
    }

    /* السماح لعناصر قائمة الحساب الموجودة بالالتفاف عند الضيق،
       مع الإبقاء على ألوانها وحركاتها الأصلية. */
    #userNav {
        flex-wrap: wrap;
    }

    /* السماح للقوائم المنسدلة بالانكماش داخل مساحة الهاتف. */
    #primaryNav li > ul,
    #primaryNav-userNav li > ul {
        max-width: 100%;
    }
}

/* شاشات الهواتف الصغيرة جدًا: حماية عناصر الوسائط المضمنة فقط. */
@media only screen and (max-width: 359.98px) {
    .main-header .navbar-logo img,
    .main-header .navbar-brand img {
        max-width: 100% !important;
    }
}

/* ================================================================
   23. ARTICLE SHARING / PARTAGE / مشاركة المقال
   Mauritanie Médicale — isolated component, preserve v1.3 style
   Applies only to the share box inserted on an article details page.
   No changes to theme header, navigation, footer or article layout.
   ================================================================ */

.article-details .mm-article-share {
    margin: 26px 0;
    padding: 20px 22px;
    min-width: 0;
    background: var(--mm-white, #fff);
    border: 1px solid var(--mm-border-strong, #B9CCE2);
    border-top: 3px solid var(--mm-gold, #FDBA08);
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(36, 71, 103, .06);
}

.article-details .mm-article-share__heading {
    margin: 0 0 16px;
    padding: 0 0 9px;
    color: var(--mm-primary-deep, #244767);
    font-size: clamp(18px, 2vw, 22px);
    font-weight: 800;
    line-height: 1.45;
    border-bottom: 1px solid var(--mm-border, #D7E3F1);
}

.article-details .mm-article-share__buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.article-details .mm-article-share__item {
    min-width: 0;
    flex: 1 1 128px;
    margin: 0;
    padding: 0;
}

.article-details .mm-share-btn {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    column-gap: 9px;
    width: 100%;
    min-height: 43px;
    padding: 11px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #fff !important;
    font-family: inherit;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.3;
    text-decoration: none !important;
    text-align: center;
    white-space: nowrap;
    transition: box-shadow .18s ease, transform .18s ease, filter .18s ease;
}

.article-details .mm-share-btn:hover,
.article-details .mm-share-btn:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(36, 71, 103, .16);
    filter: brightness(1.08);
    text-decoration: none !important;
}

.article-details .mm-share-btn:focus-visible {
    outline: 3px solid var(--mm-gold, #FDBA08);
    outline-offset: 2px;
}

.article-details .mm-share-btn__icon,
.article-details .mm-share-btn__icon svg {
    display: inline-block;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
}

.article-details .mm-share-btn__icon svg {
    fill: currentColor;
    vertical-align: middle;
}

/* Colours are drawn from the original Medicales blue/gold identity. */
.article-details .mm-share-btn--facebook {
    background-color: var(--mm-primary, #3F6F9F);
}
.article-details .mm-share-btn--x {
    background-color: var(--mm-dark, #1D1715);
}
.article-details .mm-share-btn--linkedin {
    background-color: var(--mm-primary-dark, #2E557E);
}
.article-details .mm-share-btn--whatsapp {
    background-color: #187D72;
}
.article-details .mm-share-btn--email {
    background-color: var(--mm-gold, #FDBA08);
    color: var(--mm-dark, #1D1715) !important;
}

.article-details .mm-share-btn--email:hover,
.article-details .mm-share-btn--email:focus-visible {
    color: var(--mm-dark, #1D1715) !important;
}

/* Only the new widget changes direction; no global RTL/LTR overrides. */
.article-details .mm-article-share[dir="rtl"] {
    text-align: right;
}
.article-details .mm-article-share[dir="ltr"] {
    text-align: left;
}

@media (max-width: 575.98px) {
    .article-details .mm-article-share {
        padding: 16px 13px;
        margin: 20px 0;
    }
    .article-details .mm-article-share__buttons {
        gap: 8px;
    }
    .article-details .mm-article-share__item {
        flex-basis: calc(50% - 4px);
    }
    .article-details .mm-share-btn {
        min-height: 46px;
        padding: 11px 8px;
        font-size: 13px;
    }
}

@media (max-width: 335px) {
    .article-details .mm-article-share__item {
        flex-basis: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .article-details .mm-share-btn {
        transition: none;
    }
    .article-details .mm-share-btn:hover,
    .article-details .mm-share-btn:focus-visible {
        transform: none;
    }
}
