<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Log Your Action - Chirivia</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
    <style>
        :root {
            --primary-green: #2E8B57;
            --secondary-blue: #4682B4;
            --accent-color: #5F9EA0;
            --background-light: #F0F8FF;
            --surface-white: #FFFFFF;
            --text-dark: #2F4F4F;
            --font-headings: 'Inter', sans-serif;
            --font-body: 'Inter', sans-serif;
            --spacing-base: 8px;
            --border-radius: 0.5rem; /* 8px */
            --danger-red: #DC3545;
            --neutral-gray: #A9A9A9;
        }

        body {
            font-family: var(--font-body);
            line-height: 1.6;
            margin: 0;
            padding: 0;
            background-color: var(--background-light);
            color: var(--text-dark);
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }
        .header {
            background: var(--surface-white);
            padding: 1rem 2rem;
            border-bottom: 1px solid #E0E0E0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .header .logo {
            font-family: var(--font-headings);
            font-size: 1.5rem;
            font-weight: bold;
            color: var(--primary-green);
            text-decoration: none;
        }
        .main {
            flex: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 2rem;
        }
        .action-container {
            background: var(--surface-white);
            padding: 2rem;
            border-radius: var(--border-radius);
            box-shadow: 0 4px 12px rgba(0,0,0,0.08);
            text-align: center;
            max-width: 500px;
            width: 100%;
        }
        h1 {
            font-family: var(--font-headings);
            color: var(--primary-green);
            margin-bottom: 1.5rem;
        }
        .message {
            font-size: 1.2rem;
            margin-bottom: 2rem;
        }
        .form-container form {
            display: flex;
            justify-content: center;
            gap: 1rem;
        }
        .btn {
            font-family: var(--font-body);
            padding: 0.75rem 1.5rem;
            border: none;
            border-radius: var(--border-radius);
            font-size: 1rem;
            cursor: pointer;
            text-decoration: none;
            display: inline-block;
            color: var(--surface-white);
        }
        .btn-yes {
            background-color: var(--primary-green);
        }
        .btn-no {
            background-color: var(--neutral-gray);
        }
        .result-message {
            margin-top: 2rem;
            font-size: 1.2rem;
            font-weight: bold;
        }
        .result-message .chick {
            font-size: 2rem;
        }
        .footer {
            text-align: center;
            padding: 1.5rem;
            background: var(--surface-white);
            border-top: 1px solid #E0E0E0;
            font-size: 0.9rem;
            color: #6c757d;
        }
    </style>
</head>
<body>

    <header class="header">
        <a href="index.php" class="logo">Chirivia</a>
    </header>

    <main class="main">
        <div class="action-container">
            <h1>Log Your Green Action</h1>
            
            <?php
            $message = '';
            if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['answer'])) {
                $answer = $_POST['answer'];
                if ($answer === 'yes') {
                    $message = '<div class="chick">🐣</div> says thank you!';
                } elseif ($answer === 'no') {
                    $message = '<div class="chick">🐣</div> says you should go do it asap!';
                }
            }
            ?>

            <?php if ($message): ?>
                <div class="result-message">
                    <?php echo $message; ?>
                    <br><br>
                    <a href="actions.php" class="btn btn-yes">Log another action</a>
                </div>
            <?php else: ?>
                <p class="message">Did you do something good for the environment today?</p>
                <div class="form-container">
                    <form method="POST" action="actions.php">
                        <button type="submit" name="answer" value="yes" class="btn btn-yes">Yes, I did!</button>
                        <button type="submit" name="answer" value="no" class="btn btn-no">Not yet</button>
                    </form>
                </div>
            <?php endif; ?>

        </div>
    </main>

    <footer class="footer">
        <p>&copy; <?php echo date("Y"); ?> Chirivia. All rights reserved. | <a href="privacy.php">Privacy Policy</a></p>
    </footer>

</body>
</html>
