<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>cs-banana.shop</title>
    <link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Roboto+Mono:wght@300;400;700&display=swap" rel="stylesheet">
    <style>
        body {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            margin: 0;
            background-color: #000;
            font-family: 'Orbitron', sans-serif;
            color: #9370DB;
            transition: background-color 0.5s ease, color 0.5s ease;
            animation: shimmer 5s infinite alternate;
        }

        @keyframes shimmer {
            0% {
                color: #FF00FF;
            }
            50% {
                color: #800080;
            }
            100% {
                color: #FF00FF;
            }
        }

        .header {
            width: 100%;
            position: fixed;
            top: 0;
            left: 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px;
            background-color: rgba(0, 0, 0, 0.9);
            z-index: 1000;
            transition: background-color 0.5s ease, color 0.5s ease;
        }

        .graffiti {
            font-size: 60px;
            font-weight: bold;
            text-shadow:
                2px 2px 0 #ff0000,
                -2px -2px 0 #00ff00,
                2px -2px 0 #0000ff,
                -2px 2px 0 #ffff00;
            animation: gradient 3s infinite alternate;
        }

        @keyframes gradient {
            0% {
                text-shadow:
                    2px 2px 0 #ff0000,
                    -2px -2px 0 #00ff00,
                    2px -2px 0 #0000ff,
                    -2px 2px 0 #ffff00;
            }
            100% {
                text-shadow:
                    2px 2px 0 #00ff00,
                    -2px -2px 0 #ffff00,
                    2px -2px 0 #ff0000,
                    -2px 2px 0 #0000ff;
            }
        }

        .toggle-button {
            padding: 10px;
            font-size: 24px;
            cursor: pointer;
            background-color: transparent;
            border: none;
            color: inherit;
            margin-left: 10px;
        }

        .link {
            font-size: 24px;
            color: inherit;
            text-decoration: none;
        }

        .nav-buttons {
            display: flex;
            gap: 20px;
        }

        .nav-button {
            font-size: 24px;
            color: inherit;
            text-decoration: none;
            cursor: pointer;
            border: 2px solid #9370DB;
            padding: 10px 20px;
            border-radius: 5px;
            transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
        }

        .nav-button:hover {
            background-color: #9370DB;
            color: #fff;
            transform: translateY(-5px);
        }

        .login-button {
            font-size: 24px;
            color: inherit;
            text-decoration: none;
            cursor: pointer;
            border: 2px solid #9370DB;
            padding: 10px 20px;
            border-radius: 5px;
            transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
            margin-left: 20px;
        }

        .login-button:hover {
            background-color: #9370DB;
            color: #fff;
            transform: translateY(-5px);
        }

        .data-container {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 20px;
            width: 90%;
            max-width: 1200px;
            padding: 20px;
            margin-top: 140px; /* Отступ сверху для десктопов */
        }

        .data-item {
            background-color: rgba(17, 17, 17, 0.9);
            border: 2px solid #9370DB;
            border-radius: 10px;
            padding: 20px;
            width: calc(100% - 40px);
            box-shadow: 0 0 20px rgba(147, 112, 219, 0.7);
            transition: transform 0.3s ease, background-color 0.3s ease, color 0.3s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
        }

        .data-item:hover {
            transform: scale(1.05);
            box-shadow: 0 0 30px rgba(147, 112, 219, 1);
        }

        .data-item h2 {
            font-size: 28px;
            margin-bottom: 20px;
            font-family: 'Roboto Mono', monospace;
        }

        .data-item p {
            font-size: 18px;
            margin: 10px 0;
            font-family: 'Roboto Mono', monospace;
        }

        .data-item img {
            max-width: 100%; /* Картинки занимают 100% ширины контейнера */
            height: auto; /* Сохраняем пропорции */
            margin: 20px 0;
            border-radius: 10px;
        }

        @media (max-width: 1024px) {
            .data-item {
                width: calc(100% - 40px);
            }
        }

        @media (max-width: 768px) {
            .data-item {
                width: calc(100% - 40px);
            }

            .header {
                flex-direction: column;
                align-items: stretch;
                padding: 10px; /* Уменьшаем отступы в шапке */
            }

            .graffiti {
                font-size: 40px; /* Уменьшаем размер шрифта */
            }

            .nav-buttons {
                display: none;
                flex-direction: column;
                width: 100%;
            }

            .nav-buttons.active {
                display: flex;
            }

            .nav-button, .login-button {
                width: 100%;
                text-align: center;
                font-size: 18px; /* Уменьшаем размер шрифта кнопок */
                padding: 8px 16px; /* Уменьшаем отступы внутри кнопок */
            }

            .menu-toggle {
                display: block;
                font-size: 24px;
                cursor: pointer;
                background-color: transparent;
                border: none;
                color: inherit;
                padding: 10px;
                margin-left: auto;
                margin-right: 20px;
            }

            .toggle-button {
                margin-left: 20px;
            }

            .data-container {
                margin-top: 180px; /* Увеличиваем отступ сверху для мобильных устройств */
            }
        }

        @media (min-width: 769px) {
            .menu-toggle {
                display: none;
            }

            .toggle-button {
                display: none;
            }

            .nav-buttons.active + .toggle-button {
                display: none;
            }
        }
    </style>
</head>
<body>
<div class="header">
    <a href="/" class="link"><div class="graffiti">cs-banana.shop</div></a>
    <button class="toggle-button" onclick="toggleMenu()">☰</button>
    <div class="nav-buttons">
        <a href="/posts" class="nav-button">News</a>
        <a href="/skins" class="nav-button">Shop</a>
        <a href="/cheatCSs" class="nav-button">Cheats</a>
        <a href="/autoisation" class="login-button" th:text="${root} ? '👨🏻‍💻' : 'Sign up'">Sign up</a>
        <button class="login-button" onclick="toggleBackground()">💡️|</button>
    </div>
</div>

<div class="data-container">
    <div th:each="post : ${posts}" class="data-item">
        <a th:href="@{/cheatCS/{id}(id=${post.id})}">
            <h2 th:text="${post.name}">Title</h2>
            <img th:if="${post.put_img1}" th:src="${post.put_img1}" alt="Image 1">
            <p th:if="${post.text1}" th:text="${post.text1}">Text 1</p>
        </a>
    </div>
</div>

<script>
    function toggleBackground() {
        const body = document.body;
        const header = document.querySelector('.header');
        const button = document.querySelector('.toggle-button');
        const items = document.querySelectorAll('.data-item');
        const navButtons = document.querySelectorAll('.nav-button');
        const forms = document.querySelectorAll('form');

        if (body.style.backgroundColor === 'black') {
            body.style.backgroundColor = 'white';
            body.style.color = 'black';
            header.style.backgroundColor = 'white';
            header.style.color = 'black';
            button.style.color = 'black';
            navButtons.forEach(navButton => {
                navButton.style.color = 'black';
                navButton.style.borderColor = 'black';
            });
            items.forEach(item => {
                item.style.backgroundColor = 'white';
                item.style.color = 'black';
                item.style.borderColor = 'black';
            });
            forms.forEach(form => {
                form.style.color = 'black';
            });
        } else {
            body.style.backgroundColor = 'black';
            body.style.color = '#FF00FF';
            header.style.backgroundColor = 'black';
            header.style.color = '#FF00FF';
            button.style.color = '#FF00FF';
            navButtons.forEach(navButton => {
                navButton.style.color = '#FF00FF';
                navButton.style.borderColor = '#FF00FF';
            });
            items.forEach(item => {
                item.style.backgroundColor = '#111';
                item.style.color = '#FF00FF';
                item.style.borderColor = '#FF00FF';
            });
            forms.forEach(form => {
                form.style.color = '#FF00FF';
            });
        }
    }

    function toggleMenu() {
        const navButtons = document.querySelector('.nav-buttons');
        navButtons.classList.toggle('active');
    }
</script>
</body>
</html>