@use 'sass:map';
@use '../base/variable';
@use '../base/token';
@use '../abstract';

$banner-theme: (
  'light': (
    bg: var(--gray-50),
    color: var(--gray-700),
  ),
  'dark': (
    bg: var(--secondary-gray-blue-700),
    color: var(--base-white),
  ),
);

.cds-banner {
  $this: &;

  max-width: variable.$max-width;
  margin-bottom: 96px;
  padding: 0 16px;
  width: 100%;

  &__wrap {
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    padding: 32px 20px;
    gap: 24px;
  }

  @each $name, $colors in $banner-theme {
    &--#{$name} #{$this}__wrap {
      background-color: map.get($colors, 'bg');
      color: map.get($colors, 'color');
    }
  }

  &__content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    word-break: keep-all;
  }

  &__text {
    font-weight: abstract.font-weight-to-number(token.$font-weights-commerce-sans-2);
    font-size: abstract.rem(token.$font-size-4);
  }

  &__btns {
    display: inline-flex;
    gap: 12px;
  }

  @include abstract.media-bp-up('md') {
    padding: 0 32px;
    margin-left: auto;
    margin-right: auto;

    &__wrap {
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      padding: 32px;
    }

    &__content {
      flex-direction: row;
      align-items: center;
      gap: 16px;
    }
  }
}

.rolling-banner-wrap {
  position: relative;
  z-index: 1000;
}

.rolling-banner {
  $this: &;
  font-family: 'CommerceSans', sans-serif;

  &__item {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  &__prev-btn,
  &__next-btn {
    position: absolute;
    top: 14px;

    border: none;
    border-radius: 50%;
    padding: 0;
    background-color: rgba(0, 0, 0, 0.5);
    width: 20px;
    height: 20px;
    cursor: pointer;
  }
  &__prev-btn {
    left: 30%;

    & > svg {
      transform: translate(0, 1px);
    }

    @media (max-width: 767px) {
      display: none;
    }
    @media (min-width: 768px) and (max-width: 992px) {
      left: 15%;
    }
  }
  &__next-btn {
    right: 30%;
    & > svg {
      transform: translate(1px, 1px);
    }

    @media (max-width: 767px) {
      display: none;
    }
    @media (min-width: 768px) and (max-width: 992px) {
      right: 15%;
    }
  }

  &__close-btn {
    position: absolute;
    top: 12px;
    right: 40px;

    border: none;
    padding: 0;
    background: transparent;
    width: 24px;
    height: 24px;
    cursor: pointer;
  }
}

@media (max-width: 768px) {
  .rolling-banner-wrap {
    .rolling-banner__close-btn {
      right: 12px;
    }

    &.mo .rolling-banner__close-btn {
      top: 28px;
    }
  }
}

.dots_custom {
  display: flex;
  bottom: 0;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: absolute;
}

.dots_custom ul {
  margin: 0;
}

.dots_custom li {
  list-style: none;
  cursor: pointer;
  display: inline-block;
  margin: 0 6px;
  padding: 0;
}

.dots_custom li button {
  border: none;
  background: #eaecf0;
  color: transparent;
  cursor: pointer;
  display: block;
  height: 8px;
  width: 8px;
  border-radius: 4px;
  padding: 0;
  opacity: 0.2;
}

.dots_custom li.slick-active button {
  background-color: #eaecf0;
  opacity: 1;
}
