@extends('layouts.app')
@section('content')
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Daftar Blog</title>
    <!-- Load Bootstrap CSS and Font Awesome -->
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet">
    <style>
        body {
            font-family: Roboto;
            background-color: #f8f9fa;
            color: #333;
        }

        .container {
            max-width: 800px;
            margin: 0 auto;
        }

        .blog-title {
            font-size: 24px;
            font-weight: bold;
            color: #333;
        }

        .blog-author {
            font-size: 16px;
            color: #666;
            margin-bottom: 5px;
        }

        .btn-new-blog {
            margin-bottom: 20px;
            background-color: #7AB2B2
        }

        .list-group-item {
            border: 1px solid #ccc;
            border-radius: 5px;
            margin-bottom: 10px;
            padding: 15px;
            position: relative;
            transition: background-color 0.3s ease; /* Efek hover */
        }

        .list-group-item:last-child {
            border-bottom: none;
        }

        .list-group-item:hover {
            background-color: #f0f0f0; /* Ubah warna latar belakang saat hover */
        }

        .list-group-item a {
            text-decoration: none;
            color: #333;
            font-weight: bold;
            font-size: 18px;
        }

        .list-group-item a:hover {
            color: #7AB2B2;
        }

        .blog-image {
            width: 100px;
            height: auto;
            margin-right: 15px;
            border-radius: 5px;
        }

        .action-buttons {
            position: absolute;
            top: 50%;
            right: 10px;
            transform: translateY(-50%);
        }

        /* Animasi */
        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(-10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
    </style>
</head>
<body>
    <div class="container mt-5">
        <h1 class="text-center mb-4">Katalog</h1>
        <div class="text-right mb-3">
            <a href="{{ route('blogs.create') }}" class="btn btn-primary btn-new-blog">
                <i class="fas fa-plus"></i> Buat Katalog Baru
            </a>
        </div>
        <ul class="list-group">
            @foreach($blogs as $blog)
                <li class="list-group-item" style="animation: fadeIn 0.5s ease;">
                    <div class="d-flex align-items-center">
                        @if($blog->image)
                            <img src="{{ asset('images/' . $blog->image) }}" alt="{{ $blog->title }}" class="blog-image">
                        @endif
                        <div class="blog-info">
                            <span class="blog-title"><a href="{{ route('blog.show', $blog->id) }}"><i class="fas fa-book"></i> {{ $blog->title }}</a></span><br>
                            <span class="blog-author"><i class="fas fa-user"></i> Penulis: {{ $blog->author }}</span>
                        </div>
                    </div>
                </li>
            @endforeach
        </ul>
        <a href="{{ route('home') }}" class="btn btn-back">
            <i class="fas fa-arrow-left"></i> Kembali ke Halaman Utama
        </a>
    </div>
</body>
</html>
@endsection
