@import '../../styles/variables';

.container {
  *,
  *:before,
  *:after {
    box-sizing: border-box;
  }

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

  position: relative;

  background-color: white;

  color: var(--message-text-color, $message-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: rgba($error, 0.2);

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

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

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

  // success styling
  &.hasSuccess {
    .titleWrapper {
      background-color: rgba($success, 0.2);

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

  // warning styling
  &.hasWarning {
    .titleWrapper {
      background-color: rgba($warning, 0.2);

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