/* ===== MAXIMUM SPECIFICITY FONT OVERRIDE ===== */
/* Place this at the VERY TOP to ensure it takes precedence */

/* Target the tab-content and ALL its descendants with maximum specificity */
html body .container #multi-gallery .tab-container .tab-content,
html body .container #multi-gallery .tab-container .tab-content *,
html body .container #multi-gallery .tab-container .tab-content h1,
html body .container #multi-gallery .tab-container .tab-content h2,
html body .container #multi-gallery .tab-container .tab-content h3,
html body .container #multi-gallery .tab-container .tab-content h4,
html body .container #multi-gallery .tab-container .tab-content h5,
html body .container #multi-gallery .tab-container .tab-content h6,
html body .container #multi-gallery .tab-container .tab-content p,
html body .container #multi-gallery .tab-container .tab-content div,
html body .container #multi-gallery .tab-container .tab-content span,
html body .container #multi-gallery .tab-container .tab-content a,
html body .container #multi-gallery .tab-container .tab-content li,
html body .container #multi-gallery .tab-container .tab-content ul,
html body .container #multi-gallery .tab-container .tab-content ol {
    font-family: 'Readex Pro', 'Noto Sans Arabic', Arial, sans-serif !important;
}

/* Also target articles-list specifically since it's loaded via AJAX */
html body .container #multi-gallery .tab-content .articles-list,
html body .container #multi-gallery .tab-content .articles-list *,
html body .container #multi-gallery .tab-content .articles-list h4,
html body .container #multi-gallery .tab-content .articles-list a {
    font-family: 'Readex Pro', 'Noto Sans Arabic', Arial, sans-serif !important;
}

/* OVERRIDE ALL font sizes in tab-content - target ALL elements */
#multi-gallery .tab-content h1,
#multi-gallery .tab-content h2,
#multi-gallery .tab-content h3,
#multi-gallery .tab-content h4,
#multi-gallery .tab-content h5,
#multi-gallery .tab-content h6 {
    font-family: 'Readex Pro', 'Noto Sans Arabic', Arial, sans-serif !important;
}

/* CRITICAL: Force all paragraph tags to be 16px with reduced line-height */
html body #multi-gallery .tab-content p,
html body section#multi-gallery div.tab-content p,
body .container #multi-gallery .tab-content > p,
#multi-gallery .tab-content p,
div[id*="الأكثر"] p,
div[id="عام"] p,
div[id="كتاب"] p,
div[id="رأي"] p,
div[id="فكر"] p,
div[id="بحوث"] p,
div[id="مختلفات"] p {
    font-size: 16px !important;
    line-height: 1.6 !important; /* Reduced from 2 to 1.6 */
    font-family: 'Readex Pro', 'Noto Sans Arabic', Arial, sans-serif !important;
    font-weight: 400 !important; /* Changed from 500 to 400 for Readex Pro */
    margin: 10px 0 !important; /* Reduced from 15px to 10px */
}

/* Force direct child paragraphs */
#multi-gallery .tab-content > p,
.tab-content > p {
    font-size: 16px !important;
    line-height: 1.6 !important;
}

/* ============================================================================
   CRITICAL: ARTICLE TITLE LINKS - MAXIMUM SPECIFICITY - READEX PRO
   These rules MUST override everything else for article titles
   Target BOTH .articles-list and .gallery-articles classes
   ============================================================================ */

/* Target article h4 and links with ULTRA-HIGH specificity - INCLUDING gallery-articles */
html body div.container section#multi-gallery div.tab-container div.tab-content div.articles-list.gallery-articles div.article-item h4 a,
html body div.container section#multi-gallery div.tab-container div.tab-content div.gallery-articles div.article-item h4 a,
html body div.container section#multi-gallery div.tab-container div.tab-content div.articles-list div.article-item h4 a,
html body div.container section#multi-gallery div.tab-container div.tab-content div.article-item h4 a,
html body section#multi-gallery div.tab-container div.tab-content div.article-item h4 a,
html body section#multi-gallery div.tab-content div.gallery-articles div.article-item h4 a,
html body section#multi-gallery div.tab-content div.articles-list div.article-item h4 a,
html body section#multi-gallery div.tab-content div.article-item h4 a,
html body #multi-gallery .tab-content .gallery-articles .article-item h4 a,
html body #multi-gallery .tab-content .articles-list .article-item h4 a,
html body #multi-gallery .tab-content .article-item h4 a,
section#multi-gallery .tab-content .gallery-articles .article-item h4 a,
section#multi-gallery .tab-content .articles-list .article-item h4 a,
section#multi-gallery .tab-content .article-item h4 a,
#multi-gallery .tab-content .gallery-articles .article-item h4 a,
#multi-gallery .tab-content .articles-list .article-item h4 a,
#multi-gallery .tab-content .article-item h4 a,
.tab-content .gallery-articles .article-item h4 a,
.tab-content .articles-list .article-item h4 a,
.tab-content .article-item h4 a,
.gallery-articles .article-item h4 a,
.article-item h4 a {
    font-size: 16px !important; /* Reduced from 22px */
    line-height: 1.4 !important; /* Good spacing for multi-line titles */
    font-family: 'Readex Pro', 'Noto Sans Arabic', Arial, sans-serif !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    text-decoration: none !important;
    display: block !important;
    padding: 0 !important;
    transition: color 0.3s ease !important;
}

/* Hover state for article links */
html body div.container section#multi-gallery div.tab-container div.tab-content div.article-item h4 a:hover,
html body section#multi-gallery div.tab-content .article-item h4 a:hover,
html body section#multi-gallery div.tab-content .gallery-articles .article-item h4 a:hover,
#multi-gallery .tab-content .gallery-articles .article-item h4 a:hover,
#multi-gallery .tab-content .article-item h4 a:hover,
.tab-content .gallery-articles .article-item h4 a:hover,
.tab-content .article-item h4 a:hover,
.gallery-articles .article-item h4 a:hover,
.article-item h4 a:hover {
    color: #2563eb !important;
    text-decoration: underline !important;
}

/* Target the h4 container itself */
html body div.container section#multi-gallery div.tab-container div.tab-content div.gallery-articles div.article-item h4,
html body div.container section#multi-gallery div.tab-container div.tab-content div.article-item h4,
html body section#multi-gallery div.tab-content .article-item h4,
html body section#multi-gallery div.tab-content .gallery-articles .article-item h4,
#multi-gallery .tab-content .gallery-articles .article-item h4,
#multi-gallery .tab-content .articles-list .article-item h4,
#multi-gallery .tab-content .article-item h4,
.tab-content .gallery-articles .article-item h4,
.tab-content .article-item h4,
.gallery-articles .article-item h4,
.article-item h4 {
    font-size: 22px !important;
    line-height: 1.4 !important; /* Good for multi-line titles */
    margin: 0 !important;
    padding: 0 !important;
    font-weight: 600 !important;
    font-family: 'Readex Pro', 'Noto Sans Arabic', Arial, sans-serif !important;
}

/* Reduce spacing between article items */
.article-item {
    margin-bottom: 8px !important; /* Reduced space BETWEEN articles */
    padding: 0 !important; /* No internal padding */
}

/* Keep other h4 elements at a reasonable size (not in articles) */
#multi-gallery .tab-content h4:not(.article-item h4) {
    font-size: 16px !important;
    line-height: 1.4 !important;
}

/* Specific override for the description paragraph at the top of #multi-gallery */
#multi-gallery > p:not(.tab-content p) {
    font-size: 0.9em !important;
}

/* Style de la section principale */
#multi-gallery {
    padding: 20px 10px;
    text-align: center;
    background-color: #f9f9f9;
}

#multi-gallery h2 {
    color: #666;
}

#multi-gallery p {
    font-size: 13px;
}

/* Style des onglets */
.tab-container {
    margin: 20px 0;
}

.tab-header {
    display: flex;
    border-bottom: 1px solid #ddd;
    justify-content: center;
}

.tab-container .tab-button {
    font-family: 'El Messiri', 'Readex Pro', 'Noto Sans Arabic', Arial, sans-serif;
    font-size: 1.5em;
    background-color: #f1f1f1;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 12px 20px;
    transition: 0.3s;
    color: #555;
    border-radius: 5px 5px 0 0;
    margin-right: 0px;
    direction: rtl;
}

.tab-button:hover {
    background-color: #e0e0e0;
}

.tab-button.active {
    background-color: #3498db;
    color: white;
}

/* Style du contenu des onglets */
.tab-content {
    display: none;
    padding: 15px 0;
    animation: fadeEffect 0.5s;
}

/* Animation de fondu */
@keyframes fadeEffect {
    from {opacity: 0;}
    to {opacity: 1;}
}

/* Style de la galerie */
.gallery-container {
    overflow: hidden;
    white-space: nowrap;
}

.gallery-slide {
    display: inline-block;
    animation: slide 60s linear infinite;
}

.gallery-slide img {
    height: 250px;
    margin: 0 10px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-slide img:hover {
    transform: scale(1.05);
}

/* Animation de défilement */
@keyframes slide {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Style button mode */
.tabf {
    overflow: hidden;
    border: 1px solid #ccc;
    background-color: #f1f1f1;
    border-radius: 5px 5px 0 0;
    margin-top: 1em;
}

.tabf button {
    font-family: 'El Messiri', 'Readex Pro', 'Noto Sans Arabic', Arial, sans-serif;
    font-size: 1.5em;
    background-color: #f1f1f1;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 12px 20px;
    transition: 0.3s;
    color: #555;
    border-radius: 5px 5px 0 0;
    margin-right: 0px;
    direction: rtl;
}

.tabf button:hover {
    background-color: #ddd;
}

.tabf button.active {
    background-color: #3498db;
    color: white;
}

.tabcontentf {
    display: none;
    padding: 20px;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 5px 5px;
    animation: fadeEffect 1s;
}

/* Authors List Styles */
.authors-list {
    margin: 20px 0;
}

.authors-list h3 {
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.authors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.author-item {
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.author-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.author-link {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: #2c3e50;
}

.author-name {
    font-size: 18px;
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}

.article-count {
    font-size: 16px;
    color: #6c757d;
    font-weight: 400;
}

/* Recent Articles Section */
.recent-articles {
    margin-top: 40px;
    border-top: 1px solid #e9ecef;
    padding-top: 30px;
}

.recent-articles h4 {
    color: #2c3e50;
    margin-bottom: 20px;
}

/* Author Header in Individual Author View */
.author-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.author-header h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
}

.author-header p {
    margin: 0;
}

.author-header a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.author-header a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Sub-tabs Styles */
.sub-tabs {
    display: none;
    padding: 10px 0;
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
    justify-content: center;
    gap: 10px;
}

/* Maximum specificity for sub-tab buttons */
html body .container #multi-gallery #most-read-subtabs .sub-tab-button,
html body #multi-gallery .sub-tabs .sub-tab-button,
.sub-tabs button.sub-tab-button {
    font-family: 'Readex Pro', 'Noto Sans Arabic', Arial, sans-serif !important;
    font-size: 1.3em !important;
    font-weight: 600 !important;
    background-color: #ffffff;
    border: 1px solid #ddd;
    outline: none;
    cursor: pointer;
    padding: 10px 20px;
    transition: 0.3s;
    color: #555;
    border-radius: 5px;
    direction: rtl;
}

html body .container #multi-gallery #most-read-subtabs .sub-tab-button:hover,
html body #multi-gallery .sub-tabs .sub-tab-button:hover,
.sub-tabs button.sub-tab-button:hover {
    background-color: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

html body .container #multi-gallery #most-read-subtabs .sub-tab-button.active,
html body #multi-gallery .sub-tabs .sub-tab-button.active,
.sub-tabs button.sub-tab-button.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
    font-weight: 700 !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .authors-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .author-link {
        padding: 12px 15px;
    }
    
    .author-header {
        padding: 15px;
    }
    
    .author-header h3 {
        font-size: 16px;
    }
    
    .tabf button,
    .tab-container .tab-button {
        font-size: 1.2em;
        padding: 10px 15px;
    }
    
    .sub-tab-button {
        font-size: 1em;
        padding: 6px 12px;
    }
    
    .sub-tabs {
        flex-wrap: wrap;
    }
    
    /* Make article titles slightly smaller on mobile but still prominent */
    html body #multi-gallery .tab-content .article-item h4 a,
    .article-item h4 a {
        font-size: 16px !important;
        line-height: 1.4 !important; /* Keep good spacing for multi-line */
        padding: 0 !important;
    }
    
    .article-item {
        margin-bottom: 6px !important; /* Reduced space between articles on mobile */
        padding: 0 !important;
    }
}