<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    
    <!-- SEO & Meta Tags -->
    <title>Christmas Recipe Calculator</title>
    <meta name="description" content="Create and calculate holiday recipe shopping lists. Enter a recipe for one, specify your number of guests, and get a shopping list for your Christmas feast. Built with Flatlogic Generator.">
    <meta name="keywords" content="recipe calculator, Christmas recipes, holiday cooking, shopping list generator, party food calculator, festive meals, cooking for a crowd, recipe scaler, Built with Flatlogic Generator.">
    
    <!-- Open Graph / Facebook -->
    <meta property="og:type" content="website">
    <meta property="og:title" content="Christmas Recipe Calculator">
    <meta property="og:description" content="Easily calculate shopping lists for your holiday recipes.">
    <meta property="og:image" content="">

    <!-- Twitter -->
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:title" content="Christmas Recipe Calculator">
    <meta name="twitter:description" content="Easily calculate shopping lists for your holiday recipes.">
    <meta name="twitter:image" content="">

    <!-- Styles -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <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=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
    <link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">

</head>
<body>

    <div id="christmas-decorations-left">
        <img src="assets/pasted-20251130-194432-3a0cbe61.png" alt="Christmas Decorations" />
    </div>
    <div id="christmas-decorations-right">
        <img src="assets/pasted-20251130-191602-0ffc27f4.png" alt="Christmas Decorations" />
    </div>

    <div id="snow-container"></div>

    <main class="container my-5">
        <div class="text-center mb-5" style="padding-top: 20px;">
            <h1 class="display-4 mt-4">Hey, it's Christmas time!</h1>
            <p class="lead">Let's get your holiday recipes sorted.</p>
        </div>

        <div class="row g-4">
            <!-- Left Column: All Recipes -->
            <div class="col-md-6">
                <div class="d-flex justify-content-between align-items-center mb-4">
                    <h2 class="text-center mb-0">All Recipes</h2>
                    <button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#recipe-form-modal">
                        <i class="bi bi-plus-lg"></i> Add Recipe
                    </button>
                </div>
                <div class="mb-3">
                    <input type="text" id="recipe-search" class="form-control" placeholder="Search recipes...">
                </div>
                <div class="mb-3 d-flex flex-wrap gap-2" id="category-filters">
                    <button class="btn btn-secondary active" data-category="all">All</button>
                    <button class="btn btn-outline-secondary" data-category="Drinks">Drinks</button>
                    <button class="btn btn-outline-secondary" data-category="Breakfast">Breakfast</button>
                    <button class="btn btn-outline-secondary" data-category="Dinner">Dinner</button>
                    <button class="btn btn-outline-secondary" data-category="Appetizers">Appetizers</button>
                    <button class="btn btn-outline-secondary" data-category="No category">No category</button>
                </div>
                <div id="recipe-cards-container" class="row">
                    <div class="col-12">
                        <p class="text-center text-muted">Your saved recipes will appear here.</p>
                    </div>
                </div>
            </div>

            <!-- Right Column: Shopping List / Products -->
            <div class="col-md-6">
                <div class="d-flex justify-content-between align-items-center mb-4">
                    <h2 class="text-center mb-0">Shopping List</h2>
                    <div>
                        <button id="add-product-btn" class="btn btn-primary me-2" data-bs-toggle="modal" data-bs-target="#add-product-modal"><i class="bi bi-plus-lg"></i> Add Product</button>
                        <button id="print-shopping-list-btn" class="btn btn-outline-secondary btn-sm"><i class="bi bi-printer"></i> Print</button>
                    </div>
                </div>
                <div class="card shadow">
                    <div class="card-body" id="shopping-list-container">
                         <div class="text-center text-muted p-5">
                            <p>Your calculated list will appear here.</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <!-- Modal Recipe Form -->
    <div class="modal fade" id="recipe-form-modal" tabindex="-1" aria-labelledby="recipe-form-modal-label" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="recipe-form-modal-label">Add a Recipe</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="card p-4 shadow">
                        <form id="recipe-form">
                            <input type="hidden" id="recipeId">
                            <div class="mb-3">
                                <label for="recipeName" class="form-label">Recipe Name</label>
                                <input type="text" class="form-control" id="recipeName" placeholder="e.g., Gingerbread Cookies">
                            </div>
                            <div class="mb-3">
                                <label for="recipeCategory" class="form-label">Category</label>
                                <select class="form-control" id="recipeCategory">
                                    <option value="" selected disabled>Choose...</option>
                                    <option value="Drinks">Drinks</option>
                                    <option value="Breakfast">Breakfast</option>
                                    <option value="Dinner">Dinner</option>
                                    <option value="Appetizers">Appetizers</option>
                                </select>
                            </div>
                            <div class="mb-3">
                                <label for="recipeImage" class="form-label">Recipe Image</label>
                                <input type="file" class="form-control" id="recipeImage">
                            </div>
                            
                            <hr class="my-4 border-secondary">

                            <h3 class="h5 mb-3">Ingredients (for 1 person)</h3>
                            <div id="ingredients-container">
                                <!-- Ingredient rows will be injected here by JS -->
                            </div>
                            <button type="button" id="add-ingredient" class="btn btn-secondary btn-sm mt-2">+ Add Ingredient</button>
                            
                            <hr class="my-4 border-secondary">

                            <div class="row">
                                <div class="col">
                                    <div class="mb-3">
                                        <label for="guestCount" class="form-label">How many guests?</label>
                                        <input type="number" class="form-control" id="guestCount" placeholder="e.g., 8" min="1" value="1">
                                    </div>
                                </div>
                                <div class="col">
                                    <div class="mb-3">
                                        <label for="portionsPerGuest" class="form-label">Portions/guest</label>
                                        <input type="number" class="form-control" id="portionsPerGuest" placeholder="e.g., 2" min="1" value="1">
                                    </div>
                                </div>
                            </div>

                            <div class="d-grid gap-2 mt-4">
                                <button type="button" id="new-recipe-btn" class="btn btn-primary">Save Recipe</button>
                                <button type="button" id="cancel-edit-btn" class="btn btn-outline-secondary" data-bs-dismiss="modal">Cancel</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Modal Add Product -->
    <div class="modal fade" id="add-product-modal" tabindex="-1" aria-labelledby="add-product-modal-label" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="add-product-modal-label">Add a Product</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <form id="add-product-form">
                        <div class="mb-3">
                            <label for="productName" class="form-label">Product Name</label>
                            <input type="text" class="form-control" id="productName" placeholder="e.g., Milk">
                        </div>
                        <div class="row">
                            <div class="col">
                                <div class="mb-3">
                                    <label for="productQuantity" class="form-label">Quantity</label>
                                    <input type="number" class="form-control" id="productQuantity" placeholder="e.g., 1" min="1" value="1">
                                </div>
                            </div>
                            <div class="col">
                                <div class="mb-3">
                                    <label class="form-label">Unit</label>
                                    <div class="btn-group unit-selector" role="group" aria-label="Unit selector">
                                        <button type="button" class="btn btn-secondary unit-btn">g</button>
                                        <button type="button" class="btn btn-outline-secondary unit-btn">kg</button>
                                        <button type="button" class="btn btn-outline-secondary unit-btn">ml</button>
                                        <button type="button" class="btn btn-outline-secondary unit-btn">l</button>
                                        <button type="button" class="btn btn-outline-secondary unit-btn">piece</button>
                                        <button type="button" class="btn btn-outline-secondary unit-btn">pack</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="mb-3" id="product-category-wrapper" style="display: none;">
                            <label for="productCategory" class="form-label">Category</label>
                            <select class="form-select" id="productCategory">
                                <option selected>Choose...</option>
                                <option value="Tableware and consumables">Tableware and consumables</option>
                                <option value="Cooking and serving">Cooking and serving</option>
                            </select>
                        </div>
                        <div class="d-grid gap-2 mt-4">
                            <button type="submit" class="btn btn-primary">Add Product</button>
                            <button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Cancel</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!-- Modal View Recipe -->
    <div class="modal fade" id="view-recipe-modal" tabindex="-1" aria-labelledby="view-recipe-modal-label" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="view-recipe-modal-label">View Recipe</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <h2 id="view-recipe-name"></h2>
                    <p><strong>Category:</strong> <span id="view-recipe-category"></span></p>
                    <p><strong>Serves:</strong> <span id="view-recipe-guests"></span></p>
                    <hr>
                    <h3>Ingredients</h3>
                    <ul id="view-recipe-ingredients" class="list-group">
                    </ul>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>

    <footer class="text-center py-4 mt-5">
        <p class="mb-0">&copy; <?php echo date("Y"); ?> Christmas Recipe Calculator. Happy Holidays!</p>
    </footer>

    <!-- Scripts -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js?v=1700253313"></script>

<!-- Confirmation Modal -->
<div class="modal fade" id="confirmRemoveModal" tabindex="-1" aria-labelledby="confirmRemoveModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="confirmRemoveModalLabel">Confirm Removal</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        <p>You are about to remove an ingredient from a recipe. This will affect the recipe itself. Are you sure you want to continue?</p>
        <p><strong>Recipe:</strong> <span id="modal-recipe-name"></span></p>
        <p><strong>Ingredient:</strong> <span id="modal-ingredient-name"></span></p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
        <button type="button" class="btn btn-danger" id="confirm-remove-btn">Remove</button>
      </div>
    </div>
  </div>
</div>

</body>
</html>