<template>
  <div class="events-calendar-page">
    <main class="page-container">
      <div class="events-container">
        <!-- 标题区域 -->
        <div class="title-section">
          <div class="title-decoration"></div>
          <div class="events-title">
            {{ t("events_calendar.title") }}
          </div>
        </div>

        <!-- 搜索区域 -->
        <div class="search-container">
          <div class="date-picker-wrapper">
            <n-date-picker
              v-model:value="state.selectedDateValue"
              type="date"
              class="search-date-picker"
              placeholder="Select Date"
            >
              <template #prefix>
                <svg
                  class="calendar-icon"
                  width="20"
                  height="20"
                  viewBox="0 0 20 20"
                  fill="none"
                >
                  <g clip-path="url(#clip0_134_3094)">
                    <path
                      d="M17.5 3.33398H2.5C2.08333 3.33398 1.66667 3.66732 1.66667 4.08398V17.5007C1.66667 17.9173 2.08333 18.2507 2.5 18.2507H17.5C17.9167 18.2507 18.3333 17.9173 18.3333 17.5007V4.08398C18.3333 3.66732 17.9167 3.33398 17.5 3.33398Z"
                      stroke="#78777B"
                      stroke-width="1.25"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                    ></path>
                    <path
                      d="M13.3333 1.66602V5.00018"
                      stroke="#78777B"
                      stroke-width="1.25"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                    ></path>
                    <path
                      d="M6.66669 1.66602V5.00018"
                      stroke="#78777B"
                      stroke-width="1.25"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                    ></path>
                    <path
                      d="M1.66669 8.33398H18.3334"
                      stroke="#78777B"
                      stroke-width="1.25"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                    ></path>
                  </g>
                  <defs>
                    <clipPath id="clip0_134_3094">
                      <rect
                        width="20"
                        height="20"
                        fill="white"
                        transform="translate(0 0.000976562)"
                      ></rect>
                    </clipPath>
                  </defs>
                </svg>
              </template>
            </n-date-picker>
          </div>
          <button @click="handleSearch" class="search-button">
            {{ t("press_releases.search.button") }}
          </button>
        </div>

        <!-- 背景图片区域 -->
        <div class="background-image-container">
          <img
            src="@/assets/image/1440/events-calendar-bg.png"
            alt="Events Calendar Background"
            class="background-image"
          />
        </div>
      </div>
    </main>
  </div>
</template>

<script setup>
import { reactive } from "vue";
import { NDatePicker, NButton } from "naive-ui";
import { useI18n } from "vue-i18n";

const { t, locale } = useI18n();

const state = reactive({
  selectedDateValue: null, //选中值
});

const handleSearch = () => {
  // 搜索处理逻辑
  // console.log('搜索:', state.selectedDateValue)
};
</script>

<style scoped lang="scss">
.page-container {
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.events-container {
  width: 1240px;
  margin: 0 auto;
}

.title-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
  padding: 0 16px;
  margin-top: 43px;
}

.title-decoration {
  width: 58px;
  height: 7px;
  background: #ff7bac;
  margin: auto 0;
  margin-top: 0;
}

.events-title {
  font-family: "PingFang SC", sans-serif;
  font-weight: 500;
  font-size: 40px;
  line-height: 1.4em;
  letter-spacing: 1.2px;
  color: #000000;
}

.search-container {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 16px;
}

.date-picker-wrapper {
  flex: 1;
  position: relative;
}

.search-date-picker {
  width: 100%;
}

:deep(.n-input) {
  border-radius: 3px;
  border: 1px solid #e0e0e6;
  &:hover {
    border-color: #ff7bac;
  }
}
:deep(.n-input--focus) {
  border-color: #ff7bac;
  box-shadow: 0 0 0 2px rgba(255, 123, 172, 0.2);
}

.calendar-icon {
  margin-left: 12px;
}

.search-button {
  height: 46px;
  padding: 7px 12px;
  min-width: 201px;
  background: #ff7bac;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-family: "PingFang SC", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.375em;
  letter-spacing: 0.03em;
  &:hover {
    background: #ff7bac;
    color: #fff;
  }
}

.background-image-container {
  background: #fff;
  width: 100%;
  height: 518 * 1.33px;
  box-shadow: 0px 3px 14px 0px rgba(0, 0, 0, 0.16);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.background-image {
  width: 415px;
  height: 235px;
  flex-shrink: 0;
}
</style>
