<?php
require __DIR__ . '/config.php';
require_existing_admin();

$surveyUrl = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http')
    . '://' . ($_SERVER['HTTP_HOST'] ?? 'localhost')
    . rtrim(dirname($_SERVER['SCRIPT_NAME'] ?? '/avia-feedback/admin.php'), '/.')
    . '/index.php';
?>
<!doctype html>
<html lang="hr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Avia administracija</title>
<link rel="stylesheet" href="style.css">
</head>
<body class="admin-body">
<main class="admin-shell admin-home-shell">
    <header class="admin-topbar">
        <div>
            <div class="brand">AVIA</div>
            <h1>Administracija</h1>
            <p>Upravljanje anketama i recenzijama kupaca</p>
        </div>
    </header>

    <section class="admin-home-grid">
        <a class="admin-module-card" href="reviews-admin.php">
            <div class="admin-module-icon">★</div>
            <div>
                <span class="admin-module-kicker">Customer feedback</span>
                <h2>Recenzije kupaca</h2>
                <p>Pregledaj ocjene, komentare, poslovnice i djelatnike te izvezi rezultate u Excel.</p>
            </div>
            <span class="admin-module-arrow">→</span>
        </a>

        <a class="admin-module-card secondary-module" href="index.php" target="_blank" rel="noopener">
            <div class="admin-module-icon">↗</div>
            <div>
                <span class="admin-module-kicker">Public survey</span>
                <h2>Otvori anketu</h2>
                <p>Otvori javnu stranicu koju dobiva stranka nakon najma vozila.</p>
            </div>
            <span class="admin-module-arrow">→</span>
        </a>
    </section>

    <section class="admin-panel static-link-panel admin-home-link">
        <div class="panel-title">
            <div>
                <h2>Stalni link za stranke</h2>
                <p>Ovaj link možeš zalijepiti u postojeći sustav za automatsko slanje ankete.</p>
            </div>
        </div>
        <div class="permanent-link"><code><?= e($surveyUrl) ?></code></div>
    </section>
</main>
</body>
</html>
