<template>
  <UiContainer class="space-55-75 xl:!space-y-[100px]">
    <div class="space-25-75">
      <h2 class="h2-bold-bounded max-w-[95%]">
        <span
          v-for="(item, index) in component.front_section_lang[0].data
            .reasons_section_title"
          :key="index"
          :class="[
            item.highlight
              ? 'text-accent-green-light dark:text-accent-green-dark'
              : '',
            'inline',
          ]"
        >
          {{ item.text }}
          <span
            v-if="
              index
                !== component.front_section_lang[0].data.reasons_section_title
                  .length
                - 1
            "
          />
        </span>
      </h2>
      <div
        class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 md:px-10 xl:p-0 gap-8 auto-rows-fr"
      >
        <div
          v-for="(item, index) in component.front_section_lang[0].data
            .reason_blocks"
          :key="index"
          :class="[
            'p-[25px] rounded-2xl border border-block flex flex-col justify-between gap-20',
            index === 1 && 'xl:col-start-2 xl:col-end-3',
            index === 2 && 'xl:col-start-4 xl:col-end-5',
            index === 3 && 'xl:col-start-2 xl:col-end-3',
          ]"
        >
          <h4 class="h4-uppercase-bold-inter">
            <span>0{{ index + 1 }} <br></span>{{ item.title }}
          </h4>
          <p>{{ item.description }}</p>
        </div>

        <div
          class="row-end-7 sm:row-auto rounded-2xl flex items-center justify-center min-h-[200px]"
        >
          <div
            class="w-full h-full rounded-2xl"
            :style="{
              backgroundImage: `url('/api/public/file/${component.img[0]}_l.webp')`,
              backgroundSize: 'cover',
              backgroundPosition: 'top',
            }"
          />
        </div>
      </div>
    </div>
    <div class="space-25-55">
      <div>
        <div class="space-25-75">
          <h2 class="h2-bold-bounded">
            {{ component.front_section_lang[0].data.cta_section_title }}
          </h2>
          <div class="hidden xl:grid grid-cols-2 gap-6">
            <div class="flex flex-col gap-20">
              <p>
                {{ component.front_section_lang[0].data.cta_description_intro }}
              </p>
              <p>
                {{
                  component.front_section_lang[0].data.cta_description_details
                }}
              </p>
            </div>
            <h4 class="h4-uppercase-bold-inter">
              {{
                component.front_section_lang[0].data
                  .main_call_to_action_statement
              }}
            </h4>
          </div>
          <div class="xl:hidden space-25-55">
            <div
              class="grid grid-cols-1 md:grid-cols-2 md:gap-[55px] space-25-55"
            >
              <p>
                {{ component.front_section_lang[0].data.cta_description_intro }}
              </p>
              <h4 class="h4-uppercase-bold-inter">
                {{
                  component.front_section_lang[0].data
                    .main_call_to_action_statement
                }}
              </h4>
            </div>
            <p>
              {{ component.front_section_lang[0].data.cta_description_details }}
            </p>
          </div>
        </div>
      </div>
      <div class="space-y-[45px]">
        <h4 class="h4-uppercase-bold-inter">
          {{ component.front_section_lang[0].data.form_section_title }}
        </h4>
        <div class="flex flex-col md:flex-row gap-8 md:gap-[30px] xl:gap-0">
          <div
            class="p-[25px] md:p-[50px] bg-block rounded-2xl space-y-[30px] xl:ml-40 xl:w-[65%]"
          >
            <div class="flex gap-[30px]">
              <input
                :placeholder="$t('first_name')"
                type="text"
                class="border border-text-dark placeholder:text-button rounded-lg px-3 py-1.5 w-full focus:outline-none focus:ring-0 focus:border-2 text-button"
              >
              <input
                :placeholder="$t('email')"
                type="text"
                class="border border-text-dark placeholder:text-button rounded-lg px-3 py-1.5 w-full focus:outline-none focus:ring-0 focus:border-2 text-button"
              >
            </div>
            <textarea
              :placeholder="$t('form_question')"
              class="border h-[145px] border-text-dark placeholder:text-button rounded-lg px-3 py-1.5 w-full focus:outline-none focus:ring-0 focus:border-2 text-button"
            />

            <div class="w-full flex justify-center sm:justify-start">
              <UiButtonArrow type="border">
                {{
                  $t("submit_form")
                }}
              </UiButtonArrow>
            </div>
          </div>
          <div class="space-y-[30px] xl:px-[50px] sm:px-10">
            <h4 class="h4-uppercase-bold-inter">
              {{ $t("contact_info") }}
            </h4>
            <div
              class="flex flex-col sm:flex-row items-center sm:items-start md:flex-col justify-between gap-[30px]"
            >
              <div>
                <p class="text-gray">
                  {{ $t("phone") }}
                </p>
                <p>+420 608 428 782</p>
              </div>
              <div>
                <p class="text-gray">
                  {{ $t("email") }}
                </p>
                <p>web@yourgold.cz</p>
              </div>
              <div>
                <p class="text-gray">
                  {{ $t("office_address") }}
                </p>
                <p>
                  Floriána Nováka 3 <br>
                  796 01 Prostějov <br>
                  Czech Republic <br>
                  CZ 08435456
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="flex flex-col xl:flex-row xl:h-[130px] gap-[45px]">
        <div
          class="w-full xl:w-[560px] h-[130px] xl:h-full rounded-2xl"
          :style="{
            backgroundImage: `url('/api/public/file/${component.img[1]}_l.webp')`,
            backgroundSize: 'cover',
            backgroundPosition: 'center',
          }"
        />
        <div
          class="flex flex-col h-full justify-between items-stretch space-y-[25px] sm:space-y-[55px] xl:space-y-0"
        >
          <p>
            {{
              component.front_section_lang[0].data.closing_inspirational_block
            }}
          </p>
          <h4 class="h4-uppercase-bold-inter">
            <span
              v-for="(item, index) in component.front_section_lang[0].data
                .title"
              :key="index"
              :class="[
                item.highlight
                  ? 'text-accent-green-light dark:text-accent-green-dark'
                  : '',
                'inline',
              ]"
            >
              {{ item.text }}
              <span
                v-if="
                  index
                    !== component.front_section_lang[0].data.reasons_section_title
                      .length
                    - 1
                "
              />
            </span>
          </h4>
          <p>{{ component.front_section_lang[0].data.final_tagline }}</p>
        </div>
      </div>
    </div>
  </UiContainer>
</template>

<script lang="ts" setup>
defineProps<{
  component: {
    id: number
    name: string
    img: string[]
    component_name: string
    is_no_lang: boolean
    page_name: string
    front_section_lang: {
      data: {
        reasons_section_title: {
          text: string
          highlight: boolean
        }[]
        reason_blocks: {
          title: string
          description: string
        }[]
        cta_section_title: string
        cta_description_intro: string
        cta_description_details: string
        main_call_to_action_statement: string
        form_section_title: string
        closing_inspirational_block: string
        title: {
          text: string
          highlight: boolean
        }[]
        final_tagline: string
        contact_info: string
      }
      id_front_section: number
      id_lang: number
    }[]
  }
}>()
</script>
