@import '../../styles/common.scss';

.container {
  @include boxSizing;

  display: grid;
  grid: minmax(50px, min-content) / 1fr;

  position: relative;

  background-color: white;

  color: var(--message-bar-text-color, $message-bar-text-color);

  .titleWrapper {
    display: grid;
    grid: 1fr / max-content minmax(50px, 1fr) max-content;

    .title {
      display: grid;
      grid: 1fr / 1fr;
      align-items: center;

      font-size: 16px;

      p {
        all: unset;
        margin: 10px;
        font-size: 16px;
        line-height: 1.3rem;
      }
    }

    .typeIcon {
      display: grid;
      grid: 50px / 50px;
      place-items: center;

      .icon {
        height: 25px;
        width: 25px;
      }
    }

    .header {
      display: grid;
      grid-template-rows: max-content;
      grid-auto-flow: column;
    }
  }

  .body {
    display: grid;
    grid: 1fr / 1fr;

    z-index: 15;

    &.absolute {
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
    }

    font-size: 14px;
    background-color: white;
  }

  // error styling (default)
  &.hasError {
    .titleWrapper {
      background-color: var(
        --message-bar-error-message-bg-color,
        $message-bar-error-message-bg-color
      );

      .typeIcon {
        background-color: var(
          --message-bar-error-icon-bg-color,
          $message-bar-error-icon-bg-color
        );
      }
    }
  }

  // info styling
  &.hasInfo {
    .titleWrapper {
      background-color: var(
        --message-bar-info-message-bg-color,
        $message-bar-info-message-bg-color
      );

      .typeIcon {
        background-color: var(
          --message-bar-info-icon-bg-color,
          $message-bar-info-icon-bg-color
        );
      }
    }
  }

  // success styling
  &.hasSuccess {
    .titleWrapper {
      background-color: var(
        --message-bar-success-message-bg-color,
        $message-bar-success-message-bg-color
      );

      .typeIcon {
        background-color: var(
          --message-bar-success-icon-bg-color,
          $message-bar-success-icon-bg-color
        );
      }
    }
  }

  // warning styling
  &.hasWarning {
    .titleWrapper {
      background-color: var(
        --message-bar-warning-message-bg-color,
        $message-bar-warning-message-bg-color
      );

      .typeIcon {
        background-color: var(
          --message-bar-warning-icon-bg-color,
          $message-bar-warning-icon-bg-color
        );
      }
    }
  }
}
