/**
 * Home Layouts Styles - تصميم موحد ومنظم
 * @package Lahzat_News
 * @version 3.0
 */

/* Container */
.home-layouts {
    margin: 30px 0;
    padding: 0 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Simple Visual Touch - لمسة بصرية بسيطة */
.news-card,
.featured-card,
.mixed-layout .main-article,
.mixed-layout .sidebar-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.news-card::before,
.featured-card::before,
.mixed-layout .main-article::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #007bff, #28a745);
    z-index: 1;
    border-radius: 8px 8px 0 0;
}

.news-card::after,
.featured-card::after,
.mixed-layout .main-article::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 0 2px #fff;
}

.news-card:hover,
.featured-card:hover,
.mixed-layout .main-article:hover,
.mixed-layout .sidebar-card:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.card-content h3 a,
.featured-content h3 a,
.article-content h3 a {
    color: #333;
    text-decoration: none;
}

.card-content h3 a:hover,
.featured-content h3 a:hover,
.article-content h3 a:hover {
    color: #007bff;
}

/* Layout Base */
.home-layout {
    margin-bottom: 40px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    position: relative;
}

.home-layout::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #007bff, #28a745, #ffc107, #dc3545);
    z-index: 1;
}

.home-layout:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Layout Header */
.layout-header {
    padding: 25px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.layout-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    z-index: 1;
}

.layout-header .layout-title,
.layout-header .title-lines {
    position: relative;
    z-index: 2;
}

.layout-title {
    margin: 0 0 15px 0;
    font-size: 24px; /* Increased font size */
    font-weight: 700; /* Increased font weight */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    line-height: 1.4;
    height: 40px; /* Fixed height 40px */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    display: flex;
    align-items: center;
    gap: 8px; /* مسافة بين الأيقونة والنص */
}

.layout-title::before {
    content: '';
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.title-lines {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.red-line, .blue-line, .green-line {
    height: 3px;
    border-radius: 2px;
}

.red-line {
    background: #ff6b6b;
    width: 60px;
}

.blue-line {
    background: #4ecdc4;
    width: 40px;
}

.green-line {
    background: #45b7d1;
    width: 60px;
}

/* Layout Content */
.layout-content {
    padding: 30px;
}

/* Layout Footer */
.layout-footer {
    padding: 20px 30px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.more-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    padding: 10px 20px;
    border: 2px solid #667eea;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.more-link:hover {
    background: #667eea;
    color: white;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* =====================================
   تخطيط الشبكة الموحد
   ===================================== */
.news-grid {
    display: grid;
    gap: 25px;
    margin-bottom: 20px;
}

.news-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
    border: 1px solid #f0f0f0;
}

.news-card:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
}

.card-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


.card-content {
    padding: 20px;
}

.card-title {
    margin: 0 0 12px 0;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.9em;
}

.card-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.card-title a:hover {
    color: #667eea;
}

.card-meta {
    margin-bottom: 10px;
}

.post-date {
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    background: linear-gradient(135deg, #007bff, #28a745);
    padding: 6px 12px;
    border-radius: 15px;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.post-date::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.post-date:hover::before {
    left: 100%;
}

/* تواريخ أخرى */
.overlay-date,
.main-date,
.mixed-date,
.mixed-secondary-date {
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    background: linear-gradient(135deg, #007bff, #28a745);
    padding: 6px 12px;
    border-radius: 15px;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.overlay-date::before,
.main-date::before,
.mixed-date::before,
.mixed-secondary-date::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.overlay-date:hover::before,
.main-date:hover::before,
.mixed-date:hover::before,
.mixed-secondary-date:hover::before {
    left: 100%;
}

.card-excerpt {
    margin-top: 10px;
}

.card-excerpt p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =====================================
   تخطيط المقالان المميزان
   ===================================== */
.featured-2-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

.featured-article {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.featured-article:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.featured-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/10;
}

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

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

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 20px;
    color: white;
}

.overlay-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    line-height: 1.3;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.overlay-title a {
    color: white;
    text-decoration: none;
}

.overlay-date {
    font-size: 13px;
    opacity: 0.9;
}

.featured-excerpt {
    padding: 20px;
}

.featured-excerpt p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =====================================
   تخطيط المقال الواحد المميز
   ===================================== */
.featured-1-layout {
    margin-bottom: 20px;
}

.main-featured-article {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.main-featured-article:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.main-featured-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 21/9;
}

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

.main-featured-article:hover .main-featured-image img {
    transform: scale(1.05);
}

.main-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 30px;
    color: white;
}

.main-title {
    margin: 0 0 10px 0;
    font-size: 24px;
    line-height: 1.3;
    font-weight: 700;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.2em;
}

.main-title a {
    color: white;
    text-decoration: none;
}

.main-date {
    font-size: 14px;
    opacity: 0.9;
}

.main-excerpt {
    padding: 25px;
}

.main-excerpt p {
    margin: 0;
    color: #666;
    font-size: 16px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =====================================
   التخطيط المختلط
   ===================================== */
.mixed-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

.mixed-main {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.mixed-main:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.mixed-main-article {
    height: 100%;
}

.mixed-main-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/10;
}

.mixed-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mixed-main:hover .mixed-main-image img {
    transform: scale(1.05);
}

.mixed-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 25px;
    color: white;
}

.mixed-main-title {
    margin: 0 0 8px 0;
    font-size: 20px;
    line-height: 1.3;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.mixed-main-title a {
    color: white;
    text-decoration: none;
}

.mixed-date {
    font-size: 13px;
    opacity: 0.9;
}

.mixed-secondary {
    display: flex;
    flex-direction: column;
}

.mixed-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mixed-secondary-article {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    gap: 15px;
    padding: 15px;
}

.mixed-secondary-article:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.mixed-secondary-image {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
}

.mixed-secondary-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mixed-secondary-article:hover .mixed-secondary-image img {
    transform: scale(1.05);
}

.mixed-secondary-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mixed-secondary-title {
    margin: 0 0 5px 0;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.mixed-secondary-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.mixed-secondary-title a:hover {
    color: #667eea;
}

.mixed-secondary-date {
    font-size: 12px;
    color: #666;
}

/* =====================================
   Responsive Design
   ===================================== */
@media (max-width: 1200px) {
    .home-layouts {
        padding: 0 15px;
    }
    
    .mixed-layout {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .mixed-secondary {
        order: -1;
    }
}

@media (max-width: 768px) {
    .home-layouts {
        padding: 0 10px;
    }
    
    .layout-content {
        padding: 20px;
    }
    
    .news-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    
    .featured-2-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .mixed-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .mixed-grid {
        gap: 12px;
    }
    
    .mixed-secondary-article {
        padding: 12px;
        gap: 12px;
    }
    
    .mixed-secondary-image {
        width: 60px;
        height: 45px;
    }
    
    .layout-title {
        font-size: 20px;
    }
    
    .main-title {
        font-size: 20px;
    }
    
    .overlay-title {
        font-size: 16px;
    }
    
    .mixed-main-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .layout-header {
        padding: 20px 15px;
    }
    
    .layout-content {
        padding: 15px;
    }
    
    .layout-footer {
        padding: 15px;
    }
    
    .card-content {
        padding: 15px;
    }
    
    .featured-excerpt {
        padding: 15px;
    }
    
    .main-excerpt {
        padding: 20px;
    }
    
    .main-overlay {
        padding: 20px;
    }
    
    .mixed-overlay {
        padding: 20px;
    }
}

/* تطبيق إعدادات الموبايل للأقسام - جميع الشاشات */
.home-layout.mobile-single .layout-content {
    grid-template-columns: 1fr !important;
}

.home-layout.mobile-double .layout-content {
    grid-template-columns: repeat(2, 1fr) !important;
}

.home-layout.mobile-auto .layout-content {
    /* تلقائي حسب حجم الشاشة - سيتم تطبيقه بواسطة JavaScript */
    transition: grid-template-columns 0.3s ease;
}

@media (max-width: 768px) {
    /* عرض موبايل خاص - مقال أو مقالين */
    .mobile-single-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .mobile-double-layout {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    /* تطبيق إعدادات الموبايل للأقسام */
    .home-layout.mobile-single .layout-content {
        grid-template-columns: 1fr !important;
    }
    
    .home-layout.mobile-double .layout-content {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .home-layout.mobile-auto .layout-content {
        /* تلقائي حسب حجم الشاشة - سيتم تطبيقه بواسطة JavaScript */
        transition: grid-template-columns 0.3s ease;
    }
}