<script setup>

import Button from  './Button.vue';

defineEmits(['login']);

defineProps({
  iconUrl: {
    type: String,
    default: '',
  },
  title: {
    type: String,
    default: 'Title',
  },
  message: {
    type: String,
    default: 'Message',
  },
  footer: {
    type: String,
    default: 'Footer',
  },
  loginLabel: {
    type: String,
    default: 'Login',
  }
});

</script>

<template>
  <div class="pankow-login-view">
    <div class="pankow-login-view-root">
      <div class="pankow-login-view-left pankow-no-mobile">
        <img class="pankow-login-view-icon" width="128" height="128" :src="iconUrl" :alt="title"/>
      </div>

      <div class="pankow-login-view-right">
        <div class="pankow-login-view-mobile-container">
          <img class="pankow-login-view-icon" width="128" height="128" :src="iconUrl" :alt="title" />
        </div>
        <h1 class="pankow-login-view-title">{{ title }}</h1>
        <h2 class="pankow-login-view-message" v-show="message">{{ message }}</h2>
        <Button tool id="loginSubmitButton" @click="$emit('login')">{{ loginLabel }}</Button>
        <div class="pankow-login-view-footer" v-show="footer">{{ footer }}</div>
      </div>
    </div>
  </div>
</template>

<style scoped>

.pankow-login-view {
  height: 100%;
}

.pankow-login-view-root {
  display: flex;
  overflow: hidden;
  height: 100%;
}

.pankow-login-view-left {
  background-color: rgba(0,0,0,0.1);
  flex-basis: 30%;
  justify-content: center;
  flex-direction: column;
  display: flex;
  align-items: center;
}

@media (prefers-color-scheme: dark) {
  .pankow-login-view-left {
    background-color: rgba(255,255,255,0.1);
  }
}

.pankow-login-view-left .pankow-login-view-icon {
  margin-bottom: 20px;
}

.pankow-login-view-left .pankow-login-view-icon[grayscale] {
  filter: grayscale(100%) brightness(200%) contrast(100%);
}

.pankow-login-view-title {
  font-family: var(--pankow-font-family);
  font-weight: 700;
  font-size: 28px;
  margin-bottom: 15px;
}

.pankow-login-view-message {
  font-family: var(--pankow-font-family);
  font-weight: 400;
  font-size: 16px;
  margin-top: 5px;
  margin-bottom: 30px;
}

.pankow-login-view-footer {
  font-size: 12px;
  padding: 5px;
  position: absolute;
  bottom: 5px;
}

.pankow-login-view-right {
  display: flex;
  align-items: start;
  flex-direction: column;
  padding: 40px;
  white-space: nowrap;
  justify-content: center;
}

.pankow-login-view-right {
  max-width: 400px;
}

.pankow-login-view-mobile-container {
  display: none;
}

@media (max-width: 576px) {
  .pankow-login-view-mobile-container {
    display: block;
    text-align: center;
  }

  .pankow-login-view-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    width: 100%;
    max-width: unset;
    padding-left: 20px;
    padding-right: 20px;
    justify-content: start;
    flex-basis: unset;
    text-align: center;
    gap: 2rem;
  }

  .pankow-login-view-right {
    max-width: unset;
    text-align: left;
  }
}

</style>
