/* =========================================
   تنسيقات صفحة الأخبار (news.css)
   ========================================= */

/* --- 1. شريط الأدوات (بحث + تصنيفات) --- */
.news-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* أزرار الفلترة */
.categories-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cat-btn {
    padding: 8px 20px;
    border: 1px solid #ddd;
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    color: #555;
    transition: all 0.3s;
}

.cat-btn.active, .cat-btn:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* مربع البحث */
.news-search {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 25px;
    padding: 5px 15px;
    border: 1px solid #eee;
    flex-grow: 1;
    max-width: 300px;
}

.news-search input {
    border: none;
    background: transparent;
    padding: 8px;
    width: 100%;
    outline: none;
    font-family: 'Cairo', sans-serif;
}

.news-search button {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
}

/* --- 2. شبكة الأخبار (Grid View) --- */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.news-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.news-img-wrapper {
    height: 220px;
    overflow: hidden;
    position: relative;
}

.news-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.news-card:hover .news-img-wrapper img {
    transform: scale(1.1);
}

.category-tag {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--secondary-color);
    color: #fff;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
}

.news-content {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.news-date {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 10px;
    display: block;
}

.news-content h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    line-height: 1.5;
    color: var(--text-dark);
}

.read-more {
    margin-top: auto;
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    font-family: 'Cairo', sans-serif;
}

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

/* --- 3. صفحة التفاصيل (Single View) --- */

.btn-back {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 20px;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    transition: 0.3s;
}

.btn-back:hover {
    background: var(--primary-color);
    color: #fff;
}

.single-news-article {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

/* هيرو الخبر (الصورة الكبيرة) */
.news-hero-image {
    width: 100%;
    height: 450px; /* ارتفاع كبير للصورة الرئيسية */
    position: relative;
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s ease-in-out;
}

.news-hero-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
}

.news-hero-content {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    padding: 40px;
    color: #fff;
    z-index: 2;
}

.news-hero-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 10px 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.news-hero-content .badge {
    background: var(--secondary-color);
    color: #fff;
    padding: 5px 15px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.news-hero-content .meta {
    display: flex;
    gap: 20px;
    font-size: 0.95rem;
    opacity: 0.9;
}

.article-content-wrapper {
    padding: 40px;
}

.article-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #444;
    margin-bottom: 40px;
}

/* --- 4. معرض الصور الإضافية --- */
.gallery-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.gallery-section h3 {
    margin-bottom: 20px;
    border-right: 4px solid var(--secondary-color);
    padding-right: 15px;
    font-size: 1.5rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.gallery-item {
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: 0.3s;
    position: relative;
}

/* تأثير عند المرور أو التفعيل */
.gallery-item:hover, 
.gallery-item.active {
    border-color: var(--secondary-color);
    transform: scale(1.02);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- 5. التجاوب (Responsive) --- */
@media (max-width: 768px) {
    .news-hero-image {
        height: 280px;
    }
    
    .news-hero-content h1 {
        font-size: 1.5rem;
    }
    
    .article-content-wrapper {
        padding: 20px;
    }
    
    .news-search {
        max-width: 100%;
        order: -1; /* يظهر مربع البحث في الأعلى في الموبايل */
        margin-bottom: 10px;
    }
    
    .news-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* =========================================
   إصلاح مشكلة حقل التاريخ المعكوس في المتصفحات
   ========================================= */
input[type="date"] {
    direction: ltr; /* إجبار المتصفح على قراءة الفورمات بشكل صحيح (dd/mm/yyyy) */
    text-align: right; /* الحفاظ على محاذاة النص لليمين ليناسب اللغة العربية */
    font-family: inherit;
}

/* تعديل مكان أيقونة التقويم لتكون متناسقة */
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    margin-right: 10px;
}