@import '../../../mixins/lozenge/main.scss';

@mixin chevronIcon($icon-name, $color) {
  --icon-size: 12px;
  mask-repeat: no-repeat;
  mask-size: contain;
  width: var(--icon-size);
  height: var(--icon-size);
  content: '';
  display: inline-block;
  position: relative;
  mask-image: var(--o3-icon-#{$icon-name});
  background-color: $color;
  margin-left: 8px;
  vertical-align: bottom;
}

@mixin myftFollowButtonPlusToggleIcons($theme: standard) {
  // TODO: request new designs for these buttons to follow new o3 guidelines

  @include withTheme($theme) {
    &.n-myft-follow-button--instant-alerts[aria-pressed='true']::before {
      // Fallback colours for browsers that do not support color-mix
      @if $theme == standard {
        background-color: #d69fb1; // Fallback color for standard theme
      } @else if $theme == inverse {
        background-color: #666666; // Fallback color for inverse theme
      } @else if $theme == opinion {
        background-color: #9dafc2; // Fallback color for opinion theme
      } @else if $theme == monochrome {
        background-color: #666666; // Fallback color for monochrome theme
      } @else if $theme == inverse-monochrome {
        background-color: #999999; // Fallback color for inverse-monochrome theme
      } @else if $theme == alphaville {
        background-color: #aebcc9; // Fallback color for alphaville theme
      }

      background-color: color-mix(in srgb, getThemeColor(text) 60%, getThemeColor(background));
      mask-image: var(--o3-icon-notification-mute);
    }

    &.n-myft-follow-button--instant-alerts--on[aria-pressed='true']::before {
      background-color: getThemeColor(text);
      mask-image: var(--o3-icon-notification);
    }

    &.n-myft-follow-button--instant-alerts[aria-pressed='true']::after {
      @include chevronIcon('chevron-down', getThemeColor(text));
    }

    &.n-myft-follow-button--instant-alerts--open[aria-pressed='true']::after {
      @include chevronIcon('chevron-up', getThemeColor(text));
    }
  }
}

@each $theme in map-keys($myft-lozenge-themes) {
  .n-myft-follow-button#{getThemeModifier($theme)} {
    @include myftFollowButtonPlusToggleIcons($theme);
  }
}
