@import url('../../base/variables.css');
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&family=Inter:wght@400;600;700&display=swap');

/* Global Blog Typography */
.blog-container,
.article-layout {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

[dir="rtl"] .blog-container,
[dir="rtl"] .article-layout {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: var(--primary-color);
    z-index: 9999;
    transition: width 0.1s ease;
}

/* Filter & Search Section */
.blog-controls {
    max-width: 800px;
    margin: 0 auto 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.search-container {
    width: 100%;
    max-width: 500px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 50px 12px 20px;
    /* LTR padding */
    border-radius: 50px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-heading);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-icon {
    position: absolute;
    right: 20px;
    /* LTR position */
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.blog-categories {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.category-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.95rem;
}

.category-btn:hover,
.category-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* RTL Adjustments for Search */
[dir="rtl"] .search-input {
    padding: 12px 20px 12px 50px;
}

[dir="rtl"] .search-icon {
    right: auto;
    left: 20px;
}

/* No Results Message */
#no-results {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    display: none;
    grid-column: 1 / -1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Blog Layout */
.blog-container {
    max-width: 1200px;
    margin: 80px auto;
    padding: 0 20px;
}

.blog-header {
    text-align: center;
    margin-bottom: 60px;
}

.blog-header h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    background: var(--gradient-text);
    background: var(--gradient-text);
    background-clip: text;
    /* Standard property */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Featured Section */
.featured-section {
    margin-bottom: 60px;
}

.featured-article {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    background: var(--bg-card);
    border-radius: 30px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 400px;
}

.featured-content {
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
}

.featured-content h2 {
    font-size: 2.5rem;
    line-height: 1.2;
}

.featured-content p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
}

@media (max-width: 992px) {
    .featured-article {
        grid-template-columns: 1fr;
    }

    .featured-content {
        padding: 40px;
    }
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

/* Blog Cards */
.blog-card {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.blog-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.blog-card-content {
    padding: 24px;
}

.blog-tag {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 16px;
}

.blog-card h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    line-height: 1.4;
}

.blog-card p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

.read-more {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: gap 0.3s ease;
}

.read-more:hover {
    gap: 12px;
}

/* Article Styles */
.article-image {
    width: 100%;
    border-radius: 12px;
    margin: 30px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* 2-Column Article Layout */
.article-layout {
    max-width: 1200px;
    margin: 100px auto;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
    padding: 0 20px;
}

.article-main {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.article-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.sidebar-widget {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.sidebar-widget h4 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    width: fit-content;
}

.featured-article-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    text-decoration: none;
    color: inherit;
}

.featured-article-item img {
    width: 80px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.featured-article-info h5 {
    font-size: 0.95rem;
    margin-bottom: 5px;
    line-height: 1.3;
}

.featured-article-info span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Category list in sidebar */
.sidebar-categories {
    list-style: none;
    padding: 0;
}

.sidebar-categories li {
    margin-bottom: 12px;
}

.sidebar-categories a {
    text-decoration: none;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    transition: color 0.3s;
}

.sidebar-categories a:hover {
    color: var(--primary-color);
}

/* Responsive adjustment */
@media (max-width: 1024px) {
    .article-layout {
        grid-template-columns: 1fr;
    }

    .article-sidebar {
        position: static;
    }
}

/* Table of Contents */
.toc-container {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 40px;
}

.toc-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
}

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

.toc-list li {
    margin-bottom: 10px;
}

.toc-list a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.toc-list a:hover {
    color: var(--primary-color);
}

/* Comparison Table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    overflow-x: auto;
}

.comparison-table th,
.comparison-table td {
    padding: 16px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.comparison-table th {
    background: rgba(59, 130, 246, 0.05);
    font-weight: 600;
}

/* Share Buttons */
.article-share {
    display: flex;
    gap: 15px;
    margin: 40px 0;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.share-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: transform 0.3s;
}

.share-btn:hover {
    transform: translateY(-3px);
}

.share-btn.fb {
    background: #1877F2;
}

.share-btn.tw {
    background: #1DA1F2;
}

.share-btn.wa {
    background: #25D366;
}

.share-btn.li {
    background: #0077B5;
}

/* Callout Box (Alert Style) */
.article-callout {
    background: rgba(59, 130, 246, 0.05);
    border-left: 4px solid var(--primary-color);
    padding: 24px;
    border-radius: 0 12px 12px 0;
    margin: 30px 0;
}

[dir="rtl"] .article-callout {
    border-left: none;
    border-right: 4px solid var(--primary-color);
    border-radius: 12px 0 0 12px;
}

.article-callout h4 {
    margin-top: 0;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

[dir="rtl"] .article-content {
    text-align: right;
}

[dir="rtl"] .article-content ul,
[dir="rtl"] .article-content ol {
    padding-right: 20px;
    padding-left: 0;
}

[dir="rtl"] .comparison-table {
    text-align: right;
}

[dir="rtl"] .read-more i {
    transform: rotate(180deg);
}

/* Responsive */
@media (max-width: 768px) {
    .blog-header h1 {
        font-size: 2rem;
    }

    .article-content h2 {
        font-size: 1.5rem;
    }
}