<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>猫咪信息查询结果</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            font-size: 1rem;
            margin: 0;
            padding: 0;
        }

        h2 {
            text-align: center;
            color: #333;
            margin: 20px 0;
            font-size: 1.5rem;
        }

        form {
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            max-width: 90%;
            margin: 20px auto;
            text-align: center;
            margin-bottom: 10px;
        }

        label {
            display: block;
            font-weight: bold;
            margin-bottom: 10px;
        }

        input[type="text"] {
            width: 90%;
            padding: 8px;
            border: 1px solid #ccc;
            border-radius: 4px;
            margin-bottom: 20px;
            max-width: 400px;
        }

        input[type="submit"] {
            background-color: #4CAF50;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.3s ease;
            max-width: 100px;
        }

        input[type="submit"]:hover {
            background-color: #45a049;
        }

        .cat-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background-color: white;
            padding: 15px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            margin: 10px auto;
            max-width: 90%;
        }

        .cat-image {
            height: 180px;
            width: auto;
            max-width: 100%;
            border-radius: 4px;
            margin-bottom: 10px;
        }

        .cat-info {
            flex-grow: 1;
            text-align: center;
            margin-bottom: 5px;
        }

        h3 {
            color: #333;
            margin-bottom: 5px;
        }

        p {
            color: #666;
            margin-bottom: 5px;
        }

        @media (min-width: 600px) {
            .cat-item {
                flex-direction: row;
                align-items: flex-start;
            }

            .cat-image {
                margin-right: 15px;
                margin-bottom: 5px;
            }

            .cat-info {
                text-align: left;
            }
        }
    </style>
</head>

<body>
    <h2>猫咪信息查询</h2>
    <form method="post" action="/catinfo/search/">
        <label for="keyword">关键词：</label>
        <input type="text" id="keyword" name="keyword" required>
        <input type="submit" value="查询">
    </form>

    {% if cat_list %}
        {% for cat in cat_list %}
            <div class="cat-item">
                <img class="cat-image" src="{{ cat.cover }}" alt="{{ cat.title }}">
                <div class="cat-info">
                    <h3>{{ cat.title }}</h3>
                    <p>年龄：{{ cat.age }}，性别：{{ cat.sex }}</p>
                    <p>疫苗：{{ cat.vaccine }}，绝育：{{ cat.sterilize }}，驱虫：{{ cat.expelling_parasite }}</p>
                    <p><a href="{{ cat.link }}">查看详情</a></p>
                </div>
            </div>
            <br>
        {% endfor %}
    {% else %}
        <p style="color: #999; text-align: center;">没有找到相关猫咪信息。</p>
    {% endif %}
</body>

</html>
美化上面的网页，减小cati-item之间的间距并使之适配手机浏览器，并且使cat-item里面的元素向中间靠拢