@php
     $news = \App\Models\NewsEvent::first();
    $individualNews = \App\Models\NewEventContain::take($home->news_count)->get();
@endphp
<div class="news-section">
    <div class="news-title">
        <h2>{{ $news->main_title }}</h2>
    </div>
    <div class="news-grid">
        @foreach($individualNews as $i => $news)
            <div class="news-card news-card-{{ $i+1 }}">
                <div class="news-image" style="background-image: url('{{ asset('storage/' . $news->image) }}');"></div>
                <div class="news-overlay"></div>
                <div class="news-content">
                    <h3>{{ $news->title }}</h3>
                    <div class="news-card-footer">
                        <a href="{{ route('individualNews', $news->id) }}" class="news-readmore-btn">READ MORE</a>
                        <a href="{{ route('individualNews', $news->id) }}" class="news-arrow-btn" aria-label="Read more">
                            <svg width="32" height="32" viewBox="0 0 32 32">
                                <circle cx="16" cy="16" r="15" fill="#fff"/>
                                <path d="M12 20 L20 12 M20 12 H13 M20 12 V19" stroke="#17486D" stroke-width="2" fill="none" stroke-linecap="round"/>
                            </svg>
                        </a>
                    </div>
                </div>
            </div>
        @endforeach
    </div>
</div>
<style>
    .news-section {
        z-index: 2;
    background: #0a4c76;
    padding: 40px 0 60px 0;
    color: #fff;
}

.news-title {
    margin-top: 5%;
    text-align: center;
    margin-bottom: 5%;
    position: relative;
}
.news-title h2 {
    color: #F6A84F;
    font-size: 2rem;
    font-weight: bold;
    display: inline-block;
    position: relative;
    letter-spacing: 2px;
}
.news-title h2::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    background: #23618a;
    border-radius: 50%;
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 160px;
    gap: 18px;
    max-width: 900px;
    margin: 0 auto;
}

.news-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    min-width: 0;
    min-height: 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

.news-image {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-size: cover;
    background-position: center;
    z-index: 1;
    filter: brightness(0.7);
}

.news-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.2) 40%, rgba(0,0,0,0.7) 100%);
    z-index: 2;
}

.news-content {
    position: relative;
    z-index: 3;
    padding: 18px 18px 16px 18px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
}

.news-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 18px;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.news-card-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
}

.news-readmore-btn {
    background: #17486D;
    color: #fff;
    padding: 12px ;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 1px;
    border: none;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-readmore-btn:hover {
    background: #F6A84F;
    color: #17486D;
}

.news-arrow-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: transparent;
    border: none;
    padding: 0;
    margin-left: 0;
    transition: box-shadow 0.2s;
}

.news-arrow-btn svg {
    display: block;
}

.news-arrow-btn:hover circle {
    fill: #F6A84F;
}
.news-arrow-btn:hover path {
    stroke: #17486D;
}

.news-card-1, .news-card-2 {
    /* grid-column: span 2; */
    grid-row: span 1;
    min-height: 140px;
}
.news-card-3, .news-card-4, .news-card-5, .news-card-6, .news-card-7 {
    grid-column: span 1;
    grid-row: span 1;
}
.news-card-4 {
    grid-row: span 2;
}
.news-card-5 {
    grid-row: span 2;
}
.news-card-6, .news-card-7 {
    grid-row: span 1;
}


    /* Enhanced responsive styles */
    @media (max-width: 1200px) {
        .news-section {
            padding: 35px 0 50px 0;
        }
        .news-title h2 {
            font-size: 1.8rem;
        }
        .news-title h2::before {
            width: 16px;
            height: 16px;
            left: -25px;
        }
        .news-grid {
            max-width: 800px;
            gap: 16px;
            grid-auto-rows: 150px;
        }
        .news-content {
            padding: 16px 16px 14px 16px;
        }
        .news-content h3 {
            font-size: 1rem;
            margin-bottom: 16px;
        }
        .news-card-footer {
            gap: 10px;
            margin-top: 16px;
        }
        .news-readmore-btn {
            padding: 10px;
            font-size: 11px;
        }
        .news-arrow-btn {
            width: 44px;
            height: 44px;
        }
    }

    @media (max-width: 992px) {
        .news-section {
            padding: 30px 0 45px 0;
        }
        .news-title h2 {
            font-size: 1.6rem;
            letter-spacing: 1.5px;
        }
        .news-title h2::before {
            width: 14px;
            height: 14px;
            left: -20px;
        }
        .news-grid {
            max-width: 700px;
            gap: 14px;
            grid-auto-rows: 140px;
        }
        .news-content {
            padding: 14px 14px 12px 14px;
        }
        .news-content h3 {
            font-size: 0.95rem;
            margin-bottom: 14px;
        }
        .news-card-footer {
            gap: 8px;
            margin-top: 14px;
        }
        .news-readmore-btn {
            padding: 9px;
            font-size: 10px;
        }
        .news-arrow-btn {
            width: 40px;
            height: 40px;
        }
    }

    @media (max-width: 900px) {
        .news-grid {
            grid-template-columns: 1fr;
            grid-auto-rows: 180px;
            max-width: 600px;
            gap: 12px;
        }
        .news-card-1, .news-card-2, .news-card-3, .news-card-4, .news-card-5, .news-card-6, .news-card-7 {
            grid-column: span 1 !important;
            grid-row: span 1 !important;
        }
        .news-content {
            padding: 16px 16px 14px 16px;
        }
        .news-content h3 {
            font-size: 1.1rem;
            margin-bottom: 16px;
        }
        .news-card-footer {
            gap: 10px;
            margin-top: 16px;
        }
        .news-readmore-btn {
            padding: 10px;
            font-size: 11px;
        }
        .news-arrow-btn {
            width: 44px;
            height: 44px;
        }
    }

    @media (max-width: 768px) {
        .news-section {
            padding: 25px 0 35px 0;
        }
        .news-title h2 {
            font-size: 1.4rem;
            letter-spacing: 1px;
        }
        .news-title h2::before {
            width: 12px;
            height: 12px;
            left: -18px;
        }
        .news-grid {
            max-width: 500px;
            grid-auto-rows: 160px;
            gap: 10px;
        }
        .news-content {
            padding: 14px 14px 12px 14px;
        }
        .news-content h3 {
            font-size: 1rem;
            margin-bottom: 14px;
        }
        .news-card-footer {
            gap: 8px;
            margin-top: 14px;
        }
        .news-readmore-btn {
            padding: 8px;
            font-size: 10px;
        }
        .news-arrow-btn {
            width: 36px;
            height: 36px;
        }
    }

    @media (max-width: 600px) {
        .news-section {
            padding: 20px 0 30px 0;
        }
        .news-title h2 {
            font-size: 1.2rem;
            letter-spacing: 0.8px;
        }
        .news-title h2::before {
            width: 10px;
            height: 10px;
            left: -15px;
        }
        .news-grid {
            max-width: 400px;
            grid-auto-rows: 140px;
            gap: 8px;
        }
        .news-content {
            padding: 12px 12px 10px 12px;
        }
        .news-content h3 {
            font-size: 0.9rem;
            margin-bottom: 12px;
        }
        .news-card-footer {
            gap: 6px;
            margin-top: 12px;
        }
        .news-readmore-btn {
            padding: 7px;
            font-size: 9px;
        }
        .news-arrow-btn {
            width: 32px;
            height: 32px;
        }
    }

    @media (max-width: 480px) {
        .news-section {
            padding: 15px 0 25px 0;
        }
        .news-title h2 {
            font-size: 1.1rem;
            letter-spacing: 0.5px;
        }
        .news-title h2::before {
            width: 8px;
            height: 8px;
            left: -12px;
        }
        .news-grid {
            max-width: 350px;
            grid-auto-rows: 120px;
            gap: 6px;
        }
        .news-content {
            padding: 10px 10px 8px 10px;
        }
        .news-content h3 {
            font-size: 0.85rem;
            margin-bottom: 10px;
        }
        .news-card-footer {
            gap: 5px;
            margin-top: 10px;
        }
        .news-readmore-btn {
            padding: 6px;
            font-size: 8px;
        }
        .news-arrow-btn {
            width: 28px;
            height: 28px;
        }
    }

    @media (max-width: 360px) {
        .news-section {
            padding: 12px 0 20px 0;
        }
        .news-title h2 {
            font-size: 1rem;
            letter-spacing: 0.3px;
        }
        .news-title h2::before {
            width: 6px;
            height: 6px;
            left: -10px;
        }
        .news-grid {
            max-width: 300px;
            grid-auto-rows: 100px;
            gap: 5px;
        }
        .news-content {
            padding: 8px 8px 6px 8px;
        }
        .news-content h3 {
            font-size: 0.8rem;
            margin-bottom: 8px;
        }
        .news-card-footer {
            gap: 4px;
            margin-top: 8px;
        }
        .news-readmore-btn {
            padding: 5px;
            font-size: 7px;
        }
        .news-arrow-btn {
            width: 24px;
            height: 24px;
        }
    }
</style>