/*
 * https://github.com/morethanwords/tweb
 * Copyright (C) 2019-2021 Eduard Kuzmenko
 * https://github.com/morethanwords/tweb/blob/master/LICENSE
 */

.popup {
  position: fixed!important;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  max-width: none;
  z-index: 3;
  background-color: rgba(0, 0, 0, .3);
  margin: 0;
  padding: 1.875rem;
  box-shadow: none;
  opacity: 0;
  visibility: hidden;
  transition-property: opacity, visibility;
  transition-duration: var(--popup-transition-time), 0s;
  transition-delay: 0s, var(--popup-transition-time);
  transition-timing-function: var(--popup-transition-function);
  overflow: auto;
  display: flex;
  user-select: none;

  &.no-overlay {
    padding: 0;
    background-color: transparent;
    overflow: visible;
  }

  body.animation-level-0 & {
    transition: none;
  }

  &.active {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s, 0s;
    z-index: 4;

    .popup-container {
      transform: translate3d(var(--translateX), 0, 0);
    }
  }

  &.hiding {
    .popup-container {
      transform: translate3d(var(--translateX), 0, 0);
    }
  }

  &-title {
    flex: 1;
    padding-inline: 1.5rem 1rem;
    margin: 0;
    font-size: 1.25rem;
    font-weight: var(--font-weight-bold);
    line-height: 1;

    &:first-child {
      padding-left: 0;
    }
  }

  &-container {
    --translateX: 0;
    position: relative;
    /* max-width: 400px; */
    border-radius: $border-radius-medium;
    background-color: var(--surface-color);
    padding: 1rem;
    transform: translate3d(var(--translateX), 3rem, 0);
    backface-visibility: hidden;
    transition: transform var(--popup-transition-time) var(--popup-transition-function);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: auto;
    
    body.animation-level-0 & {
      transition: none;
    }
  }

  &-description {
    .peer-title {
      font-weight: var(--font-weight-bold);
    }
  }

  &-centerer {
    margin: auto;
  }

  &-close {
    z-index: 3;
    justify-self: center;
    flex: 0 0 auto;
  }

  &-header {
    display: flex;
    margin-bottom: 2rem;
    align-items: center;
    flex: 0 0 auto;
    position: relative;
  }

  &-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;

    .scrollable {
      position: relative;
    }

    .scrollable-y-bordered {
      &:last-child {
        border-bottom: none;
      }
    }
  }

  &-buttons {
		display: flex;
    flex-direction: row-reverse;
    justify-content: flex-start;
    align-items: center;
    height: 3rem;
    padding: 0 .5rem;

		.btn {
      font-weight: var(--font-weight-bold);
			padding: 0 1rem;
			text-transform: uppercase;
			border-radius: $border-radius-medium;
      position: relative;
      max-width: 100%;
      height: 2.5rem;
      @include text-overflow();

			& + .btn {
        margin-inline-end: .625rem;
			}
		}
  }
}
