﻿@use 'sass:color';
@use 'ej2-base/styles/common/mixin' as *;
@include export-module('image-editor-theme') {
  .e-image-editor {
    background: $image-editor-background;

    & .e-contextual-toolbar-wrapper {
      background: $image-editor-contextual-toolbar;

      & .e-toolbar-item:hover .filterwrapper canvas,
      & .e-toolbar-item.e-selected .filterwrapper canvas,
      & .e-toolbar-item:hover .filter-wrapper canvas,
      & .e-toolbar-item.e-selected .filter-wrapper canvas {
        border-color: $btn-active-bgcolor !important; /* stylelint-disable-line declaration-no-important */
      }

      & .e-toolbar-item.e-selected .filterwrapper:focus canvas,
      & .e-toolbar-item.e-selected .filter-wrapper:focus canvas {
        border-color: $btn-active-bgcolor !important; /* stylelint-disable-line declaration-no-important */
      }
    }

    & .e-toolbar {
      & .e-toolbar-items {
        & .e-toolbar-item {
          &.e-ie-resize-height,
          &.e-ie-resize-width,
          &.e-stroke,
          &.e-frame-stroke,
          &.e-size,
          &.e-ie-straighten-span,
          &.e-ie-straighten-value-span {
            @if $skin-name == 'tailwind3' {
              color: $ie-content-text-color;
            }
          }
        }
        & .e-tbar-btn.e-btn {
          & .e-icons {
            @if $skin-name != 'bootstrap4' and $skin-name != 'bootstrap5' and $skin-name != 'bootstrap5.3' and $skin-name != 'bootstrap5-dark' and $skin-name != 'fluent2' {
              color: $image-editor-toolbar-icon-color;
            }
          }

          &.e-selected-btn {
            background: $image-editor-icon-sel-bg-color !important; /* stylelint-disable-line declaration-no-important */
            & .e-icons {
              @if $skin-name == 'bootstrap5' or $skin-name == 'bootstrap5.3' or $skin-name == 'bootstrap5-dark' {
                color: $secondary-text-color-focus;
              }
            }
          }
        }

        & .e-dropdown-btn {
          background: inherit;
          border: none;
          margin-top: $image-editor-ddbtn-margin-top;
          @if $skin-name == 'bootstrap4' or $skin-name == 'bootstrap5' or $skin-name == 'bootstrap5.3' or $skin-name == 'bootstrap5-dark' {
            background: $tbar-default-bg;
            color: $tbar-default-icon-color;
          }
          @if $skin-name == 'highcontrast' or $skin-name == 'highcontrast-light' {
            border: 2px solid #000;
          }
          @if $skin-name == 'Material3' {
            box-shadow: none;
          }

          & .e-caret-hide {
            display: none !important; /* stylelint-disable-line declaration-no-important */
          }

          &:hover {
            background: $tbar-hover-bg;
            box-shadow: none;
            @if $skin-name == 'bootstrap5' or $skin-name == 'bootstrap5.3' {
              color: $secondary-text-color;
            }
            @else {
              color: $tbar-hover-font;
            }
          }

          &:focus {
            background: $btn-focus-bgcolor;
            box-shadow: none;
            color: $btn-focus-color;
            @if $skin-name == 'FluentUI' {
              outline: none !important; /* stylelint-disable-line declaration-no-important */
              box-shadow: inset 0 0 0 1px !important; /* stylelint-disable-line declaration-no-important */
            }
            @else if $skin-name == 'FluentUI' or $skin-name == 'fabric' or $skin-name == 'fabric-dark' {
              outline: none !important; /* stylelint-disable-line declaration-no-important */
            }
            @else if $skin-name == 'highcontrast' or $skin-name == 'highcontrast-light' {
              outline: none !important; /* stylelint-disable-line declaration-no-important */
              border: 2px solid #fff !important; /* stylelint-disable-line declaration-no-important */
            }
            @else if $skin-name == 'bootstrap4' {
              $color-rgba: rgba(color.mix(color.adjust($btn-focus-bgcolor, $lightness: 50%), $btn-focus-border-color, 15%), .5);
              box-shadow: 0 0 0 .25em $color-rgba !important; /* stylelint-disable-line declaration-no-important */
            }
            @else if $skin-name == 'bootstrap5' {
              box-shadow: $secondary-shadow-focus !important; /* stylelint-disable-line declaration-no-important */
            }
            @else if $skin-name == 'Material3' {
              box-shadow: $shadow-focus-ring1 !important; /* stylelint-disable-line declaration-no-important */
            }
            @else if $skin-name == 'tailwind' {
              box-shadow: 0 0 0 1px #4f46e5 !important; /* stylelint-disable-line declaration-no-important */
            }
          }

          &:focus-visible {
            @if $skin-name == 'fluent2' {
              box-shadow: $keyboard-focus !important; /* stylelint-disable-line declaration-no-important */
            }
          }

          &:active {
            background: $btn-active-bgcolor;
            box-shadow: none;
            color: $btn-active-color;
          }
        }

        & .e-colorpicker-wrapper {
          &.e-shape-fill-color,
          &.e-shape-stroke-color,
          &.e-text-stroke-color,
          &.e-pen-stroke-color {
            & .e-split-btn-wrapper .e-split-btn {
              & .e-selected-color {
                background: none;
                border-bottom-style: solid;
                border-bottom-width: 3px;
                width: 14px;
                margin: 0 2px;
                border-bottom-color: $img-editor-cp-preview-border-bottom-color;

                & .e-split-preview {
                  display: none;
                }
              }
            }
          }
        }

        & .e-nocolor-item {
          background: transparent url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNnB4IiBoZWlnaHQ9IjZweCIgdmlld0JveD0iMCAwIDYgNiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggNTAgKDU0OTgzKSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5Hcm91cCA5PC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Ikdyb3VwLTkiPgogICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTExIiBmaWxsPSIjRTBFMEUwIiB4PSIwIiB5PSIwIiB3aWR0aD0iMyIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtMTEtQ29weS0yIiBmaWxsPSIjRkZGRkZGIiB4PSIwIiB5PSIzIiB3aWR0aD0iMyIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtMTEtQ29weSIgZmlsbD0iI0ZGRkZGRiIgeD0iMyIgeT0iMCIgd2lkdGg9IjMiIGhlaWdodD0iMyI+PC9yZWN0PgogICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTExLUNvcHktMyIgZmlsbD0iI0UwRTBFMCIgeD0iMyIgeT0iMyIgd2lkdGg9IjMiIGhlaWdodD0iMyI+PC9yZWN0PgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+') !important; /* stylelint-disable-line declaration-no-important */
          background-size: 8px !important; /* stylelint-disable-line declaration-no-important */
        }

        & .e-toolbar-item.e-overlay .e-btn {
          box-shadow: none !important; /* stylelint-disable-line declaration-no-important */
          @if $skin-name == 'fluent2' {
            background: $content-bg-color-alt1 !important; /* stylelint-disable-line declaration-no-important */

            &:focus .e-icons {
              color: $icon-color-disabled !important; /* stylelint-disable-line declaration-no-important */
            }
          }
        }
      }
    }

    & .e-ie-drop-area {
      & .e-ie-drop-content,
      & .e-ie-min-drop-content {
        @if $skin-name == 'tailwind3' {
          color: $ie-content-text-color;
        }
      }
      .e-ie-drop-browse {
        @if $skin-name == 'tailwind3' {
          color: $ie-browse-text-color;
        }
      }
      .e-ie-drop-info {
        @if $skin-name == 'tailwind3' {
          color: $ie-drop-info-text-color;
        }
      }
    }

    & .e-ie-finetune-slider-label,
    & .e-ie-finetune-value-span {
      @if $skin-name == 'tailwind3' {
        color: $ie-content-text-color;
      }
    }

    & .filter-wrapper {
      @if $skin-name == 'tailwind3' {
        color: $ie-content-text-color-alt1;
      }
    }
  }
}

.e-dropdown-popup {
  & .e-selected-btn {
    @if $skin-name != 'highcontrast' and $theme-name != 'bootstrap5.3' and $theme-name != 'bootstrap5.3-dark' {
      background: $image-editor-icon-sel-bg-color !important; /* stylelint-disable-line declaration-no-important */
    }
    @if $skin-name == 'bootstrap5' or $skin-name == 'bootstrap5-dark' {
      color: $secondary-text-color-focus !important; /* stylelint-disable-line declaration-no-important */
    }
    @if $skin-name == 'bootstrap4' {
      color: $drop-down-btn-selected-color !important; /* stylelint-disable-line declaration-no-important */
    }
  }

  & .e-item.e-selected-btn {
    @if $skin-name == 'fluent2' {
      color: $flyout-text-color-selected;
    }
    @if $theme-name == 'bootstrap5.3' or $theme-name == 'bootstrap5.3-dark' {
      background-color: $content-bg-color-selected !important; /* stylelint-disable-line declaration-no-important */
      color: $content-text-color-selected !important; /* stylelint-disable-line declaration-no-important */
    }
  }
}

.e-ie-filter-canvas:focus,
.filter-wrapper:focus .e-ie-filter-canvas,
.filter-wrapper:focus canvas,
.filter-wrapper canvas:focus {
  border-color: $image-editor-filter-canvas-focus !important; /* stylelint-disable-line declaration-no-important */
}

@if $skin-name == 'fluent2' {
  .e-image-editor .e-toolbar .e-toolbar-items .e-dropdown-btn.e-active {
    background-color: $secondary-bg-color-pressed !important; /* stylelint-disable-line declaration-no-important */
  }
}
