<!DOCTYPE html>
<html class="no-js" lang="">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- displays site properly based on user's device -->

    <link
      rel="icon"
      type="image/png"
      sizes="32x32"
      href="./assets/images/favicon-32x32.png"
    />
    <link href="../public/out.css" rel="stylesheet" />

    <title>Frontend Mentor | Multi-step form</title>

    <!-- Feel free to remove these styles or customise in your own stylesheet 👍 -->
    <style>
      .attribution {
        font-size: 11px;
        text-align: center;
      }
      .attribution a {
        color: hsl(228, 45%, 44%);
      }
    </style>
  </head>
  <body>
    <!--[if lt IE 8]>
      <p class="browserupgrade">
        You are using an <strong>outdated</strong> browser. Please
        <a href="http://browsehappy.com/">upgrade your browser</a> to improve
        your experience.
      </p>
    <![endif]-->

    <main class="grid place-content-center h-screen">
      <form
        class="flex flex-col items-center w-screen h-screen md:grid md:items-start md:p-5 md:bg-white md:rounded-2xl md:grid-cols-[auto_1fr] md:w-desktop-form md:h-desktop-form md:drop-shadow-2xl"
        id="form-step"
        hx-post="/submit-step/4/5"
        action="/submit-step/4/5"
        hx-swap="outerHTML"
        method="post"
        th:fragment="formFragment(formData)"
      >
        <summary
          class="w-full h-44 bg-no-repeat md:row-span-2 bg-sidebar-mobile marker:text-white md:bg-sidebar-desktop md:h-[568px] md:w-[274px]"
          id="sidebar"
          th:replace="~{step1::stepsSummary (${formData})}"
        >
          <ol
            class="grid grid-cols-[repeat(4,_auto)] gap-x-5 content-center items-center place-content-center h-24 md:flex-col md:h-full md:grid-rows-[repeat(4,_auto)] md:grid-cols-1 md:content-start md:p-10 md:gap-y-7 text-white text-sm uppercase"
          >
            <li class="items-center md:grid md:gap-x-4 md:grid-cols-[auto_1fr]">
              <div
                class="grid place-content-center w-8 h-8 text-white rounded-full border border-white"
              >
                1
              </div>
              <p class="hidden md:flex md:flex-col">
                <span class="text-light-gray">Step 1</span
                ><span class="font-bold">Your info</span>
              </p>
            </li>
            <li class="items-center md:grid md:gap-x-4 md:grid-cols-[auto_1fr]">
              <div
                class="grid place-content-center w-8 h-8 text-white rounded-full border border-white"
              >
                2
              </div>
              <p class="hidden md:flex md:flex-col">
                <span class="text-light-gray">Step 2</span
                ><span class="font-bold">Select plan</span>
              </p>
            </li>
            <li class="items-center md:grid md:gap-x-4 md:grid-cols-[auto_1fr]">
              <div
                class="grid place-content-center w-8 h-8 text-white rounded-full border border-white"
              >
                3
              </div>
              <p class="hidden md:flex md:flex-col">
                <span class="text-light-gray">Step 3</span
                ><span class="font-bold">Add-ons</span>
              </p>
            </li>
            <li class="items-center md:grid md:gap-x-4 md:grid-cols-[auto_1fr]">
              <div
                class="grid place-content-center w-8 h-8 text-white rounded-full border border-white"
              >
                4
              </div>
              <p class="hidden md:flex md:flex-col">
                <span class="text-light-gray">Step 4</span
                ><span class="font-bold">summary</span>
              </p>
            </li>
          </ol>
        </summary>
        <section
          id="multipage-form-container"
          class="flex flex-col py-8 px-6 -mt-20 w-11/12 bg-white rounded-xl md:px-24 md:mt-0 md:w-full drop-shadow-xl md:drop-shadow-none"
        >
          <!-- Step 3 start -->
          <h1 class="text-2xl font-bold md:text-4xl text-marine-blue">
            Finishing up
          </h1>
          <p class="pt-3 pb-5 md:pb-8 text-cool-gray">
            Double-check everything looks OK before confirming.
          </p>
          <div
            class="flex flex-col w-full text-sm rounded-lg divide-y md:text-base bg-magnolia/75"
            id="selection-overview"
          >
            <div id="selected-plan" class="grid p-3 md:p-6 grid-cols-[1fr_auto]">
              <h2 th:text="${formData.fullPlanName}"
                  class="font-bold text-marine-blue"
              >Arcade (Monthly)</h2>
              <p
                th:text="|$${formData.selectedPlanCost}/${formData.periodCostLabel}|"
                class="row-span-2 self-end font-bold text-marine-blue"
              >
                $90/y
              </p>
              <a
                hx-post="/submit-step/4/2"
                hx-swap="outerHTML"
                hx-target="#form-step"
                href="step3.html"
                hx-params="not form-confirmed"
                class="underline text-cool-gray"
                >Change</a
              >
            </div>
            <div id="selected-addons" class="flex flex-col gap-y-4 p-3 md:p-6 mp-10"
                 th:if="not ${formData.userAnswers.step3.addonsAsJava.isEmpty}"
            >
              <div
                th:each="addon: ${formData.userAnswers.step3.addonsAsJava}"
                class="flex flex-row"
              >
                <p th:text="${addon.name}" class="grow text-cool-gray">Online service</p>
                <p
                  th:text="|+$${formData.addonCost(addon)}/${formData.periodCostLabel}|"
                >
                  +$10/yr
                </p>
              </div>
              <div th:remove="all">Larger storage +$20/yr</div>
            </div>
          </div>

          <section class="flex flex-row p-3 mt-5 md:px-6">
            <p class="grow text-cool-gray">
              Total (per
              <span
                th:text="${formData.userAnswers.step2.isYearly} ? 'year' : 'month'"
                >year</span
              >)
            </p>
            <p
              th:text="|+$${formData.fullOrderPrice}/${formData.periodCostLabel}|"
              class="font-bold md:text-lg text-purplish-blue"
            >
              $120
            </p>
          </section>

          <!-- Step 3 end -->
        </section>
        <div class="md:hidden grow"></div>
        <section
          id="footer-controls"
          class="flex flex-row items-center py-4 w-full bg-white md:items-end md:h-full"
        >
          <a
            hx-post="/submit-step/4/3"
            hx-swap="outerHTML"
            hx-target="#form-step"
            href="step3.html"
            class="ml-6 text-sm font-semibold md:pb-3 md:ml-24 md:text-base text-cool-gray"
            hx-params="not form-confirmed"
            >Go Back</a
          >
          <div class="grow"></div>
          <input type="hidden" name="form-confirmed" value="true" />
          <input
            type="submit"
            class="grid place-content-center mr-3 w-24 h-10 text-sm font-semibold text-white rounded md:mr-24 md:w-32 md:h-12 md:text-base md:rounded-lg bg-purplish-blue"
            value="Confirm"
          />
          <a
            th:remove="all"
            href="step5.html"
            class="grid place-content-center mr-3 w-24 h-10 text-sm font-semibold text-white rounded md:mr-24 md:w-32 md:h-12 md:text-base md:rounded-lg bg-purplish-blue"
            >Confirm</a
          >
        </section>
      </form>
    </main>
  </body>
</html>
