/* ==========================================================================
   MASTER STYLE: AL-KHWARIZMI JOURNAL (FINAL ALIGNED EDITION)
   Updated: Dec 4, 2025
   ========================================================================== */

/* -----------------------------------------------------------
   1. الإعدادات الأساسية والخطوط
   ----------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

body, h1, h2, h3, h4, h5, h6, p, a, li, span, div, input, button {
    font-family: 'Roboto', "Segoe UI", Tahoma, Geneva, Verdana, sans-serif !important;
}

html { scroll-behavior: smooth; }

::selection {
    background-color: #004080; color: #ffffff;
}

/* -----------------------------------------------------------
   2. رأس الصفحة واللوجو (Header)
   ----------------------------------------------------------- */
.pkp_site_name .is_img img {
    max-height: 110px; width: auto; margin-top: 5px; margin-bottom: 5px;
}
.pkp_site_name > .is_text { display: none !important; }
.pkp_structure_head { border-bottom: 3px solid #004080; }

/* -----------------------------------------------------------
   3. مكان اللغة (أقصى اليمين - Top Right)
   ----------------------------------------------------------- */
.pkp_structure_sidebar_right .block_language,
.pkp_structure_sidebar_left .block_language,
.block_language {
    position: fixed !important;
    
    /* الإحداثيات: أقصى اليمين */
    top: 10px !important;       
    right: 20px !important;     
    left: auto !important;
    transform: none !important;
    
    background-color: #004080 !important; /* خلفية زرقاء */
    border-radius: 4px !important;
    padding: 5px 15px !important;
    z-index: 100000 !important;
    width: auto !important;
    min-width: 0 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.block_language .title { display: none !important; }
.block_language .content ul { margin: 0 !important; padding: 0 !important; list-style: none !important; }
.block_language li { display: inline-block !important; margin: 0 8px !important; }

.block_language a {
    color: #ffffff !important;
    font-weight: 700 !important; font-size: 13px !important; text-decoration: none !important;
    opacity: 0.9;
}
.block_language a:hover { opacity: 1; text-decoration: underline !important; }

/* -----------------------------------------------------------
   4. القوائم (Navigation)
   ----------------------------------------------------------- */
.pkp_navigation_primary a, .pkp_navigation_user a, .pkp_nav_list a { 
    text-transform: none !important; font-weight: 500; font-size: 16px;
}

.dropdown-menu {
    background-color: #004080 !important; border: 1px solid #003366 !important; padding: 0 !important;
}
.dropdown-item, .dropdown-menu a {
    color: #ffffff !important; padding: 10px 15px !important; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.dropdown-item:hover, .dropdown-item:focus, .dropdown-menu a:hover {
    background-color: #00bcd4 !important; color: #ffffff !important;
}

/* -----------------------------------------------------------
   5. تنسيق المحتوى
   ----------------------------------------------------------- */
p, .obj_article_summary .abstract, .cmp_breadcrumbs, .pkp_block .content {
    text-align: justify !important; text-justify: inter-word;
}

/* الجداول */
.page table {
    width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 0.95em;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}
.page table thead tr { background-color: #004080; color: #ffffff; text-align: left; }
.page table th, .page table td { padding: 12px 15px; border-bottom: 1px solid #dddddd; }
.page table tbody tr:nth-of-type(even) { background-color: #f3f3f3; }

/* حقول الإدخال */
input[type="text"], input[type="password"], input[type="email"], textarea, select {
    border: 1px solid #ced4da !important; border-radius: 4px !important; padding: 10px !important;
    transition: all 0.2s ease-in-out;
}
input:focus, textarea:focus, select:focus {
    border-color: #004080 !important; box-shadow: 0 0 0 0.2rem rgba(0, 64, 128, 0.15) !important; outline: none !important;
}

/* -----------------------------------------------------------
   6. الشريط الجانبي (Sidebar) - توحيد وتوسيط اللوجوهات
   ----------------------------------------------------------- */
.pkp_structure_sidebar_right .pkp_block {
    margin-bottom: 25px !important; 
    padding: 20px; 
    background-color: #ffffff; 
    border: 1px solid #f0f0f0; 
    border-radius: 8px;
    
    /* أوامر التوسيط الصارمة */
    display: flex !important; 
    flex-direction: column !important;
    align-items: center !important; 
    justify-content: center !important; 
    text-align: center !important;
    
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

/* ضبط حجم الصور لتكون موحدة (Unified Size) */
.pkp_structure_sidebar_right img { 
    margin: 10px auto !important; 
    display: block !important; 
    
    /* الأبعاد الموحدة */
    max-width: 160px !important;  /* عرض موحد للجميع */
    max-height: 90px !important;  /* ارتفاع موحد لضمان التناسق */
    width: auto !important;
    height: auto !important;
    
    object-fit: contain !important; /* ضمان عدم تشوه الصورة */
}

/* استهداف خاص لـ CiteScore لتوسيطه */
.pkp_block.block_custom .content, 
.pkp_block.block_custom div,
.pkp_block.block_custom a {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-direction: column !important;
    width: 100% !important;
}

/* استثناء اللغة من التنسيق (لأنها في الهيدر) */
.pkp_structure_sidebar_right .pkp_block:not(.block_language) .content {
    width: 100% !important; text-align: center !important; padding: 0 !important; margin: 0 !important;
}

.pkp_block .title {
    width: 100%; text-align: center !important; margin-bottom: 15px; font-weight: 700;
    color: #004080; border-bottom: 2px solid #f5f5f5; padding-bottom: 10px;
    font-size: 0.95em; text-transform: uppercase;
}
.pkp_structure_sidebar_right li a {
    display: block; padding: 8px 0; text-decoration: none; border-bottom: 1px solid #f9f9f9;
    color: #555; transition: color 0.2s;
}
.pkp_structure_sidebar_right li a:hover { color: #004080; }

/* زر تقديم بحث */
.block_make_submission a {
    background-color: #004080; color: #ffffff !important; padding: 15px 20px;
    border-radius: 6px; text-align: center; display: block; width: 100%;
    font-size: 1.1em; font-weight: 700; text-decoration: none;
    box-shadow: 0 4px 8px rgba(0, 64, 128, 0.2); 
    transition: all 0.3s ease-in-out;
    margin-bottom: 5px;
}
.block_make_submission a:hover {
    background: linear-gradient(180deg, #0059b3 0%, #003366 100%); 
    transform: translateY(-2px);
}

/* -----------------------------------------------------------
   7. الفوتر (Footer)
   ----------------------------------------------------------- */
.pkp_structure_footer_wrapper, .pkp_structure_footer, .pkp_site_footer {
    background: #004080 !important; background-color: #004080 !important;
    color: #ffffff !important; border: none !important;
}
.pkp_structure_footer_wrapper *, .pkp_structure_footer *, .pkp_site_footer * {
    color: #ffffff !important;
}
.pkp_site_footer a:hover {
    color: #cccccc !important; text-decoration: underline !important;
}

/* -----------------------------------------------------------
   8. قوائم المقالات (تأثير الطفو)
   ----------------------------------------------------------- */
.obj_article_summary {
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    padding: 15px; border-radius: 8px; border: 1px solid transparent;
}
.obj_article_summary:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    background-color: #f5f7fa !important;
    border-color: #e2e6ea;
}
.obj_article_summary .title a {
    color: #004080 !important; font-weight: 700; font-size: 1.2rem;
    text-decoration: none; transition: color 0.3s ease !important;
}
.obj_article_summary .title a:hover { color: #00bcd4 !important; }

/* -----------------------------------------------------------
   9. أزرار PDF (الذكية)
   ----------------------------------------------------------- */
.obj_galley_link, .galleys_links, .galleys_links li {
    background: transparent !important; border: none !important; box-shadow: none !important;
    padding: 0 !important; margin: 0 !important;
}
/* الزر الأزرق */
a.obj_galley_link.pdf, .obj_galley_link.file {
    background-color: #004080 !important; color: #ffffff !important;
    text-decoration: none !important; display: inline-block !important;
    border: 1px solid #003366 !important; font-weight: 500 !important;
    transition: all 0.2s; border-radius: 50px !important; margin-top: 10px;
}
a.obj_galley_link.pdf:hover, .obj_galley_link.file:hover {
    background-color: #0059b3 !important; transform: translateY(-2px) !important;
}
/* زر القائمة (صغير) */
.obj_article_summary a.obj_galley_link.pdf,
.obj_article_summary .obj_galley_link.file {
    padding: 8px 25px !important; font-size: 0.9em !important;
    min-width: 100px !important; width: auto !important;
}
/* زر الصفحة الداخلية (كبير) */
.page_article a.obj_galley_link.pdf,
.page_article .obj_galley_link.file {
    padding: 15px 50px !important; font-size: 1.2em !important; font-weight: 700 !important;
    min-width: 250px !important; box-shadow: 0 5px 15px rgba(0, 64, 128, 0.2) !important;
    display: block !important; margin-left: auto; margin-right: auto; text-align: center;
}

/* -----------------------------------------------------------
   10. صفحة المقالة الداخلية
   ----------------------------------------------------------- */
.page_article .page_title {
    color: #004080 !important; font-size: 1.8em !important; font-weight: 700 !important;
    text-align: center !important; margin-bottom: 20px !important;
}

.item.keywords .label { display: none !important; }
.item.keywords::before {
    content: "Keywords"; display: block; font-weight: bold; color: #004080; margin-bottom: 5px;
}
.item.keywords .value { line-height: 1.8; }

.item.abstract .label { font-weight: bold; color: #004080; display: block; margin-bottom: 5px; }
.item.abstract { margin-bottom: 20px; }

.item.doi .value a {
    background-color: #e3f2fd; color: #004080 !important; padding: 5px 12px;
    border-radius: 20px; text-decoration: none; font-weight: 500;
    border: 1px solid #bbdefb; display: inline-block; transition: all 0.2s;
}
.item.doi .value a:hover { background-color: #004080; color: #fff !important; }

/* بيانات نظيفة */
.entry_details .item {
    background-color: #f9f9f9; padding: 15px; border-radius: 6px;
    margin-bottom: 15px; border: 1px solid #eee; border-left: none !important;
}
.entry_details .item .label {
    font-size: 0.85em; text-transform: uppercase; color: #666;
    letter-spacing: 1px; margin-bottom: 5px; display: block;
}
.entry_details .item .value { font-weight: 500; color: #333; }

.item.citation .card-header {
    background-color: #004080 !important; color: #ffffff !important;
    font-weight: 700 !important; text-align: center !important; border: none !important;
}
.item.citation .card-body {
    background-color: #f8f9fa !important; border: 1px solid #ddd !important;
    text-align: justify !important; color: #333 !important;
}
.item.citation button.btn.dropdown-toggle {
    background-color: #004080 !important; color: #ffffff !important;
    width: 100% !important; margin-top: 10px;
}

/* -----------------------------------------------------------
   11. الموبايل (Mobile)
   ----------------------------------------------------------- */
@media only screen and (max-width: 991px) {
    .pkp_site_name .is_img img {
        max-height: 85px !important; margin: 5px auto !important; display: block;
    }
    .pkp_head_wrapper { height: auto !important; min-height: 90px !important; }
    .pkp_site_name { padding: 0 !important; flex-grow: 1; display: flex; justify-content: center; }
    
    .pkp_nav_list ul, .pkp_nav_list li, .pkp_nav_list a {
        text-transform: none !important; font-size: 15px !important;
    }
    .pkp_nav_list li {
        margin-bottom: 8px !important; border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    .page_article a.obj_galley_link.pdf,
    .page_article .obj_galley_link.file {
        width: 90% !important; display: block; margin: 10px auto !important;
    }
    
    /* إعادة اللغة للوضع الطبيعي في الموبايل */
    .pkp_structure_sidebar_right .block_language,
    .pkp_structure_sidebar_left .block_language,
    .block_language {
        position: relative !important; top: auto !important; left: auto !important; right: auto !important;
        transform: none !important; text-align: center !important; margin-bottom: 10px !important;
        background-color: #003366 !important; width: 100% !important; padding: 5px !important; border-radius: 0 !important;
    }
    .block_language a { color: #fff !important; background: none; border: none; }
}