<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Add Recipe</title>
    <script src="addRecipe.js" defer></script>

    <style>
      html {
        font-family: -apple-system, BlinkMacSystemFont, "San Francisco",
          "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
      }
    </style>
  </head>
  <body>
    <main class="container">
      <h1>Add a New Recipe</h1>

      <label for="title">Recipe Title</label>
      <input type="text" id="title" placeholder="e.g. Grandma's Apple Pie" />

      <label for="recipe">Recipe Instructions</label>
      <textarea
        id="recipe"
        placeholder="Write your recipe here… You can use markdown!"
      ></textarea>

      <div class="button-group">
        <button id="saveBtn" onclick="saveRecipe()">Save Recipe</button>
        <a href="/" class="back-btn">Back to Recipes</a>
      </div>
    </main>
  </body>
</html>

<style>
  /* Reset basic styles */
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  body {
    background-color: #f5f5f7;
    color: #1d1d1f;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
  }

  .container {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 600px;
  }

  h1 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    text-align: center;
  }

  label {
    display: block;
    margin-top: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
  }

  input[type="text"],
  textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d1d6;
    border-radius: 12px;
    background-color: #f9f9fa;
    font-size: 1rem;
    transition: border 0.2s ease;
  }

  input[type="text"]:focus,
  textarea:focus {
    border-color: #007aff;
    outline: none;
    background-color: #fff;
  }

  textarea {
    resize: vertical;
    min-height: 150px;
  }

  .button-group {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
  }

  button,
  .back-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    text-align: center;
  }

  button#saveBtn {
    background-color: #007aff;
    color: white;
  }

  button#saveBtn:hover {
    background-color: #005ecb;
  }

  .back-btn {
    background-color: #e5e5ea;
    color: #1d1d1f;
  }

  .back-btn:hover {
    background-color: #d1d1d6;
  }
</style>
