<script setup lang="ts">
const props = defineProps({
  title: {
    type: String,
    required: true,
  },
  subtext: {
    type: String,
    required: true,
  },
  image: {
    type: String,
    required: true,
  },
  summary: {
    type: String,
    // required: true,
  },
  infoSubtext: {
    type: String,
  },
  date: {
    type: String,
    // required: true,
  },
  runtime: {
    type: String,
    // required: true,
  },
  imdbRating: {
    type: String,
    // required: true,
  },
  MPAA: {
    type: String,
  },
  tag: {
    type: String,
  },
})
</script>

<template>
  <div class="scroller-item">
    <div class="scroller-item-img">
      <!-- <div class="scroller-item-poster-wrapper"> -->
      <div class="poster-tag" v-if="props.tag !== '' && props.tag !== undefined">
        {{ props.tag }}
      </div>
      <font-awesome-icon icon="fa-solid fa-play" class="play-icon" />
      <img
        :src="'/src/assets/images/' + props.image"
        alt=""
        :style="{
          width: `${120}px`,
          height: `${120 * (3 / 2)}px`,
        }"
      />
      <!-- </div> -->
      <div class="info-box">
        <div class="info-box-content">
          <div class="info-box-header">
            <div class="info-box-title">{{ props.title }}</div>
            <div class="info-box-subtext">{{ props.infoSubtext }}</div>
          </div>
          <div class="info-box-summary clamp-6">{{ props.summary }}</div>
          <div class="info-box-misc-info">
            <div class="date">{{ props.date }}</div>
            <div class="runtime">{{ props.runtime }}</div>
            <div class="imdb">
              <font-awesome-icon icon="fa-solid fa-star" size="xs" class="star-rating" />
              {{ props.imdbRating }}
            </div>
            <div class="mpaa">
              <span class="age-rating sm">{{ props.MPAA }}</span>
            </div>
            <div class="ends-at">Ends at 6:23pm</div>
          </div>
        </div>
      </div>
    </div>
    <div class="scroller-item-title clamp-2" :style="{ maxWidth: `${120 - 5}px` }">
      {{ props.title }}
    </div>
    <div class="scroller-item-subtext clamp" :style="{ maxWidth: `${120 - 5}px` }">
      {{ props.subtext }}
    </div>
  </div>
</template>

<style scoped>
.scroller-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* .scroller-item:hover {
  cursor: pointer;
} */
.play-icon {
  position: absolute;
  top: 75px;
  left: 35px;
  width: 35px;
  height: 35px;
  cursor: pointer;
  z-index: 2;
  opacity: 0%;
  padding: 0.75em;
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: background 10ms linear 0ms;
}
.play-icon:hover {
  background: rgba(122, 122, 122, 0.2);
}
.scroller-item-img:hover .play-icon {
  top: 100px;
  left: 55px;
  opacity: 100%;
  transition:
    all var(--hover-animation-speed) ease var(--hover-animation-delay),
    z-index 1ms,
    background 10ms linear 0ms;
  z-index: 5;
  visibility: visible;
}
.scroller-item-img {
  position: relative;
}
.scroller-item-img img {
  position: relative;
  background-size: cover;
  z-index: 1;
  transition-duration: 0.3s;
}
.scroller-item-img:hover img {
  transform: scale(1.35) translateX(16px) translateY(23px);
  cursor: pointer;
  transition:
    all var(--hover-animation-speed) ease,
    z-index 1ms;
  transition-delay: var(--hover-animation-delay);
  position: relative;
  z-index: 4;
}
.poster-tag {
  position: absolute;
  right: 0px;
  top: 6px;
  z-index: 2;
  font-weight: 500;
  font-size: 13px;
  width: 36px;
  background: rgba(0, 0, 0, 0.4);
  color: rgba(255, 255, 255, 1);
  border-radius: 16px 0px 0px 16px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(2.6px);
  -webkit-backdrop-filter: blur(2.6px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
  transition: all var(--hover-animation-speed) ease 0.2s;
  opacity: 100%;
}
.scroller-item-img:hover .poster-tag {
  opacity: 0%;
  transition: all var(--hover-animation-speed) ease 0.2s;
  /* transition-delay: var(--hover-animation-delay); */
  /* transform: translateX(10px); */
}
.scroller-item-title {
  text-align: center;
}
.scroller-item-subtext {
  color: var(--color-text-faded);
  max-width: 245px;
  text-align: center;
}
.info-box {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: 120px;
  height: 180px;
  visibility: hidden;
  background-color: var(--color-background-grey);
  transition-duration: 0.3s;
}
.scroller-item-img:hover .info-box {
  visibility: visible;
  transform: translateX(162px);
  width: 360px;
  height: 243px;
  z-index: 3;
  transition:
    all var(--hover-animation-speed) ease var(--hover-animation-delay),
    z-index 1ms var(--hover-animation-delay);
}
.info-box-content {
  width: 90%;
  margin: 0 auto;
  padding: 1em;
  max-height: 180px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: baseline;
  justify-content: space-between;
  gap: 2em;
  min-height: 95%;
}
.scroller-item:hover .info-box-content {
  max-height: 240px;
  transition-delay: 0.05s;
}
.info-box-title {
  font-weight: 600;
  font-size: 18px;
}
.info-box-subtext {
  color: var(--color-text-faded);
}
.info-box-misc-info {
  display: flex;
  justify-content: space-between;
  min-width: 90%;
}
</style>
