{% extends "main.html" %}
{% block content %}
<style>
    .search-container {
        position: relative;
        border-radius: 1000px;
        padding: 10px;
        display: grid;
        place-content: center;
        z-index: 0;
        max-width: 600px;
        width: 90%;
        margin: 10px auto -20px auto;
    }

    .search-search-container {
        position: relative;
        width: 100%;
        border-radius: 50px;
        background: linear-gradient(to right, #5b0fb886, #1f65d686);
        padding: 5px;
        display: flex;
        align-items: center;
    }

    .search-search-container::after, .search-search-container::before {
        content: "";
        width: 100%;
        height: 100%;
        border-radius: inherit;
        position: absolute;
    }

    .search-search-container::before {
        top: -1px;
        left: -1px;
        background: linear-gradient(to right, #5b0fb886, #1f65d686);
        z-index: -1;
    }

    .search-search-container::after {
        bottom: -1px;
        right: -1px;
        background: linear-gradient(to right, #5b0fb886, #1f65d686);
        box-shadow: rgba(79, 156, 232, 0.1) 3px 3px 5px 0px, rgba(79, 156, 232, 0.1) 5px 5px 20px 0px;
        z-index: -2;
    }

    .input {
        padding: 10px;
        width: 100%;
        background: linear-gradient(135deg, rgba(218, 232, 247, 0.1) 0%, rgba(214, 229, 247, 0.1) 100%);
        border: none;
        color: #9EBCD9;
        font-size: 20px;
        border-radius: 50px;
        margin: 0px 5px;
    }

    .input:focus {
        outline: none;
        background: linear-gradient(135deg, hsla(210, 100%, 97%, 0.1) 0%, hsla(214, 229, 247, 0.1) 100%);
    }

    .search__icon {
        width: 50px;
        aspect-ratio: 1;
        border-left: 2px solid white;
        border-top: 3px solid transparent;
        border-bottom: 3px solid transparent;
        border-radius: 50%;
        padding-left: 12px;
        margin-right: 10px;
        cursor: pointer;
    }

    .search__icon:hover {
        border-left: 3px solid white;
    }

    .search__icon path {
        fill: white;
    }

    .search-button {
        border: none;
        background: none;
        padding: 0;
        cursor: pointer;
    }
</style>
<div class="search-container">
    <form method="PUT" action="{{ url_for('search')}}" class="search-search-container">
        <input class="input" type="text" name="searched" placeholder="Search...">
        <button type="submit" class="search-button">
            <svg viewBox="0 0 24 24" class="search__icon">
                <g>
                    <path d="M21.53 20.47l-3.66-3.66C19.195 15.24 20 13.214 20 11c0-4.97-4.03-9-9-9s-9 4.03-9 9 4.03 9 9 9c2.215 0 4.24-.804 5.808-2.13l3.66 3.66c.147.146.34.22.53.22s.385-.073.53-.22c.295-.293.295-.767.002-1.06zM3.5 11c0-4.135 3.365-7.5 7.5-7.5s7.5 3.365 7.5 7.5-3.365 7.5-7.5 7.5-7.5-3.365-7.5-7.5z">
                    </path>
                </g>
            </svg>
        </button>
    </form>
</div>
<main class="main">
    <div class="card-container">
        {% for post in post_data %}
            <div class="card">
                <img src="{{ url_for('static', filename=post['image_location']) }}" alt="Post Image">
                <h3>{{ post['title'] }}</h3>
                <div class="date">{{ post['date'] }}</div>
                <p>{{ post['content'] }}</p>
                <p class="topics">
                    {% for topic in post['topics'] %}
                        <span class="topic">{{ topic }}</span>
                    {% endfor %}
                </p>
                <a href="{{ url_for('post', slug=post['slug']) }}">Read More</a>
            </div>
        {% endfor %}
    </div>
</main>
{% endblock %}
