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

#column-right {
  position: relative;
  overflow: unset;

  @include respond-to(only-small-screens) {
    box-shadow: 0 0.25rem 0.5rem 0.1rem rgba(0, 0, 0, .2);
  }

  @include respond-to(handhelds) {
    body:not(.is-right-column-shown) & {
      transform: translate3d(100vw, 0, 0);
    }
  }

  @include respond-to(floating-left-sidebar) {
    body.is-right-column-shown:not(.is-left-column-shown) & {
      transition: transform var(--transition-standard-in);
      transform: translate3d(0, 0, 0);
    }
  }

  @include respond-to(no-floating-left-sidebar) {
    body.is-right-column-shown & {
      transition: transform var(--transition-standard-in);
      transform: translate3d(0, 0, 0);
    }
  }

  @include respond-to(not-handhelds) {
    width: calc(var(--right-column-width));
    transition: transform var(--transition-standard-out);
    position: absolute;
    inset-inline-end: 0;
    z-index: 3;
    transform: translate3d(calc((var(--right-column-width) + 0.5rem) * var(--reflect)), 0, 0);
    //transform: translate3d(calc(var(--right-column-width) + 1px), 0, 0);
  
    .sidebar-content {
      min-width: var(--right-column-width);
      width: var(--right-column-width);
    }
  
    /* &:not(.active) {
      border-left-width: 0;
    } */
  
    body.animation-level-0 & {
			transition: none;
		}

    /* &:before {
      position: absolute;
      content: " ";
      display: block;
      //height: 56px;
      height: 100vh;
      width: 1px;
      background-color: var(--border-color);
      left: 0px;
      top: 0;
    } */
  }

  @include respond-to(medium-screens) {
    width: calc(var(--right-column-width) + 1px);
    transform: translate3d(calc((var(--right-column-width) + 1px) * var(--reflect)), 0, 0);
    border-inline-start: 1px solid var(--border-color);
  }

  /* @include respond-to(medium-screens) {
    border-left: 1px solid var(--border-color);
  } */

  .sidebar-header {
    flex: 0 0 auto;
  }

  #search-private-container {
    .chatlist-container {
      position: relative;
      flex: 1 1 auto;
    }
  }

  .sidebar-search {
    display: none;

    &.active {
      display: flex;
    }
  }

  .input-wrapper {
    width: 100%;
    max-width: 100%;
    margin: .75rem 0;
    padding: 0 .75rem;
  }
}

.group-permissions-container {
  .range-steps-selector {
    padding-inline: 1.1875rem;
  }
}

.shared-media-container {
  //background-color: var(--background-color-true) !important;
  /* .search-super {
    top: 100%;
    min-height: calc((var(--vh, 1vh) * 100) - 100% - 56px);

    &.sliding {
      max-height: calc((var(--vh, 1vh) * 100) - 100% - 56px);
    }
  } */
  .scrollable:not(.no-parallax) {
    perspective: 0px;
    perspective-origin: left top;

    &.parallax {
      perspective: 1px;
    }
  }

  .profile-content.is-me {
    .profile-name {
      margin-bottom: .9375rem;
    }

    .profile-subtitle {
      display: none;
    }
  }

  .profile-content {
    .search-super {
      top: 100%;
    }
  }

  .search-super {
    min-height: calc((var(--vh, 1vh) * 100) - 56px);

    &-tabs {
      --padding-horizontal: 0;

      .menu-horizontal-div-item {
        border-radius: 0 !important;
      }
    }
  }

  .sidebar-header .transition {
    flex-grow: 1;

    .transition-item {
      display: flex;
      align-items: center;
    }
  }

  .btn-corner {
    z-index: 2;

    @include respond-to(handhelds) {
      width: 54px;
      height: 54px;
      bottom: 14px;
      inset-inline-end: 14px;

      position: fixed !important;
      z-index: 1;
    }
  }

  &.can-add-members {
    .btn-corner:not(.is-hidden) {
      transform: translateZ(0);
    }
  }
}

.search-super {
  width: 100%;
  max-width: 100%;
  position: absolute;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--surface-color);

  .search-group__show-more {
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 400;
  }

  .search-super-month-name {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 1.5rem 0;
    font-weight: var(--font-weight-bold);
    color: var(--secondary-text-color);

    @include respond-to(handhelds) {
      padding: 1rem 1rem 0;
    }
  }

  /* &.sliding {
    max-height: 100%;
  } */

  &.sliding {
    max-height: none !important;
  }

  &-tabs {
    width: auto;
    flex: 1 1 auto;

    // floating design
    // padding: .25rem 0;
    // --padding-horizontal: .25rem;
    
    //margin-top: 36px;
    /* i {
      padding-right: 1.5rem !important;
	    margin-left: -.75rem !important;
    } */
  }

  &-tabs-scrollable {
    box-shadow: none !important;
	  position: sticky !important;
    //top: -1px;
    top: 0px;
    z-index: 2;
    background-color: var(--surface-color);

    &:before {
      position: absolute;
      width: 100%;
      height: 1px;
      inset-inline-start: 0;
      top: 0;
      background-color: inherit;
      display: block;
      content: " ";

      .search-super.is-full-viewport & {
        top: -1px;
      }
    }

    &:before,
    &:after {
      z-index: 0;
    }

    .scrollable {
      position: relative;
      display: flex;
    }

    &.is-single {
      order: 1;
      top: auto;
      // bottom: calc(var(--scrollable-size) * -1);
      bottom: 0;
      transform: translateY(calc(var(--scrollable-size) * -1));
      height: 0;
      opacity: 0;

      @include animation-level(2) {
        transition: opacity var(--transition-standard-in);
      }

      &:before {
        top: -1px;
        background-color: var(--border-color);
      }

      // &:before,
      &:after {
        display: none;
      }

      .search-super-nav-scrollable {
        opacity: 0 !important;
      }

      .search-super-selection-container {
        opacity: 1 !important;
      }

      &.is-selecting:not(.backwards) {
        opacity: 1;
        // transform: translateY(calc(var(--scrollable-size) * -1));
      }
    }
  }

  &-tab-container {
    //height: 100%;
    position: relative;
    min-height: 150px;
    background-color: var(--surface-color) !important;
  }

  &-content-container {
    transform: translateY(0);

    // * fix saving scroll on tab switching, when FROM tab has height < 100vh, and another is scrolled less than the FROM tab's height
    // * adding 1 extra pixel for scroll
    min-height: calc(100vh - 111px);
  }

  &-tabs-container {
    //min-height: 100%;
    min-height: calc(100% - 49px);
    grid-template-rows: 100%;
    flex: 1 1 auto;

    .preloader {
      padding: 0;
      position: absolute !important;
      top: 100px;
      transform: translate(-50%);

      > svg {
        height: 50px;
        width: 50px;
      }
    }
  }

  &-month:first-of-type &-month-name {
    display: none;
  }

  .document-name, 
  .audio-title, 
  .title {
    display: flex;
    justify-content: space-between;
  }

  .sent-time {
    flex: 0 0 auto;
    margin-inline-start: 8px;
    margin-top: 3px;
    font-size: 12px;
    color: var(--secondary-text-color);
  }

  &-content-media {
    .search-super-month-name {
      border: none;
      padding: 9px 0px 7px 24px;
    }

    .grid-item {
      overflow: hidden;
    }

    /* span.video-play {
      background-color: var(--message-time-background);
      color: #fff;
      text-align: center;
      font-size: 34px;
      line-height: 60px;
      cursor: pointer;
    } */
  }

  .video-time {
    position: absolute;
    inset-inline-start: 5px;
    top: 4px;
    height: 18px;
    border-radius: 4px;
    background-color: var(--message-time-background);
    padding: 0px 6px 0px 5px;
    z-index: 2;
    font-size: 12px;
    color: white;
    line-height: 18px;
  }

  &-content-media,
  &-content-stories {
    .checkbox-field {
      inset-inline-end: .25rem;
      top: .25rem;
    }
  }

  .checkbox {
    &-box {
      box-shadow: 0px 0px 3px 0px rgb(0 0 0 / 40%);

      &-border {
        border-color: #fff;
        z-index: 1 !important;
      }

      &-background {
        background-color: var(--green-color);
      }
    }

    &-field {
      position: absolute !important;
      z-index: 2;
      margin: 0;
    }
  }

  /* .document, 
  .audio {
    .checkbox-field {
      top: 50%;
      left: 0;
      margin-left: 2rem;
      margin-top: 1rem;
      transform: translateY(-50%);
    }
  } */

  &-content-media &-month {
    &-items {
      width: 100%;
      padding-top: 1px;

      display: grid;
      grid-template-columns: repeat(3,1fr);
      grid-auto-rows: 1fr;
      grid-gap: 1px;
    }
  }

  &-content-files {
    // padding: 8px 20px;
    .search-super-month-items {
      padding: 8px 24px 16px 20px;

      @include respond-to(handhelds) {
        padding: 8px 16px 8px 12px;
      }
    }

    .document {
      --icon-size: 3rem;
      --icon-margin: .75rem;
      height: calc(48px + 1.5rem);

      &-ico, 
      &-download {
        border-radius: 5px !important;
      }

      /* & + .document {
        margin-top: 1.5rem;
      } */
    }

    .document-name {
      font-weight: normal;

      width: 100%;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }

  &-content-links {
    // padding: 0 24px 15px 15px;

    .search-super-item {
      display: flex;
      flex-direction: column;
      padding-inline-start: 4.4375rem;
      position: relative;
      overflow: hidden;
      min-height: 4.375rem;
      cursor: pointer;
      justify-content: flex-start;
    }

    .row-media {
      height: 3rem;
      width: 3rem;
      border-radius: .375rem;
      overflow: hidden;
      position: absolute;
      inset-inline-start: .6875rem;

      &.empty {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 2rem;
        color: #fff;
        text-transform: uppercase;
        background-color: var(--primary-color);
      }
    }

    .media-photo {
      object-fit: cover;
      width: 100%;
      height: 100%;
      border-radius: inherit;
    }

    .row-title {
      margin-top: .1875rem;
    }

    .row-subtitle {
      overflow: hidden;
      white-space: pre-wrap;
      text-overflow: ellipsis;
      word-break: break-word;
    }

    .sent-time {
      margin: 1px 0 0;
    }

    .sender-title {
      display: block;
      margin-top: .25rem;
    }

    .checkbox-field {
      padding: 0 !important;
      margin: 2rem 0 0 -1.75rem !important;
      --offset-left: 0 !important;
    }

    @include respond-to(not-handhelds) {
      .search-super-month-items {
        margin: .5625rem;
      }
    }

    @include respond-to(handhelds) {
      .search-super-month-name {
        padding: .875rem 1rem;
      }
    }
  }

  &-content-music,
  &-content-voice {
    .search-super-month-items {
      padding: 20px 15px 0px 20px;

      @include respond-to(handhelds) {
        padding: 20px 15px 0px 12px;
      }
    }

    .audio {
      /* min-height: 58px; */
      justify-content: unset;
      margin-bottom: 1.5rem;

      @include respond-to(not-handhelds) {
        max-width: 377px;
      }

      &.audio-show-progress .audio-subtitle {
        overflow: visible;
      }

      /* &-no-subtitle {
        padding-bottom: 16px;
      } */
    }
  }

  &-content-members,
  &-content-groups {
    .chatlist {
      padding-top: .5rem;
      padding-bottom: .5rem;
    }
  }

  &-content-stories {
    .grid {
      grid-gap: 1px;

      &-item {
        // padding-bottom: 177.77777778%;
        padding-bottom: 136.36363636%;
      }

      &.one {
        grid-template-columns: repeat(1, 1fr);

        .grid-item {
          padding-bottom: 100%;
          display: flex;
          justify-content: center;

          &-media {
            object-fit: contain;
            width: auto;
            inset-inline: auto auto;
          }
        }
      }

      &.two {
        grid-template-columns: repeat(2, 1fr);
      }
    }
  }

  &-content-similar,
  &-content-savedDialogs,
  &-content-saved {
    padding: .5rem 0;
  }

  &-content-saved {
    .checkbox-field {
      --offset-left: 1.5rem !important;
      margin-top: 2.25rem !important;
    }
  }

  &-tabs-scrollable {
    .search-super-nav-scrollable {
      opacity: 1;
      height: var(--scrollable-size);
      max-height: var(--scrollable-size);
      // background-color: inherit;
    }

    .search-super-nav-scrollable,
    .search-super-selection-container {
      @include animation-level(2) {
        transition: opacity .2s ease-in-out;
      }
    }

    &.is-selecting {
      &:not(.backwards) {
        .search-super-nav-scrollable {
          opacity: 0;
          // pointer-events: none;
        }
  
        .search-super-selection-container {
          opacity: 1;
        }
      }
    }
  }

  &.is-selecting {
    .anchor-url {
      pointer-events: none;
    }

    // .row {
    //   &:not(.menu-open) {
    //     background-color: transparent !important;
    //   }
    // }
  }

  &-selection {
    &-container {
      background-color: inherit;
      position: absolute;
      height: var(--scrollable-size);
      top: 0;
      right: 0;
      left: 0;
      // z-index: -1;

      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 1rem;
      opacity: 0;

      .btn-icon + .btn-icon {
        margin-inline-start: .5rem;
      }

      @include respond-to(handhelds) {
        padding: 0 .5rem;
      }
    }

    &-count {
      flex-grow: 1;
      font-weight: var(--font-weight-bold);
      color: var(--primary-text-color);
      white-space: nowrap;
      // text-transform: capitalize;
      margin-inline-start: 1.5rem;
    }
  }
}

#search-container {
  .search-super-content-music {
    .audio:not(.audio-show-progress) {
      .audio-time, 
      .audio-description:before {
        display: none;
      }
    }
  }

  .search-group.is-short {
    .chatlist-chat:nth-child(n + 4) {
      display: none;
    }
  }
  .search-group.is-short-5 {
    .chatlist-chat:nth-child(n + 6) {
      display: none;
    }
  }
}

#stickers-container {
  .sticker-sets {
    display: flex;
    flex-direction: column;
    margin-top: 16px;
  }

  .sticker-set {
    display: flex;
    flex-direction: column;
    height: 140px;
    cursor: pointer;

    &-name {
      font-weight: var(--font-weight-bold);
    }

    &-count {
      font-size: 14px;
      color: var(--secondary-text-color);  
    }

    &-header {
      display: flex;
      padding-left: 16px;
      padding-bottom: 12px;
      justify-content: space-between;
  
    }

    &-button {
      height: 30px;
      padding-left: 12px;
      padding-right: 13px;
      margin-right: 16px;
      font-size: 15px;
      border-radius: 16px;
      font-weight: 400;
      width: auto;
      transition: width 0.2s;

      &.gray {
        background: #F1F3F4;
        color: var(--secondary-text-color);
      }
    }

    &-stickers {
      display: flex;
      justify-content: space-around;
    }

    &-sticker {
      width: 68px;
      height: 68px;
      position: relative;
      //padding: 0 5px;  

      &:hover {
        border-radius: 12px;
        background-color: var(--light-secondary-text-color);
      }

      img {
        max-width: 100%;
        max-height: 100%;
      }
    }
  }
}

#poll-results-container {
  .poll-results {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
  
    &-answer {
      color: var(--secondary-text-color);
      padding: 0 16px 8px 16px;
      margin: 0;
      font-weight: var(--font-weight-bold);
      justify-content: space-between;
      display: flex;
      font-size: 15px;
      user-select: none;

      @include respond-to(not-handhelds) {
        padding: 0 24px 8px 24px;
      }
    }

    &-more {
      margin: 0 .5rem;
      width: auto;

      @include respond-to(handhelds) {
        margin: 0;
        border-radius: 0;
      }
    }

    h3 {
      padding: 0 16px;
      margin-top: 15px;
      font-size: 20px;
      margin-bottom: 16px;

      @include respond-to(not-handhelds) {
        padding: 0 24px;
      }
    }
  
    hr {
      margin-bottom: 15px;
      margin-top: 7px;
      display: block !important;
    }
  }
}

.edit-peer-container {
  .input-wrapper {
    margin-bottom: .5625rem !important;
  }

  .sidebar-left-section {
    padding: 0 0 .5rem;
  }

  .chatlist-new {
    padding: 0;
  }
}

.chat-requests-container {
  .chatlist-chat.no-wrap {
    min-height: 5.75rem;
    padding-bottom: 2.25rem !important;

    .chatlist-chat-buttons {
      position: absolute;
      bottom: .5rem;
      display: flex;
    }

    .btn-control-small {
      margin-inline-end: .5rem;
    }
  }
}

.edit-contact-container {
  .input-wrapper {
    margin-top: 1.8125rem !important;
  }

  .avatar-placeholder {
    filter: none !important;
  }

  .avatar-edit {
    margin-bottom: 1.375rem !important;
  }

  .profile-name {
    font-size: 1.5rem;
    line-height: var(--line-height);
  }
}

.group-type-container {
  .sidebar-left-section-caption {
    font-size: .875rem;
    margin-top: .8125rem;
  }

  .input-wrapper {
    margin-top: .875rem !important;
  }
}

.chat-discussion-container {
  .sticker-container {
    width: 120px;
    height: 120px;
    margin-top: 1rem;
  }

  .caption {
    margin-bottom: 1rem;
  }
}

.statistics {
  &-container {
    .sidebar-left-section-name {
      color: var(--primary-text-color);
      margin: 0 -.5rem;
    }

    .sidebar-left-section-name-right {
      font-size: var(--font-size-14);
      line-height: var(--line-height-14);
      align-self: center;
    }
  }

  &-overview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    row-gap: 1.125rem;
    padding: 0 1rem;
    margin: 0.5rem -.5rem;

    &-item {
      display: flex;
      flex-direction: column;
      line-height: 1;
      gap: 4px;
      overflow: hidden;
      min-height: 2.5rem;

      &-value {
        // font-size: var(--font-size-20);
        font-size: var(--font-size-16);
        font-weight: var(--font-weight-bold);

        &-description {
          // font-size: var(--font-size-14);
          font-size: var(--font-size-12);
          font-weight: var(--font-weight-normal);
          color: var(--secondary-text-color);

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

          &.green {
            color: #4fae4e;
          }
        }
      }

      &-name {
        font-size: var(--font-size-14);
        color: var(--secondary-text-color);
        @include text-overflow(false);
      }
    }
  }

  &-chart {
    margin: 0 -.5rem;
  }

  // &-title {
  //   display: grid;
  //   grid-template-columns: 100%;
  //   grid-template-rows: 100%;

  //   &-zoom,
  //   &-text {
  //     opacity: 1;
  //     grid-row-start: 1;
  //     grid-column-start: 1;

  //     @include animation-level(2) {
  //       transition: opacity var(--transition-standard-in);
  //     }
  //   }

  //   &-zoom {
  //     display: flex;
  //     align-items: center;
  //     gap: .25rem;
  //     pointer-events: none;
  //     opacity: 0;
  //     cursor: var(--custom-cursor, pointer);
  //     color: var(--primary-color);

  //     &-icon {
  //       font-size: 1.5rem;
  //     }
  //   }

  //   &.is-zoomed &-text {
  //     opacity: 0;
  //     pointer-events: none;
  //   }

  //   &.is-zoomed &-zoom {
  //     opacity: 1;
  //     pointer-events: all;
  //   }
  // }

  &-post {
    &-title {
      font-weight: var(--font-weight-bold);
    }

    &-media {
      border-radius: $border-radius;

      .media-photo {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
    }

    &-counter {
      display: flex;
      align-items: center;
      gap: .125rem;

      &-icon {
        font-size: var(--font-size-16);
      }
    }

    &-story {
      .statistics-post-media {
        border-radius: 50%;
        padding: 0.125rem;
      }

      .media-container {
        width: 100%;
        height: 100%;
        position: relative;
        border: 2px solid var(--surface-color);
      }

      .avatar-stories-simple {
        --offset: 0px;
      }
    }

    .media-container,
    .media-photo {
      border-radius: inherit;
    }

    .row-title-right {
      font-size: var(--font-size-14);
    }

    .row-subtitle-right {
      display: flex;
      align-items: center;
      gap: .5rem;
    }
  }
}

.boosts {
  &-container {
    .limit-line-container {
      margin-bottom: 1.75rem;
    }
  
    .statistics-overview-item {
      &-value {
        font-size: var(--font-size-20);
  
        &-description {
          font-size: var(--font-size-14);
        }
      }
    }
  }

  &-users {
    &-container {
      .sidebar-left-section {
        padding: 0 !important;
  
        &-content {
          margin: 0 !important;
        }
      }
    }

    &-tabs {
      justify-content: flex-start;
      padding: 0;
    }

    &-tab {
      flex: 0 0 auto;
      border-radius: 0 !important;
    }

    &-content {
      min-height: 3rem;
      padding: .5rem;

      @include respond-to(handhelds) {
        padding-inline: 0;
      }

      &.is-empty {
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }
  }

  &-user {
    &-title {
      display: flex;
      align-items: center;
      font-weight: var(--font-weight-bold);
    }

    &-badge {
      color: var(--primary-color);
      background-color: rgba(var(--primary-color-rgb), .2);
      padding-inline: .25rem .5rem;
      height: 1.25rem;
      font-size: var(--font-size-14);
      font-weight: var(--font-weight-bold);
      display: inline-flex;
      align-items: center;
      margin-inline-start: .375rem;
      border-radius: 1.5rem;
      flex: 0 0 auto;
      position: relative;

      &-right {
        height: 1.5rem;
        padding-inline: .5rem .75rem;
        gap: .25rem;

        &.is-gift {
          color: #d08a31;
          background-color: rgba(208, 138, 49, .2);
        }
      }
    }

    &-boosts {
      color: #fff;
      background-color: var(--premium-color);
    }

    &-name {
      @include text-overflow(true);
    }
  }

  &-no-boosters {
    color: var(--secondary-text-color);
    font-size: var(--font-size-14);
    text-align: center;
  }
}
