@use '../../global/scss/tools' as nsw;

.nsw-cookie-banner {
  padding: nsw.rem(24px) 0;
  background-color: var(--nsw-brand-light);

  .nsw-icon-button {
    position: absolute;
    top: nsw.rem(-8px);
    right: nsw.rem(4px);

    &:hover {
      background-color: var(--nsw-hover-light);

      @include nsw.nsw-hover;
    }

    &:focus {
      @include nsw.nsw-focus($color: var(--nsw-text-light));
    }
  }

  &__wrapper {
    position: relative;
    
    @include nsw.container;
  }

  &__title {
    font-weight: var(--nsw-font-bold);

    @include nsw.font-size('md');
  }

  &__content {
    margin: nsw.rem(16px) nsw.rem(36px) nsw.rem(24px) 0;
  }

  &__buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: nsw.rem(16px);
    margin-top: nsw.rem(16px);
    flex-direction: column;

    @include nsw.breakpoint('md') {
      flex-direction: row;
    }
  }

  &__cta-group {
    display: flex;
    gap: nsw.rem(16px);

    button {
      flex: 1 auto;
  
      @include nsw.breakpoint('md') {
        flex: unset;
      }
    }
  }

  &--light {
    background-color: var(--nsw-status-info-bg);
    color: var(--nsw-text-dark);

    .nsw-cookie-banner__content a {
      @include nsw.link-dark;
    }

    .nsw-icon-button {
      color: var(--nsw-brand-dark);

      &:hover {
        background-color: var(--nsw-hover);
      }

      &:focus {
        outline-color: var(--nsw-focus);
      }
    }
  }
}

.nsw-cookie-dialog {
  z-index: 1100;

  .nsw-dialog__container {
    overflow-y: hidden;
  }

  .nsw-dialog__top {
    z-index: 1101;
    position: sticky;
    top: 0;
    background: var(--nsw-white);
    border-radius: var(--nsw-border-radius);
  }

  .nsw-dialog__content {
    padding-top: nsw.rem(16px);
    padding-bottom: nsw.rem(72px);

    @include nsw.breakpoint('md') {
      padding-top: nsw.rem(16px);
      padding-bottom: nsw.rem(4px);
    }
  }

  &__bottom {
    border-top: 1px solid var(--nsw-grey-04);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    padding: nsw.rem(16px);
    gap: nsw.rem(16px);

    @include nsw.breakpoint('md') {
      flex-direction: row;
      justify-content: space-between;
    }

    @include nsw.breakpoint('lg') {
      padding: nsw.rem(32px);
    }

    button {
      @include nsw.breakpoint('md') {
        margin-bottom: 0;
      }

      &:last-child {
        margin-bottom: 0;

        @include nsw.breakpoint('md') {
          margin-left: 0;
        }
      }
    }
  }

  &__cta-group {
    display: flex;
    gap: nsw.rem(16px);
    
    @include nsw.breakpoint('md') {
      flex-direction: row;
    }

    button {
      flex: 1;

      @include nsw.breakpoint('md') {
        flex: unset;
      }
    }
  }

  &__content-wrapper {
    padding: nsw.rem(8px);
    overflow: scroll;
    max-height: 280px;

    &::-webkit-scrollbar {
      width: 8px;
    }
    
    &::-webkit-scrollbar-thumb {
      border-radius: 4px;
      background-color: var(--nsw-grey-03);
      box-shadow: 0 0 1px var(--nsw-grey-03);
    }
  }
 
  .nsw-tabs__content {
    -webkit-overflow-scrolling: auto;
    padding: nsw.rem(12px) 0 nsw.rem(8px) nsw.rem(8px);
    border-bottom: 0;

    @include nsw.breakpoint('md') {
      max-height: 320px;
    }

    &:focus-visible {
      outline: 2px solid var(--nsw-brand-dark);
    }

    &:focus {
      outline: none;
    }
  }
  
  &__list {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    gap: nsw.rem(8px);
  }
  
  &__list-item {
    display: flex;
    flex-direction: column;
    gap: nsw.rem(8px);

    label {
      font-weight: var(--nsw-font-bold);
      cursor: pointer;

      @include nsw.font-size('md');
    }

    &:not(:nth-child(1)) {
      border-top: 1px solid var(--nsw-grey-04);
      padding-top: nsw.rem(24px);
    }
  }

  &__cookie-details {
    margin-left: 48px;
  }
}
