/* ============================================
   articles.css — تنسيقات صفحة المقالات العامة
   التنسيقات الحرجة (Hero, Breadcrumb, Section Header)
   موجودة inline في critical-css بالصفحة نفسها
   ============================================ */

/* ============================================
   المتغيرات الأساسية
   ============================================ */
:root {
    --primary-blue: #002B5B;
    --light-blue: #1A5F9A;
    --accent-blue: #2B7DC3;
    --bg-color: #F5F6FA;
    --white: #FFFFFF;
    --gray-text: #4A5568;
    --light-gray: #E2E8F0;
    --success: #0D8C4B;
    --warning: #FF6B35;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.05);
    --border-radius: 16px;
    --border-radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body,
.main-content,
.article-content,
.article-title,
.article-excerpt,
.section-header {
    font-family: 'Tajawal', 'Fustat', 'Almarai', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ============================================
   المحتوى الرئيسي
   ============================================ */
.main-content {
    padding: 50px 0 60px;
    background: var(--bg-color);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ============================================
   تبويبات التصنيف
   ============================================ */
.categories-wrapper {
    position: relative;
    margin-bottom: 40px;
    padding: 0 10px;
}

.categories-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 8px 12px;
    background: var(--white);
    border-radius: 60px;
    border: 1px solid var(--light-gray);
    box-shadow: var(--shadow-sm);
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.categories-tabs::-webkit-scrollbar { display: none; }

.category-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 40px;
    border: none;
    background: transparent;
    color: var(--gray-text);
    font-family: 'Tajawal', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
    min-height: 44px;
    text-decoration: none;
}

.category-tab i {
    font-size: 1rem;
    color: var(--accent-blue);
    transition: var(--transition);
}

.category-tab .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(43, 125, 195, 0.08);
    color: var(--accent-blue);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 10px;
    border-radius: 20px;
    min-width: 22px;
    height: 20px;
    transition: var(--transition);
}

.category-tab:hover {
    background: rgba(43, 125, 195, 0.06);
    color: var(--primary-blue);
    transform: translateY(-2px);
}

.category-tab:hover i { color: var(--primary-blue); }
.category-tab:hover .tab-count { background: rgba(43, 125, 195, 0.15); }

.category-tab.active {
    background: linear-gradient(135deg, var(--primary-blue), var(--light-blue));
    color: white;
    box-shadow: 0 6px 24px rgba(0, 43, 91, 0.3);
}

.category-tab.active i { color: white; }
.category-tab.active .tab-count { background: rgba(255, 255, 255, 0.2); color: white; }

.category-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 50%;
    transform: translateX(50%);
    width: 20px;
    height: 3px;
    background: var(--accent-blue);
    border-radius: 3px;
    opacity: 0.5;
}

.category-tab-all {
    background: rgba(43, 125, 195, 0.04);
    border: 1px solid rgba(43, 125, 195, 0.08);
}

.category-tab-all.active {
    background: linear-gradient(135deg, var(--primary-blue), var(--light-blue));
    border-color: var(--primary-blue);
}

/* ============================================
   بطاقة المقال
   ============================================ */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 45px;
}

.article-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--light-gray);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(43, 125, 195, 0.15);
}

/* صورة المقال */
.article-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    overflow: hidden;
    background: linear-gradient(135deg, #f0f4f8, #e2e8f0);
    display: block;
}

.article-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.article-card:hover .article-image-wrapper img {
    transform: scale(1.05);
}

/* شارات */
.article-category-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 14px;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue));
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.article-category-badge i { font-size: 0.6rem; }

.article-featured-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--warning), #FF8B5C);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Meta فوق الصورة */
.article-overlay-meta {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    padding: 20px 16px 14px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.3) 50%, transparent 100%);
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.article-overlay-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.7rem;
    font-weight: 500;
}

.article-overlay-meta .meta-item i {
    font-size: 0.7rem;
}

/* ألوان مختلفة لكل أيقونة */
.article-overlay-meta .meta-date i { color: #f59e0b; }
.article-overlay-meta .meta-reading i { color: #38bdf8; }
.article-overlay-meta .meta-views i { color: #a78bfa; }
.article-overlay-meta .meta-author .author-avatar { border-color: rgba(245, 158, 11, 0.4); }

.article-overlay-meta .meta-divider {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
}

.article-overlay-meta .meta-author {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-overlay-meta .meta-author .author-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.55rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* محتوى البطاقة */
.article-content {
    padding: 14px 18px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-title a { color: inherit; text-decoration: none; transition: var(--transition); }
.article-title a:hover { color: var(--accent-blue); }

.article-excerpt {
    font-size: 0.82rem;
    color: var(--gray-text);
    line-height: 1.6;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    opacity: 0.8;
}

/* زر قراءة المزيد */
.read-more-wrapper {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--light-gray);
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-blue);
    font-weight: 700;
    font-size: 0.8rem;
    text-decoration: none;
    transition: var(--transition);
    padding: 4px 0;
    position: relative;
}

.read-more::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-blue), var(--primary-blue));
    transition: var(--transition);
}

.read-more:hover { color: var(--primary-blue); }
.read-more:hover::after { width: 100%; }
.read-more i { font-size: 0.7rem; transition: var(--transition); }
.read-more:hover i { transform: translateX(-4px); }

/* ============================================
   ترقيم الصفحات
   ============================================ */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--light-gray);
    background: var(--white);
    color: var(--gray-text);
    font-family: 'Tajawal', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.pagination-btn:hover {
    border-color: var(--accent-blue);
    color: var(--primary-blue);
    background: rgba(43, 125, 195, 0.05);
}

.pagination-btn.active {
    background: linear-gradient(135deg, var(--primary-blue), var(--light-blue));
    color: white;
    border-color: var(--primary-blue);
    box-shadow: 0 4px 12px rgba(0, 43, 91, 0.2);
}

.pagination-btn.pagination-arrow {
    background: transparent;
    border-color: transparent;
}

.pagination-btn.pagination-arrow:hover {
    background: rgba(43, 125, 195, 0.05);
    border-color: var(--light-gray);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================
   حالة فارغة
   ============================================ */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    background: var(--white);
    border-radius: var(--border-radius);
    border: 2px dashed var(--light-gray);
}

.empty-state i { font-size: 3rem; color: var(--light-gray); margin-bottom: 16px; display: block; }
.empty-state h3 { color: var(--primary-blue); font-size: 1.3rem; margin-bottom: 8px; }
.empty-state p { color: var(--gray-text); font-size: 0.9rem; opacity: 0.7; }

/* ============================================
   التجاوب
   ============================================ */
@media (max-width: 1024px) {
    .articles-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}

@media (max-width: 768px) {
    .main-content { padding: 35px 0 45px; }
    .categories-wrapper { margin-bottom: 30px; padding: 0 5px; }
    .categories-tabs { border-radius: 30px; padding: 6px 10px; gap: 6px; flex-wrap: nowrap; justify-content: flex-start; }
    .category-tab { padding: 7px 14px; font-size: 0.8rem; min-height: 36px; gap: 5px; }
    .category-tab i { font-size: 0.85rem; }
    .category-tab .tab-count { font-size: 0.55rem; padding: 1px 7px; min-width: 18px; height: 18px; }
    .articles-grid { gap: 16px; }
    .article-content { padding: 12px 16px 14px; }
    .article-title { font-size: 0.92rem; }
    .article-excerpt { font-size: 0.78rem; }
    .article-overlay-meta { padding: 16px 12px 10px; }
    .article-overlay-meta .meta-item { font-size: 0.65rem; }
    .read-more { font-size: 0.75rem; }
    .pagination-btn { min-width: 36px; height: 36px; font-size: 0.8rem; }
}

@media (max-width: 550px) {
    .categories-tabs { border-radius: 20px; padding: 4px 8px; gap: 4px; }
    .category-tab { padding: 5px 10px; font-size: 0.7rem; min-height: 30px; gap: 4px; }
    .category-tab i { font-size: 0.7rem; }
    .category-tab .tab-count { font-size: 0.5rem; padding: 1px 5px; min-width: 16px; height: 16px; }
    .category-tab.active::after { display: none; }
    .articles-grid { grid-template-columns: 1fr; gap: 14px; }
    .article-card { border-radius: 14px; }
    .article-content { padding: 10px 14px 12px; }
    .article-title { font-size: 0.85rem; }
    .article-excerpt { font-size: 0.75rem; }
    .article-overlay-meta { padding: 14px 10px 8px; gap: 6px; }
    .article-overlay-meta .meta-item { font-size: 0.6rem; }
    .article-overlay-meta .meta-divider { width: 2px; height: 2px; }
    .article-overlay-meta .meta-author .author-avatar { width: 18px; height: 18px; font-size: 0.5rem; }
    .read-more { font-size: 0.7rem; }
    .article-category-badge { font-size: 0.6rem; padding: 3px 10px; top: 8px; right: 8px; }
    .article-featured-badge { font-size: 0.55rem; padding: 3px 8px; top: 8px; left: 8px; }
    .pagination-container { gap: 4px; }
    .pagination-btn { min-width: 32px; height: 32px; font-size: 0.75rem; padding: 0 8px; border-radius: 8px; }
}

@media (max-width: 400px) {
    .category-tab { padding: 4px 8px; font-size: 0.65rem; min-height: 26px; }
    .articles-grid { gap: 12px; }
    .article-content { padding: 8px 12px 10px; }
    .article-title { font-size: 0.78rem; }
    .article-excerpt { font-size: 0.7rem; }
    .article-overlay-meta .meta-item { font-size: 0.55rem; }
    .read-more { font-size: 0.65rem; }
    .pagination-btn { min-width: 28px; height: 28px; font-size: 0.7rem; border-radius: 6px; }
}

html { scroll-behavior: smooth; }

/* ============================================
   تنسيقات التجاوب للقسم الجديد (منقولة من الصفحة الرئيسية)
   ============================================ */
@media (max-width: 400px) {
    .articles-hero { min-height: 28vh; padding: 40px 8px 22px; }
    .hero-icon { width: 50px; height: 50px; font-size: 1.3rem; }
    .hero-title { font-size: 1.2rem; }
    .hero-subtitle { font-size: 0.78rem; }
    .section-header .section-title { font-size: 1.1rem; }
}

/* === تنسيقات القسم الجديد في الهيرو === */
.articles-hero .section-header .section-title { color: #ffffff; }
.articles-hero .section-header .section-title .highlight { color: #f59e0b; }
.articles-hero .section-header .section-title .highlight::after { background: linear-gradient(90deg, #f59e0b, rgba(245, 158, 11, 0.2)); }
.articles-hero .section-header .section-title-decoration { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5)); }
.articles-hero .section-header .section-title-decoration .dot { background: #ffffff; box-shadow: 0 0 12px rgba(255, 255, 255, 0.4); }
.articles-hero .section-header .title-underline .line-main { background: linear-gradient(90deg, transparent, #ffffff); }
.articles-hero .section-header .title-underline .line-secondary { background: linear-gradient(90deg, #ffffff, transparent); }
.articles-hero .section-header .title-underline .line-dot { background: #ffffff; box-shadow: 0 0 20px rgba(255, 255, 255, 0.5); }
.articles-hero .section-header .section-subtitle { color: rgba(255, 255, 255, 0.85); }
.articles-hero .categories-wrapper { margin-top: 30px; margin-bottom: 0; }
.articles-hero .categories-tabs { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.articles-hero .category-tab { color: rgba(255, 255, 255, 0.9); }
.articles-hero .category-tab i { color: #f59e0b; }
.articles-hero .category-tab:hover { background: rgba(255, 255, 255, 0.2); color: #ffffff; }
.articles-hero .category-tab.active { background: #f59e0b; color: #002B5B; }
.articles-hero .category-tab.active i { color: #002B5B; }
