@import "main";
@import "common/keyframes";

.#{$plugin_slug}-bulletins {
  // Item
  .#{$plugin_slug}-bulletin-item {
    &.has-countdown {
      @media (min-width: $screen-sm-min) {
        padding: 0px 24px;

        .#{$plugin_slug}-countdown-timer {
          @media (min-width: $screen-sm-min) {
            padding: 17px;
          }
        }
      }
    }
  }

  // Corner countdown timer
  .#{$plugin_slug}-placement-corner-timer {
    display: flex;
    margin-bottom: 16px;
  }

  // Center container
  .#{$plugin_slug}-center-container {
    &.#{$plugin_slug}-content-alignment-left,
    &.#{$plugin_slug}-content-alignment-center,
    &.#{$plugin_slug}-content-alignment-right {
      flex-direction: column;

      @media (min-width: $screen-sm-min) {
        flex-direction: row;
      }

      .#{$plugin_slug}-bulletin-content-wrapper {
        width: auto;
      }
    }

    .#{$plugin_slug}-countdown-wrapper {
      display: flex;
      flex-shrink: 0;
    }

    &.#{$plugin_slug}-content-alignment-left {
      align-items: flex-start;

      @media (min-width: $screen-sm-min) {
        align-items: center;
        justify-content: flex-start;
      }
    }

    &.#{$plugin_slug}-content-alignment-center {
      align-items: center;
      justify-content: center;
    }

    &.#{$plugin_slug}-content-alignment-right {
      align-items: flex-end;

      @media (min-width: $screen-sm-min) {
        align-items: center;
        justify-content: flex-end;
      }
    }
  }

  // Icon
  .#{$plugin_slug}-icon-wrapper {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    margin-right: 12px;
    background-color: rgba(#000, 0.2);

    svg {
      max-width: 24px;
      max-height: 24px;
    }
  }

  // Slider
  .#{$plugin_slug}-swiper-container {
    flex-grow: 1;
    overflow: hidden;
  }

  .#{$plugin_slug}-swiper-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: flex;
    transition-property: transform;
    box-sizing: content-box;
  }

  .swiper-container-android .#{$plugin_slug}-swiper-slide,
  .#{$plugin_slug}-swiper-wrapper {
    transform: translate3d(0px, 0, 0);
  }

  .swiper-container-vertical>.#{$plugin_slug}-swiper-wrapper {
    flex-direction: column;
  }

  .#{$plugin_slug}-swiper-slide {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    position: relative;
    transition-property: transform;
  }

  // End of slider styles

  .#{$plugin_slug}-desktop-rotation {
    display: none;

    @media (min-width: $screen-sm-min) {
      display: block;
    }
  }

  .#{$plugin_slug}-mobile-rotation {
    display: block;

    @media (min-width: $screen-sm-min) {
      display: none;
    }
  }

  .#{$plugin_slug}-slide-item {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  // Button
  .#{$plugin_slug}-button {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    margin: 0 8px 0 12px;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    display: none;
    transition: all 0.1s ease;
    z-index: 1;
    -webkit-animation-duration: 1s;
    -moz-animation-duration: 1s;
    -o-animation-duration: 1s;
		animation-duration: 1s;

    @media (min-width: $screen-sm-min) {
      display: inline-block;
    }

    &.#{$plugin_slug}-button-mobile {
      padding: 8px 0;
      width: 100%;
      margin: 0;
      display: inline-block;

      @media (min-width: $screen-sm-min) {
        display: none;
      }
    }

    .#{$plugin_slug}-button-label {
      display: none;

      @media (min-width: $screen-sm-min) {
        display: block;
      }
    }

    .#{$plugin_slug}-button-mobile-label {
      display: block;

      @media (min-width: $screen-sm-min) {
        display: none;
      }
    }

    &.#{$plugin_slug}-button-flash-effect.animation-start {
      -webkit-animation-name: flash;
      -moz-animation-name: flash;
      -o-animation-name: flash;
			animation-name: flash;

      -webkit-animation-iteration-count: infinite;
      -moz-animation-iteration-count: infinite;
      -o-animation-iteration-count: infinite;
      animation-iteration-count: infinite;
    }

    &.#{$plugin_slug}-button-shake-effect.animation-start {
      -webkit-animation-name: shake;
      -moz-animation-name: shake;
      -o-animation-name: shake;
			animation-name: shake;
    }

    &.#{$plugin_slug}-button-swing-effect.animation-start {
      -webkit-transform-origin: top center;
      -moz-transform-origin: top center;
      -o-transform-origin: top center;
			transform-origin: top center;

      -webkit-animation-name: swing;
      -moz-animation-name: swing;
      -o-animation-name: swing;
			animation-name: swing;
    }

    &.#{$plugin_slug}-button-tada-effect.animation-start {
      -webkit-animation-name: tada;
      -moz-animation-name: tada;
      -o-animation-name: tada;
			animation-name: tada;
    }

    &.#{$plugin_slug}-button-heartbeat-effect.animation-start {
      -webkit-animation-name: heartBeat;
      -moz-animation-name: heartBeat;
      -o-animation-name: heartBeat;
		  animation-name: heartBeat;

		  -webkit-animation-duration: 1.3s;
      -moz-animation-duration: 1.3s;
      -o-animation-duration: 1.3s;
		  animation-duration: 1.3s;

		  -webkit-animation-timing-function: ease-in-out;
      -moz-animation-timing-function: ease-in-out;
      -o-animation-timing-function: ease-in-out;
		  animation-timing-function: ease-in-out;
    }

    &.#{$plugin_slug}-button-wobble-effect.animation-start {
      -webkit-animation-name: wobble;
      -moz-animation-name: wobble;
      -o-animation-name: wobble;
			animation-name: wobble;
    }
  }

  // Countdown
  .#{$plugin_slug}-countdown-timer {
    white-space: nowrap;
    text-align: center;
    margin-right: 15px;
    padding: 5px;
    display: flex;
    flex-direction: row;

    .#{$plugin_slug}-time-wrapper {
      flex: 1 1 auto;
      margin: 0 5px;
      display: flex;
      flex-direction: column;
      align-items: flex-start;

      .#{$plugin_slug}-countdown-number {
        font-weight: 700;
        line-height: 1;
      }

      .#{$plugin_slug}-countdown-label {
        font-size: 15px;
      }
    }

    .#{$plugin_slug}-countdown-separator {
      display: inline-flex;
      align-items: flex-start;
      justify-content: center;
      margin: 0 4px;
      font-weight: 700;
      line-height: 1;
    }

    // Countdown alignment - right on desktop
    &.#{$plugin_slug}-countdown-align-right {
      margin-right: 0;
      margin-left: 15px;
      order: 2;

      // On mobile, align to bottom (below message)
      @media (max-width: 767px) {
        order: unset;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        margin-top: 10px;
      }
    }

    // Countdown alignment - left on desktop (default)
    &.#{$plugin_slug}-countdown-align-left {
      // On mobile, ensure it stays at top
      @media (max-width: 767px) {
        width: 100%;
        margin-right: 0;
      }
    }
  }

  // Marquee
  .#{$plugin_slug}-marquee-text-wrapper {
    $animation-duration: 40s;

    flex-grow: 1;
    display: flex;
    overflow: hidden;

    .#{$plugin_slug}-marquee-part {
      display: flex;
    }

    .#{$plugin_slug}-marquee-part-1 {
      -webkit-animation: webkit-marquee-part-one $animation-duration linear infinite;
      -moz-animation: moz-marquee-part-one $animation-duration linear infinite;
      -o-animation: o-marquee-part-one $animation-duration linear infinite;
      animation: marquee-part-one $animation-duration linear infinite;
      animation-delay: -$animation-duration;
      animation-play-state: running;
    }

    .#{$plugin_slug}-marquee-part-2 {
      -webkit-animation: webkit-marquee-part-two $animation-duration linear infinite;
      -moz-animation: moz-marquee-part-two $animation-duration linear infinite;
      -o-animation: o-marquee-part-two $animation-duration linear infinite;
      animation: marquee-part-two $animation-duration linear infinite;
      animation-delay: -($animation-duration/2);
      animation-play-state: running;
    }

    .#{$plugin_slug}-marquee-text-item {
      margin-left: 10px;
      margin-right: 10px;
      white-space: nowrap;
    }

    &:hover {
      .#{$plugin_slug}-marquee-part-1,
      .#{$plugin_slug}-marquee-part-2 {
        animation-play-state: paused;
      }
    }
  }

  // Close
  .#{$plugin_slug}-bulletin-close-button {
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: all 0.1s ease;

    &:hover {
      background-color: rgba(#fff, 0.2);
    }

    .#{$plugin_slug}-close-button {
      position: relative;
      width: 20px;
      height: 20px;

      &::before,
      &::after {
        content: '';
        border-radius: 2px;
        position: absolute;
        height: 19px;
        width: 2px;
        left: 9px;
        top: 1px;
      }

      &::before {
        transform: rotate(45deg);
      }

      &::after {
        transform: rotate(-45deg);
      }
    }
  }

  .#{$plugin_slug}-right-container .#{$plugin_slug}-bulletin-close-button {
    margin-left: 4px;
  }

  // Display corner style
  &.#{$plugin_slug}-placement-corner {
    .#{$plugin_slug}-center-container {
      &.#{$plugin_slug}-content-alignment-left,
      &.#{$plugin_slug}-content-alignment-center,
      &.#{$plugin_slug}-content-alignment-right {
        flex-direction: column;
        align-items: flex-start;
        justify-content: left;
      }
    }

    .#{$plugin_slug}-bottom-container {
      margin-top: 16px;
    }

    .#{$plugin_slug}-button-mobile {
      width: 100%;
      margin: 0;
      display: block;
    }
  }
}
