#root {
  height: 100%;
}
.subtle {
  opacity: $session-subtle-factor;
}

.soft {
  opacity: 0.4;
}

.text-center {
  text-align: center;
}

.fullwidth {
  width: 100%;
}

.break-word {
  word-break: break-all;
}

input,
textarea {
  caret-color: var(--input-text-color) !important;
}

* {
  user-select: none;

  .text-selectable,
  input,
  textarea {
    user-select: text;
    a {
      word-break: break-all;
    }
  }
}

::selection {
  background: var(--text-selection-color);
}

.overlay {
  display: flex !important;
  z-index: 1;
}

#main-view {
  height: 100vh;
  display: flex;
  flex-grow: 1;
  position: relative;
}

.button-group > div {
  display: inline-flex;
  margin-inline-start: 5px;
  margin-inline-end: 5px;
}

.session-label {
  font-weight: 700;
  color: var(--white-color);
  padding: var(--margins-sm);
  width: 100%;
  border-radius: 2px;
  text-align: center;
  &.primary {
    background-color: var(--primary-color);
  }
  &.danger {
    background-color: var(--danger-color);
  }
}

.session-icon-button {
  cursor: pointer;
  display: inline-block;
  position: relative;
  transform: translateZ(0);
}

/* CONVERSATION AND MESSAGES */
.module-conversation-header {
  height: var(--main-view-header-height);
}

.module-conversation-header__title-flex,
.module-conversation-header__title {
  font-weight: bold;
  width: 100%;
  display: flex;
  font-size: $session-font-md;

  &-text {
    color: var(--text-primary-color);
    font-weight: 400;
    font-size: $session-font-sm;
    line-height: $session-font-sm;
  }

  .module-contact-name {
    width: 100%;
  }

  .module-contact-name__profile-number {
    text-align: center;
  }
}

.module-conversation-header__title {
  flex-direction: column;
}
.module-conversation-header__title-flex {
  flex-direction: row;
}
.module-conversation__user__profile-name,
.module-message__author__profile-name {
  font-style: normal;
}

.module-message--incoming {
  margin-inline-start: 0;
  margin-inline-end: auto;
}
.module-message--outgoing {
  margin-inline-end: 0;
  margin-inline-start: auto;
}

.module-message__container {
  position: relative;
  display: inline-block;
  min-width: 30px;
  // To limit messages with things forcing them wider, like long attachment names.
  width: 100%;
  align-items: center;
  border-radius: var(--border-radius-message-box);
}

label {
  user-select: none;
}

.conversation-header {
  .module-avatar img {
    box-shadow: 0px 0px 5px 0px rgba(255, 255, 255, 0.2);
  }

  .search-icon {
    margin-inline-end: 10px;
  }
}

.module-conversation-header {
  position: relative;
  padding: 0px var(--margins-lg) 0px var(--margins-sm);
}

.title-wrapper {
  position: relative;
}

.hidden {
  display: none;
  visibility: hidden;
}

.session-modal {
  animation: fadein var(--default-duration);
  z-index: 150;
  min-width: 300px;
  box-sizing: border-box;
  max-height: 70vh;
  max-width: calc(min(70vw, 800px));
  font-family: var(--font-default);
  background-color: var(--modal-background-content-color);
  color: var(--modal-text-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: var(--modal-drop-shadow);

  overflow: hidden;
  display: flex;
  flex-direction: column;

  &__header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;

    padding: var(--margins-lg);

    font-family: var(--font-default);
    text-align: center;
    line-height: 18px;
    font-size: var(--font-size-lg);
    font-weight: 500;

    &.reverse {
      flex-direction: row-reverse;

      .session-modal__header__close > div {
        float: right;
      }

      .session-modal__header__icons > div {
        float: left;
        padding-inline-start: 0px;
        padding-inline-end: 10px;
      }
    }

    &__icons,
    &__close {
      width: 60px;
    }
    &__icons {
      float: right;
    }
    &__close > div {
      float: left;
      padding: var(--margins-xs);
      margin: 0px;
    }
    &__icons > div {
      float: right;
      padding-inline-start: 10px;
    }
  }

  &__body {
    padding: 0px var(--margins-lg) var(--margins-lg) var(--margins-lg);
    font-family: var(--font-default);
    line-height: $session-font-md;
    font-size: $session-font-md;
    overflow-y: auto;
    overflow-x: hidden;

    .message {
      text-align: center;
    }

    .session-id-editable {
      width: 30vw;
      max-width: 400px;
    }
  }

  .group-member-list__selection {
    overflow-y: auto;
    width: 100%;
  }

  &__centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    // to allow new lines
    white-space: pre-wrap;
  }

  &__button-group {
    display: flex;
    justify-content: flex-end;

    .session-button {
      margin: var(--margins-xs);
      font-weight: 500;
    }

    &__center {
      display: flex;
      justify-content: center;

      .session-button {
        margin: var(--margins-xs);
      }
    }
  }

  &__text-highlight {
    @include text-highlight(var(--primary-color));

    color: var(--black-color);

    font-family: monospace;
    font-style: normal;
    font-size: $session-font-xs;
  }
}

.session-modal__body {
  display: flex;
  flex-direction: column;
}

.session-confirm {
  &-wrapper {
    .session-modal__body .session-modal__centered {
      text-align: center;
    }
  }

  &-main-message {
    font-size: $session-font-md;
    line-height: 1.5;
  }

  &-sub-message {
    text-align: center;
    margin-top: 20px;
  }
}

.session-dropdown {
  position: relative;
  width: 100%;

  &__label {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    padding: 0px var(--margins-md);
    font-size: var(--font-size-md);

    background-color: var(--right-panel-item-background-color);
    color: var(--right-panel-item-text-color);

    &:hover {
      background: var(--right-panel-item-background-hover-color);
    }
  }

  &__list-container {
    z-index: 99;
    display: block;
    position: absolute;
    top: 50px;
    left: 0px;
    right: 0px;
    list-style: none;
    padding: 0px;
    margin: 0px;
    max-height: 40vh;
    overflow-y: auto;
  }

  &__item {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 35px;
    padding: 0 var(--margins-md);
    background: var(--right-panel-item-background-color);
    color: var(--right-panel-item-text-color);

    font-size: 0.8rem;
    width: -webkit-fill-available;
    transition: var(--default-duration);

    &:first-child {
      border-top: 1px solid var(--border-color);
    }
    &:last-child {
      border-top: 1px solid var(--border-color);
    }

    .session-icon {
      margin-inline-start: 6px;
    }
    .item-content {
      margin-inline-start: 6px;
    }

    &.active,
    &:hover {
      background: var(--right-panel-item-background-hover-color);
    }

    &.danger {
      color: var(--danger-color);
    }
  }

  &:hover {
    background: var(--right-panel-item-background-hover-color);
  }
}

.image-upload-section {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  cursor: pointer;
  width: 80px;
  height: 80px;
  border-radius: 100%;
  background-color: var(--lightbox-background-color);
  opacity: 0;
  transition: var(--default-duration);

  &:after {
    content: 'Edit';
    color: var(--white-color);
  }

  &:hover {
    opacity: 1;
  }
}

.qr-image {
  display: flex;
  justify-content: center;

  background: var(--white-color);
  padding: 0.5rem;
  svg {
    width: 135px;
    height: 135px;
    border-radius: 3px;
    padding: var(--margins-xs);
    background-color: var(--white-color);
  }
}

.conversation-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -40px 0 0 -40px;

  & > div {
    display: block;
  }
}

.session-loader {
  display: inline-block;
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;

  div {
    position: absolute;
    top: 33px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--primary-color);
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
  }
  div:nth-child(1) {
    left: 8px;
    animation: session-loader1 0.6s infinite;
  }
  div:nth-child(2) {
    left: 8px;
    animation: session-loader2 0.6s infinite;
  }
  div:nth-child(3) {
    left: 32px;
    animation: session-loader2 0.6s infinite;
  }
  div:nth-child(4) {
    left: 56px;
    animation: session-loader3 0.6s infinite;
  }
  @keyframes session-loader1 {
    0% {
      transform: scale(0);
    }
    100% {
      transform: scale(1);
    }
  }
  @keyframes session-loader3 {
    0% {
      transform: scale(1);
    }
    100% {
      transform: scale(0);
    }
  }
  @keyframes session-loader2 {
    0% {
      transform: translate(0, 0);
    }
    100% {
      transform: translate(24px, 0);
    }
  }
}

.session-settings {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--background-secondary-color);
}

#qr svg,
.qr-image svg {
  width: $session-modal-size-sm;
  height: $session-modal-size-sm;
  padding: var(--margins-xs);
  background-color: var(--white-color);
  border-radius: 3px;
}

.messages li {
  transition: var(--default-duration) !important;
}

.session-id-editable {
  padding: var(--margins-lg);
  background: var(--input-background-color);
  color: var(--input-text-color);

  textarea {
    width: 30vh;
  }
}
.session-id-editable textarea {
  resize: none;
  overflow: hidden;
  user-select: all;
  overflow-y: auto;
  padding: 0px 5px 20px 5px;

  &.session-id-editable-textarea:placeholder-shown {
    height: 38px;
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 5px;
    padding-right: 5px;
    font-family: var(--font-default);
    color: var(--input-text-placeholder-color);
  }

  &.group-id-editable-textarea {
    margin-top: 15px;
    white-space: nowrap;
  }
}

input {
  user-select: text;
}

.contact-selection-list {
  display: flex;
  flex-direction: column;
  width: 20vw;
}

.session-confirm-wrapper {
  position: absolute;
  height: 100%;
  width: 100%;
  display: flex;

  .session-modal {
    margin: auto auto;
  }
}

.group-member-list {
  &__selection {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
}

.create-group-name-input {
  display: flex;
  justify-content: center;
  width: 100%;

  .session-id-editable {
    height: 60px !important;

    textarea {
      padding-bottom: 0px !important;
    }

    &-disabled {
      border: 1px solid var(--border-color) !important;
    }
  }
}

.module-message__text {
  white-space: pre-wrap;
}
