<!-- eslint-disable vue/multi-word-component-names -->
<template>
  <!-- <AdaptiveContainer :options="{ width: 1920, height: 1080 }" style="overflow-y: hidden"> -->
  <div class="login-container" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%">
    <div class="login-bg"></div>
    <span class="-enter-x xl:hidden">
      <AppLogo :alwaysShowTitle="true" />
    </span>
    <div class="top-header">
      <div class="top-bg"></div>
      <div class="login-icon"></div>
      <div class="title">{{ title }}</div>
    </div>

    <div class="flex center">
      <LoginForm />
    </div>
    <div class="bottom"> </div>
  </div>
  <!-- </AdaptiveContainer> -->
</template>
<script lang="ts" setup>
  import { computed } from 'vue';
  import { AppLogo } from '/@/components/Application';
  import LoginForm from './LoginForm.vue';
  import { useGlobSetting } from '/@/hooks/setting';
  // import { useI18n } from '/@/hooks/web/useI18n';
  // import { useDesign } from '/@/hooks/web/useDesign';
  // import { useLocaleStore } from '/@/store/modules/locale';
  import { useLoginState } from './useLogin';
  // import AdaptiveContainer from '/@/components/Container/src/Adaptive.vue';

  defineProps({
    sessionTimeout: {
      type: Boolean,
    },
  });
  const globSetting = useGlobSetting();
  // const { prefixCls } = useDesign('login');
  // const { t } = useI18n();
  // const localeStore = useLocaleStore();
  // const showLocale = localeStore.getShowPicker;
  const title = computed(() => globSetting?.title ?? '');
  const { handleBackLogin } = useLoginState();
  handleBackLogin();
</script>
<style lang="less" scoped>
  @import '/@/design/theme.less';
  @prefix-cls: ~'@{namespace}-login';
  @logo-prefix-cls: ~'@{namespace}-app-logo';
  @countdown-prefix-cls: ~'@{namespace}-countdown-input';
  @dark-bg: #293146;
  @ventSpace: zxm;

  html[data-theme='dark'] {
    .@{prefix-cls} {
      background-color: @dark-bg;

      &::before {
        background-image: url(/@/assets/svg/login-bg-dark.svg);
      }

      .@{ventSpace}-input,
      .@{ventSpace}-input-password {
        background-color: #232a3b;
      }

      .@{ventSpace}-btn:not(.@{ventSpace}-btn-link):not(.@{ventSpace}-btn-primary) {
        border: 1px solid #4a5569;
      }

      &-form {
        background: transparent !important;
      }

      .app-iconify {
        color: #fff;
      }
    }

    input.fix-auto-fill,
    .fix-auto-fill input {
      -webkit-text-fill-color: #c9d1d9 !important;
      box-shadow: inherit !important;
    }
  }

  // 绿色主题特化的变量
  @{theme-green} {
    .login-container {
      --image-top: url('/@/assets/images/themify/green/vent/login/top.png');
      --image-icon: url('/@/assets/images/themify/green/vent/login/icon.png');
      --image-down: url('/@/assets/images/themify/green/vent/login/down.png');
      --image-bg: none;
      --container-bg: #181B24;
    }
    .login-icon {
      width: 325px !important;
      background-size: 100% 100%;
    }
  }
  // 深蓝色主题特化的变量
  @{theme-deepblue} {
    .login-container {
      --image-top: url('/@/assets/images/themify/deepblue/vent/login/top.png');
      --image-icon: url('/@/assets/images/themify/deepblue/vent/login/icon.png');
      --image-down: url('/@/assets/images/themify/deepblue/vent/login/down.png');
      --image-bg: none;
      --container-bg: #021632;
    }
  }

  .login-container {
    // 需要主题化的变量放在上面
    --image-top: url('/@/assets/images/vent/login/top.png');
    --image-icon: url('/@/assets/images/vent/login/icon.png');
    --image-down: url('/@/assets/images/vent/login/down.png');
    --image-bg: url('/@/assets/images/vent/login/bg.png');
    --container-bg: linear-gradient(to bottom, #000c37, #001e63);

    // 下面是不需要主题化的变量，例如单色图标、中性颜色等
    --login-bg: linear-gradient(to bottom, #000c3766, #001e6366);
    color: @vent-text-base;
    width: 100vw;
    height: 100%;
    background: var(--container-bg);
    padding: 0 !important;
    position: relative;
    &::before {
      content: '';
      position: absolute;
      width: 100%;
      height: 100%;
      top: 0px;
      left: 0;
      background-image: var(--image-bg);
      background-size: cover;
    }
    .login-bg {
      position: absolute;
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      background: var(--login-bg);
    }
    .top-header {
      width: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      position: relative;
      // padding-top: 70px;
      .top-bg {
        width: 100%;
        height: 129px;

        background-image: var(--image-top);
        background-size: 100% auto;
      }
      .login-icon {
        position: relative;
        width: 237px;
        height: 274px;
        top: 10px;
        background-image: var(--image-icon);
      }
      .title {
        position: absolute;
        top: 78px;
        color: rgb(224, 224, 224);
        font-size: 30px;
        text-align: center;
        text-shadow:
          1px 1px 1px #fff,
          -1px -1px 1px #000;
      }
    }

    .bottom {
      width: 100%;
      height: 118px;
      position: fixed;
      bottom: 0;
      left: 0;
      background-image: var(--image-down);
      background-size: 100% auto;
    }

    .center {
      width: 100%;
      height: calc(100% - 540px);
      display: flex;
      flex-direction: column;
      align-items: center;
      position: relative;
      justify-content: center;
    }
  }

  .@{prefix-cls} {
    min-height: 100%;
    overflow: hidden;
    @media (max-width: @screen-xl) {
      background-color: #293146;

      .@{prefix-cls}-form {
        background-color: #fff;
      }
    }

    &::before {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      margin-left: -48%;
      // background-image: url(/@/assets/svg/login-bg.svg);
      background-position: 100%;
      background-repeat: no-repeat;
      background-size: auto 100%;
      content: '';
      @media (max-width: @screen-xl) {
        display: none;
      }
    }

    .@{logo-prefix-cls} {
      position: absolute;
      top: 12px;
      height: 30px;

      &__title {
        font-size: 16px;
        color: #fff;
      }

      img {
        width: 32px;
      }
    }

    .container {
      .@{logo-prefix-cls} {
        display: flex;
        width: 60%;
        height: 80px;

        &__title {
          font-size: 24px;
          color: #fff;
        }

        img {
          width: 48px;
        }
      }
    }

    &-sign-in-way {
      .anticon {
        font-size: 22px;
        color: #888;
        cursor: pointer;

        &:hover {
          color: @primary-color;
        }
      }
    }

    input:not([type='checkbox']) {
      min-width: 360px;

      @media (max-width: @screen-xl) {
        min-width: 320px;
      }

      @media (max-width: @screen-lg) {
        min-width: 260px;
      }

      @media (max-width: @screen-md) {
        min-width: 240px;
      }

      @media (max-width: @screen-sm) {
        min-width: 160px;
      }
    }

    .@{countdown-prefix-cls} input {
      min-width: unset;
    }

    .@{ventSpace}-divider-inner-text {
      font-size: 12px;
      color: @text-color-secondary;
    }
  }
</style>
