<template>
  <div class="l-flex--col c-box">
    <div class="c-box__border--left" />
    <div class="c-box__border--right" />
    <div class="l-flex__fill l-flex--col c-box__main has-bg">
      <div
        v-if="title"
        class="l-flex__none c-box__header l-flex--row"
      >
        <div class="u-bold l-flex__fill">{{ title }}</div>
        <div class="header__decoration">
          <div class="decoration__bg" />
          <div class="decoration__bg--under" />
        </div>
        <div class="header__rects l-flex--row">
          <div class="header__rect l-flex__fill" />
          <div class="header__rect l-flex__fill" />
          <div class="header__rect l-flex__fill" />
        </div>
      </div>
      <div class="l-flex__fill l-flex--col has-content-padding">
        <slot />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Box',
  props: {
    title: {
      type: String,
      default: ''
    }
  }
}
</script>

<style lang="scss" scoped>
.c-box {
  position: relative;
  height: 100%;
  width: 100%;
  color: #fff;
  border: 1px solid rgba(#fff, 0.3);

  &__border {
    &--left {
      left: 0;
      position: absolute;
      height: 100%;
      width: 4px;
      background-image: linear-gradient(
        to bottom,
        #fff 0,
        #fff 16px,
        transparent 16px,
        transparent 24px,
        #2956f0 24px,
        #2956f0 40px,
        #2956f0 56px,
        transparent 56px,
        transparent 64px,
        #fff 64px,
        #fff 80px,
        transparent 80px,
        transparent calc(100% - 16px),
        #fff calc(100% - 16px),
        #fff 100%
      );
    }

    &--right {
      right: 0;
      position: absolute;
      height: 100%;
      width: 4px;
      background-image: linear-gradient(
        to bottom,
        #fff 0,
        #fff 16px,
        transparent 16px,
        transparent calc(100% - 16px),
        #fff calc(100% - 16px),
        #fff 100%
      );
    }
  }

  &__main {
    background-color: rgba(#1d274b, 0.85);
    overflow: hidden;
  }

  &__header {
    margin: 0 24px 20px;
    position: relative;
    height: 80px;
    line-height: 80px;
    font-size: 38px;
    border-bottom: 1px solid rgba(#fff, 0.1);
  }
  .header__decoration {
    position: relative;
    width: 160px;
    height: 8px;

    .decoration__bg {
      width: 100%;
      height: 100%;
      background: linear-gradient(
        270deg,
        rgba(34, 51, 108, 0) 0%,
        #22336c 100%
      );
    }

    .decoration__bg--under {
      position: absolute;
      width: 100%;
      height: 100%;
      top: 0;
      background: repeating-linear-gradient(
        120deg,
        rgba(#1d274b, 0.85),
        rgba(#1d274b, 0.85) 4px,
        transparent 4px,
        transparent 8px
      );
    }
  }

  .header__rect {
    width: 16px;
    height: 8px;
    &:nth-child(1) {
      background-color: #8ca6ff;
    }
    &:nth-child(2) {
      margin-left: 4px;
    }
    background-color: #5279ff;
    &:nth-child(3) {
      margin-left: 4px;
      background-color: #2556ff;
    }
  }
}

.has-content-padding {
  padding: 0 24px 24px;
}
</style>
