/* Articles CSS Styles */
.articles-section {
    padding: 50px 0;
    background-color: #121212;
    position: relative;
}

.articles-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle at 20% 70%, rgba(110, 77, 187, 0.03), transparent 70%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

/* Articles Main Content */
.articles-main {
    flex: 1;
    min-width: 0;
}

/* Articles Sidebar */
.articles-sidebar {
    width: 300px;
    margin-left: 30px;
}

/* Search Box */
.search-box {
    background-color: #1d1d25;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 30px;
    display: flex;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(200, 162, 255, 0.1);
}

.search-box input {
    flex: 1;
    padding: 10px;
    border: 1px solid #333340;
    background-color: #0c0c10;
    color: #e0e0e0;
    border-radius: 4px 0 0 4px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #6d4dbb;
    box-shadow: 0 0 8px rgba(110, 77, 187, 0.3);
}

.search-box button {
    background-color: #352a57;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    padding: 0 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.search-box button:hover {
    background-color: #4e3d80;
}

/* Categories */
.categories {
    background-color: #1d1d25;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(200, 162, 255, 0.1);
}

.categories h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: #c8a2ff;
    border-bottom: 1px solid rgba(200, 162, 255, 0.2);
    padding-bottom: 10px;
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(200, 162, 255, 0.2);
}

.categories ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.categories li {
    margin-bottom: 10px;
}

.categories a {
    display: block;
    padding: 8px 0;
    color: #b8b8b8;
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(200, 162, 255, 0.1);
    letter-spacing: 0.3px;
}

.categories a.active,
.categories a:hover {
    color: #c8a2ff;
    padding-left: 5px;
    text-shadow: 0 0 8px rgba(200, 162, 255, 0.3);
}

/* Popular Posts */
.popular-posts {
    background-color: #1d1d25;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(200, 162, 255, 0.1);
}

.popular-posts h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: #c8a2ff;
    border-bottom: 1px solid rgba(200, 162, 255, 0.2);
    padding-bottom: 10px;
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(200, 162, 255, 0.2);
}

.popular-posts ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popular-posts li {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(200, 162, 255, 0.1);
    transition: transform 0.3s ease;
}

.popular-posts li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.popular-posts li:hover {
    transform: translateX(5px);
}

.popular-posts a {
    display: flex;
    align-items: center;
    color: #b8b8b8;
    text-decoration: none;
    transition: all 0.3s ease;
}

.popular-posts a:hover {
    color: #c8a2ff;
    text-shadow: 0 0 8px rgba(200, 162, 255, 0.3);
}

.popular-post-image {
    width: 70px;
    height: 70px;
    border-radius: 4px;
    overflow: hidden;
    margin-left: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(200, 162, 255, 0.1);
    transition: all 0.3s ease;
}

.popular-posts a:hover .popular-post-image {
    box-shadow: 0 3px 15px rgba(200, 162, 255, 0.2);
}

.popular-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
    filter: brightness(0.9) contrast(1.05);
}

.popular-posts a:hover .popular-post-image img {
    filter: brightness(1.05) contrast(1.1);
    transform: scale(1.05);
}

.popular-post-info {
    flex: 1;
}

.popular-post-title {
    margin: 0 0 5px;
    font-size: 0.9rem;
    font-weight: 600;
}

.popular-post-date {
    font-size: 0.8rem;
    color: #888;
}

/* Articles Container */
.articles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

/* Article Card */
.article-card {
    background-color: #1d1d25;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(200, 162, 255, 0.1);
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(200, 162, 255, 0.15);
    border-color: rgba(200, 162, 255, 0.2);
}

.article-image {
    height: 200px;
    position: relative;
    overflow: hidden;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.article-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(12, 12, 14, 0.2), transparent);
    z-index: 1;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.article-card:hover .article-image::after {
    opacity: 0.4;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.5s ease;
    filter: brightness(0.85) contrast(1.05);
}

.article-card:hover .article-image img {
    transform: scale(1.05);
    filter: brightness(0.95) contrast(1.1);
}

.article-category {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: rgba(53, 42, 87, 0.85);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    z-index: 2;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(200, 162, 255, 0.2);
    backdrop-filter: blur(3px);
    transition: all 0.3s ease;
}

.article-card:hover .article-category {
    background-color: rgba(78, 61, 128, 0.9);
    box-shadow: 0 2px 15px rgba(200, 162, 255, 0.3);
}

.article-content {
    padding: 20px;
    background-color: #1d1d25;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    border-bottom: 1px solid rgba(200, 162, 255, 0.1);
    border-left: 1px solid rgba(200, 162, 255, 0.05);
    border-right: 1px solid rgba(200, 162, 255, 0.05);
}

.article-title {
    margin: 0 0 10px;
    font-size: 1.2rem;
}

.article-title a {
    color: #c8a2ff;
    text-decoration: none;
    transition: all 0.3s ease;
    text-shadow: 0 0 5px rgba(200, 162, 255, 0.2);
    letter-spacing: 0.3px;
}

.article-title a:hover {
    color: #d9bfff;
    text-shadow: 0 0 8px rgba(200, 162, 255, 0.4);
}

.article-excerpt {
    margin: 0 0 15px;
    color: #b8b8b8;
    font-size: 0.9rem;
    line-height: 1.6;
    letter-spacing: 0.2px;
    line-height: 1.5;
}

.article-meta {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: #888;
}

.article-date {
    margin-left: 15px;
    display: flex;
    align-items: center;
}

.article-date i {
    margin-left: 5px;
}

.article-author {
    display: flex;
    align-items: center;
}

.article-author i {
    margin-left: 5px;
}

.article-read-more {
    display: inline-flex;
    align-items: center;
    margin-top: 10px;
    color: #c8a2ff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    text-shadow: 0 0 5px rgba(200, 162, 255, 0.2);
}

.article-read-more i {
    margin-right: 5px;
    transition: transform 0.3s ease;
}

.article-read-more:hover {
    color: #d9bfff;
    text-shadow: 0 0 8px rgba(200, 162, 255, 0.4);
}

.article-read-more:hover i {
    transform: translateX(-3px);
}

/* Pagination */
.pagination {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pagination button {
    background-color: #1d1d25;
    border: 1px solid rgba(200, 162, 255, 0.2);
    border-radius: 4px;
    padding: 8px 15px;
    margin: 0 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #e0e0e0;
}

.pagination button.active {
    background-color: #6d4dbb;
    color: white;
    border-color: #6d4dbb;
    box-shadow: 0 0 10px rgba(109, 77, 187, 0.3);
}

.pagination button:hover:not(.active) {
    background-color: #2a2a35;
    border-color: rgba(200, 162, 255, 0.3);
}

.pagination button.page-prev,
.pagination button.page-next {
    font-size: 0.9rem;
}

/* Loading spinner */
.loading-spinner {
    text-align: center;
    padding: 30px;
    color: #e0e0e0;
}

.loading-spinner i {
    font-size: 2rem;
    color: #c8a2ff;
    margin-bottom: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: #b8b8b8;
    font-size: 1rem;
}

/* Single Article Styles */
.single-article-section {
    padding: 50px 0;
    background-color: #121212;
}

.article-breadcrumb {
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #888;
}

.article-breadcrumb a {
    color: #c8a2ff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.article-breadcrumb a:hover {
    color: #d9bfff;
    text-decoration: underline;
}

.article-breadcrumb i {
    margin: 0 5px;
    font-size: 0.8rem;
    color: #666;
}

.single-article {
    background-color: #1d1d25;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    padding: 30px;
    border: 1px solid rgba(200, 162, 255, 0.1);
    position: relative;
}

.single-article::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(200, 162, 255, 0.4), transparent);
}

.article-title {
    font-size: 2rem;
    margin: 0 0 20px;
    color: #c8a2ff;
    line-height: 1.3;
    text-shadow: 0 0 15px rgba(200, 162, 255, 0.2);
    letter-spacing: 0.5px;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 25px;
    font-size: 0.9rem;
    color: #777;
}

.article-meta span {
    margin-left: 20px;
    display: flex;
    align-items: center;
}

.article-meta i {
    margin-left: 7px;
    color: #2c3e50;
}

.article-featured-image {
    margin-bottom: 25px;
    border-radius: 8px;
    overflow: hidden;
}

.article-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

.article-body {
    margin-bottom: 30px;
    line-height: 1.8;
    font-size: 1.1rem;
    color: #444;
}

.article-body h2 {
    margin-top: 40px;
    margin-bottom: 20px;
    font-size: 1.7rem;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.article-body h3 {
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.4rem;
    color: #333;
}

.article-body p {
    margin-bottom: 20px;
}

.article-body ul,
.article-body ol {
    margin-bottom: 20px;
}

.article-body li {
    margin-bottom: 8px;
}

.article-gallery {
    margin: 30px 0;
}

.article-gallery-title {
    margin: 0 0 15px;
    font-size: 1.3rem;
}

.article-gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.article-gallery-item {
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.article-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-gallery-item:hover img {
    transform: scale(1.05);
}

.article-video {
    margin: 30px 0;
    border-radius: 8px;
    overflow: hidden;
}

.article-video-title {
    margin: 0 0 15px;
    font-size: 1.3rem;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.article-tags {
    margin-top: 30px;
    padding: 20px 0;
    border-top: 1px solid rgba(200, 162, 255, 0.1);
}

.article-tags span {
    background-color: #2a2a35;
    color: #c8a2ff;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-left: 10px;
    margin-bottom: 10px;
    display: inline-block;
    transition: all 0.3s ease;
    border: 1px solid rgba(200, 162, 255, 0.2);
}

.article-tags span:hover {
    background-color: #6d4dbb;
    color: white;
    box-shadow: 0 0 10px rgba(109, 77, 187, 0.3);
}

/* Article Navigation */
.article-navigation {
    display: flex;
    justify-content: space-between;
    margin: 40px 0;
    gap: 20px;
}

.prev-article,
.next-article {
    width: 48%;
}

.prev-article a,
.next-article a {
    display: block;
    background-color: #1d1d25;
    padding: 15px;
    border-radius: 8px;
    text-decoration: none;
    color: #e0e0e0;
    transition: all 0.3s ease;
    border: 1px solid rgba(200, 162, 255, 0.1);
}

.prev-article a:hover,
.next-article a:hover {
    background-color: #2a2a35;
    border-color: rgba(200, 162, 255, 0.2);
    box-shadow: 0 5px 15px rgba(200, 162, 255, 0.1);
}

.prev-article a {
    text-align: right;
    padding-right: 15px;
}

.next-article a {
    text-align: left;
    padding-left: 15px;
}

.prev-article span,
.next-article span {
    display: block;
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.prev-article h4,
.next-article h4 {
    margin: 5px 0 0;
    font-size: 1rem;
    font-weight: 600;
    color: #c8a2ff;
    text-shadow: 0 0 5px rgba(200, 162, 255, 0.2);
}

.prev-article i {
    margin-left: 10px;
    color: #c8a2ff;
}

.next-article i {
    margin-right: 10px;
    color: #c8a2ff;
}

/* Related Articles */
.related-articles {
    margin-top: 50px;
    background-color: #1d1d25;
    border-radius: 8px;
    padding: 25px;
    border: 1px solid rgba(200, 162, 255, 0.1);
}

.related-articles h3 {
    margin: 0 0 20px;
    font-size: 1.3rem;
    color: #c8a2ff;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(200, 162, 255, 0.2);
    text-shadow: 0 0 10px rgba(200, 162, 255, 0.2);
}

.related-articles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

/* ======= اصلاح نمایش متن مقاله برای article.html ======= */
/* بهبود نمایش متن و عناصر داخل مقالات */
.single-article .article-content,
.single-article .article-content *,
.single-article .article-body,
.single-article .article-body *,
.single-article .article-body p,
.single-article .article-body ul,
.single-article .article-body ol,
.single-article .article-body li,
.single-article .article-body div {
    font-family: 'Vazir', Tahoma, Arial, sans-serif !important;
    direction: rtl !important;
    text-align: right !important;
    word-break: break-word;
    line-height: 2 !important;
    font-size: 1.08rem !important;
    color: #e0e0e0 !important;
}

.single-article .article-body a {
    color: #c8a2ff !important; /* Ensured !important */
    text-decoration: underline !important; /* Ensured !important */
    cursor: pointer !important; /* Added !important */
    pointer-events: auto !important; /* Added !important */
    position: relative; /* Added for z-index context */
    z-index: 10; /* Increased z-index just in case */
    word-break: break-all;
    transition: color 0.2s;
}
.single-article .article-body a:hover {
    color: #fff;
    background: #6d4dbb33;
}

/* Special class for direct RTL formatting */
.rtl-content {
    direction: rtl !important;
    text-align: right !important;
    font-family: 'IRANSans', 'Vazir', Tahoma, Arial, sans-serif !important;
    color: #e0e0e0 !important;
    line-height: 2 !important;
    unicode-bidi: bidi-override;
}

/* Article wrapper for consistent RTL formatting */
.article-wrapper {
    direction: rtl !important;
    text-align: right !important;
    font-family: 'IRANSans', 'Vazir', Tahoma, Arial, sans-serif !important;
    color: #e0e0e0 !important;
    line-height: 2 !important;
    unicode-bidi: bidi-override;
    padding: 0;
    margin: 0;
}

.single-article .article-body pre, 
.single-article .article-body code,
.single-article .article-body .code-block {
    font-family: 'Fira Mono', 'Consolas', monospace !important;
    background: #23233a;
    color: #c8a2ff;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.98rem;
    direction: ltr !important;
    text-align: left !important;
    overflow-x: auto;
}

/* Fix for embedded content */
.single-article .article-body iframe,
.single-article .article-body embed,
.single-article .article-body object {
    max-width: 100%;
    margin: 15px auto;
    display: block;
}

.single-article .article-body blockquote {
    border-right: 4px solid #c8a2ff;
    background: #23233a;
    color: #b8b8b8;
    margin: 18px 0;
    padding: 12px 18px;
    border-radius: 6px;
    font-style: italic;
}

/* --- FORCE clickable and visible links in article body --- */
.single-article .article-body a,
.single-article .article-body a * {
    color: #c8a2ff !important;
    text-decoration: underline !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    position: relative !important;
    z-index: 100 !important;
    background: none !important;
    box-shadow: none !important;
}
.single-article .article-body a:hover,
.single-article .article-body a:hover * {
    color: #fff !important;
    background: #6d4dbb33 !important;
}

/* لینک‌های خودکار (تبدیل شده از متن) با رنگ آبی و استایل مخصوص */
.single-article .article-body a.auto-link,
.single-article .article-body a.auto-link * {
    color: #2196f3 !important;
    text-decoration: underline !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    position: relative !important;
    z-index: 100 !important;
    background: none !important;
    box-shadow: none !important;
}
.single-article .article-body a.auto-link:hover,
.single-article .article-body a.auto-link:hover * {
    color: #1565c0 !important;
    background: #e3f2fd !important;
}

/* Responsive styles */
@media (max-width: 992px) {
    .container {
        flex-direction: column;
    }
    
    .articles-sidebar {
        width: 100%;
        margin-left: 0;
        margin-bottom: 30px;
    }
    
    .articles-container {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .related-articles-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .article-title {
        font-size: 1.7rem;
    }
    
    .article-navigation {
        flex-direction: column;
    }
    
    .prev-article,
    .next-article {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .article-meta span {
        margin-bottom: 10px;
    }
    
    .article-gallery-container {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .articles-container {
        padding: 8px 2px;
    }
    .articles-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .article-card {
        padding: 10px 6px;
        font-size: 0.97rem;
    }
    .article-card .article-title {
        font-size: 1.1rem;
    }
    .article-card .article-summary {
        font-size: 0.95rem;
    }
    .article-card .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        font-size: 0.85rem;
    }

    .single-article-container {
        padding: 10px 2px;
    }
    .single-article-title {
        font-size: 1.3rem;
    }
    .single-article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        font-size: 0.9rem;
    }
    .single-article-content {
        font-size: 1.02rem;
        padding: 8px 0;
    }
}

@media (max-width: 480px) {
    .articles-container {
        grid-template-columns: 1fr;
        padding: 4px 0;
    }
    
    .related-articles-container {
        grid-template-columns: 1fr;
    }
    
    .article-title {
        font-size: 1.5rem;
    }
    
    .single-article {
        padding: 20px;
    }
    
    .article-body {
        font-size: 1rem;
    }

    .article-card {
        padding: 6px 2px;
        font-size: 0.93rem;
    }
    .article-card .article-title {
        font-size: 1rem;
    }

    .single-article-container {
        padding: 4px 0;
    }
    .single-article-title {
        font-size: 1.1rem;
    }
    .single-article-content {
        font-size: 0.97rem;
        padding: 4px 0;
    }
}
