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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">

    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="assets/css/login.css">
    <link rel="stylesheet" href="assets/css/catbar.css">
    <link rel="stylesheet" href="assets/css/compcard.css">
    <link rel="stylesheet" href="assets/css/productpage.css">
    <link rel="stylesheet" href="assets/css/productAdder.css">

    <!-- Favicon (zentral) -->
    <link rel="icon" href="assets/images/favicon.ico" sizes="any">
    <link rel="shortcut icon" href="assets/images/favicon.ico">

    <title>Geizkragen</title>

    <style>
        /* ─── Mobile tap highlight ─── */
        * { -webkit-tap-highlight-color: transparent; }

        /* ─── Safe areas (notch phones) ─── */
        .header  { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
        .footer  { padding-bottom: env(safe-area-inset-bottom); }

        /* ─── Mobile overlay ─── */
        .nav__overlay {
            position: fixed;
            inset: 0;
            z-index: 1000;
            background: rgba(0, 0, 0, 0.55);
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            visibility: hidden;
            opacity: 0;
            transition: opacity 300ms ease, visibility 0s 300ms;
        }
        .nav__overlay.is-visible {
            visibility: visible;
            opacity: 1;
            transition: opacity 300ms ease, visibility 0s 0s;
        }
    </style>
</head>
<body>

<!-- Overlay (klick = Menü schließen) -->
<div class="nav__overlay" id="nav-overlay"></div>

<header class="header" id="header">
    <nav class="nav" aria-label="Hauptnavigation">
        <a class="nav__logoLink" href="index.php">
            <img class="nav__logo" src="assets/images/logoText.png" alt="Geizkragen" width="150">
        </a>

        <!-- Desktop-Suche (zentriert, wird auf ≤900px per CSS ausgeblendet) -->
        <form class="nav__searchForm" action="index.php" method="GET" autocomplete="off">
            <div class="nav__searchField">
                <input class="nav__searchInput" type="text" id="search" name="search"
                       placeholder="Produkte suchen…" inputmode="text">
            </div>
        </form>

        <div class="nav__inner container">

            <!-- ═══ Slide-In-Menü (wird auf Mobile per JS getoggelt) ═══ -->
            <div class="nav__menu" id="nav-menu">
                <ul class="nav__list">
                    <li class="nav__item">
                        <a href="index.php" class="nav__link">Home</a>
                    </li>
                    <li class="nav__item nav__item--mobile">
                        <a href="wunschliste.php" class="nav__link">Wunschliste</a>
                    </li>
                    <li class="nav__item nav__item--mobile">
                        <a href="account.php" class="nav__link">Account</a>
                    </li>
                </ul>

                <!-- Schließen-Button -->
                <button class="nav__close" id="nav-close" type="button" aria-label="Menü schließen">
                    <svg width="24" height="24" viewBox="0 0 24 24" fill="none"
                         stroke="currentColor" stroke-width="2" stroke-linecap="round">
                        <line x1="18" y1="6" x2="6" y2="18"/>
                        <line x1="6" y1="6" x2="18" y2="18"/>
                    </svg>
                </button>
            </div>
            <!-- ═══ /Slide-In-Menü ═══ -->

            <div class="nav__actions">
                <a class="nav__login nav__wishlist" href="wunschliste.php" aria-label="Wunschliste">
                    <svg class="icon icon-user" viewBox="0 0 24 24" aria-hidden="true">
                        <path d="M16 2H8a3 3 0 0 0-3 3v16a1 1 0 0 0 .5.87a1 1 0 0 0 1 0l5.5-3.18l5.5 3.18a1 1 0 0 0 .5.13a1 1 0 0 0 .5-.13A1 1 0 0 0 19 21V5a3 3 0 0 0-3-3Zm1 17.27l-4.5-2.6a1 1 0 0 0-1 0L7 19.27V5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1Z"
                              stroke="currentColor" stroke-width="0.3" stroke-linecap="round" stroke-linejoin="round"/>
                    </svg>
                </a>
                <a class="nav__login" href="account.php" aria-label="Account">
                    <svg class="icon icon-user" viewBox="0 0 24 24" aria-hidden="true">
                        <path d="M4 22C4 17.5817 7.58172 14 12 14C16.4183 14 20 17.5817 20 22H18C18 18.6863 15.3137 16 12 16C8.68629 16 6 18.6863 6 22H4ZM12 13C8.685 13 6 10.315 6 7C6 3.685 8.685 1 12 1C15.315 1 18 3.685 18 7C18 10.315 15.315 13 12 13ZM12 11C14.21 11 16 9.21 16 7C16 4.79 14.21 3 12 3C9.79 3 8 4.79 8 7C8 9.21 9.79 11 12 11Z"/>
                    </svg>
                </a>

                <!-- Hamburger-Toggle -->
                <button class="nav__toggle" id="nav-toggle" type="button" aria-label="Menü öffnen">
                    <svg width="24" height="24" viewBox="0 0 24 24" fill="none"
                         stroke="currentColor" stroke-width="2" stroke-linecap="round">
                        <line x1="3" y1="6"  x2="21" y2="6"/>
                        <line x1="3" y1="12" x2="21" y2="12"/>
                        <line x1="3" y1="18" x2="21" y2="18"/>
                    </svg>
                </button>
            </div>
        </div>
    </nav>

    <!-- Mobile-Suchleiste (unterhalb der Nav-Zeile, nur auf ≤900px sichtbar) -->
    <form class="nav__searchBar" action="index.php" method="GET" autocomplete="off">
        <div class="nav__searchField">
            <input class="nav__searchInput" type="text" name="search"
                   placeholder="Produkte suchen…" inputmode="text">
        </div>
    </form>
</header>

<script>
(function () {
    var toggle  = document.getElementById('nav-toggle');
    var closeBtn = document.getElementById('nav-close');
    var menu    = document.getElementById('nav-menu');
    var overlay = document.getElementById('nav-overlay');
    if (!toggle || !closeBtn || !menu || !overlay) return;

    function open() {
        menu.classList.add('show-menu');
        overlay.classList.add('is-visible');
        document.body.style.overflow = 'hidden';
    }

    function close() {
        menu.classList.remove('show-menu');
        overlay.classList.remove('is-visible');
        document.body.style.overflow = '';
    }

    toggle.addEventListener('click', open);
    closeBtn.addEventListener('click', close);
    overlay.addEventListener('click', close);

    document.addEventListener('keydown', function (e) {
        if (e.key === 'Escape') close();
    });

    // Links im Menü → schließen
    var links = menu.querySelectorAll('a');
    for (var i = 0; i < links.length; i++) {
        links[i].addEventListener('click', close);
    }
})();
</script>

