/* ======================================================================== *
 * Copyright 2025 HCL America Inc.                                          *
 * Licensed under the Apache License, Version 2.0 (the "License");          *
 * you may not use this file except in compliance with the License.         *
 * You may obtain a copy of the License at                                  *
 *                                                                          *
 * http://www.apache.org/licenses/LICENSE-2.0                               *
 *                                                                          *
 * Unless required by applicable law or agreed to in writing, software      *
 * distributed under the License is distributed on an "AS IS" BASIS,        *
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
 * See the License for the specific language governing permissions and      *
 * limitations under the License.                                           *
 * ======================================================================== */

@use "sass:map";
@use "../../common/palette";
@use "../../common/themeMap.module";
@use "../../common/typography";

@mixin enchanted-snackbar-base-styles {
  &::part(snackbar-container) {
    display: flex;
    background-color: palette.clr(dark, background, dark);
    color: white;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    transition: visibility 0s linear 0.3s, opacity 0.3s linear, transform 0.3s ease-out;
    transition-delay: 0s;
    box-shadow: map.get(themeMap.$enchantedPalette, shadows6);
    max-width: 480px;
    margin-bottom: 5px;
  }

  &::part(snackbar-message) {
    @include typography.body2;
    flex-grow: 1;
    text-align: left;
    word-break: break-word;
    white-space: pre-line;
    padding: 2px 0px;
  }

  &::part(snackbar-icon-container) {
    position: relative;
    height: 16px;
    width: 16px;
    display: flex;
    padding: 2px 0px;
    align-items: flex-end;
  }

  &::part(snackbar-icon) {
    height: 16px;
    width: 16px;
    align-items: center;
    position: absolute;
  }

  &::part(snackbar-progress) {
    margin: -10px;
  }

  &::part(icon-info) {
    color: palette.clr(dark, info, inverse);
  }

  &::part(icon-warning) {
    color: palette.clr(dark, warning, inverse);
  }

  &::part(icon-success) {
    color: palette.clr(dark, success, inverse);
  }

  &::part(icon-error) {
    color: palette.clr(dark, error, inverse);
  }

  div[slot="snackbar-buttons"] {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
    height: 20px;

    enchanted-button {
      &::part(button-enchanted-text-inverse), &::part(button-enchanted-text-focused-inverse) {
        border-radius: 2px !important;
        @include typography.subtitle2;
        padding: 2px 4px;
      }
      &::part(button-enchanted-text-focused-inverse) {
        border-radius: 2px;
        outline: 2px solid clr(dark, action, focusInverse);
        outline-offset: 1px;
      }
    }
  }

  &::part(action) {
    display: flex;
    -webkit-box-align: center;
    align-items: center;
    -webkit-box-pack: end;
    justify-content: flex-end;
    flex: 0 0 auto;
    padding: 8px 12px;
  }
}
