@import "../../../../styles/index.scss";

.table-left-panel-container {
  background: $whiteColor;
  border-radius: $borderRadiusLarge; // 12px
  position: relative;
  box-shadow: 12px 13px 45px -1px $boxShadowLight; // rgba(64, 43, 112, 0.11) → closest shadow var
  overflow: hidden;
  width: 350px;
  max-width: 350px;

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: $borderRadiusLarge;
    padding: 1px; // border thickness
    /* * -webkit-mask usage: *
     We create two layers of mask using gradients. 
     * 1. The first gradient (#000) applied to the content-box makes the inner area visible. 
     * 2. The second gradient (#000) applied to the full box covers everything. * 
     * Then with xor (exclude), the overlapping part is removed, *
      leaving only the outer edges visible. *
       * The result: only the border area shows the gradient, 
       * the inside stays transparent (so the background/content is visible). */
    background: linear-gradient(
      to bottom,
      rgba($primaryColor, 0.6),
      rgba($primaryColor, 0.2),
      rgba($primaryColor, 0)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box,
      linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
  }
  .ia-styles.ia-btn.ia-btn-tertiary,
  .ia-styles.ia-btn.ia-btn-tertiary:hover {
    background: none !important;
    // border: none !important;
    box-shadow: none !important;
  }
}

// Header Navigation Styles
.chat-header-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid $disabledSecondaryBorder;
  background: $whiteColor;
  border-top-right-radius: 10px;
  border-top-left-radius: 10px;
  height: 64px;

  .nav-left {
    display: flex;
    align-items: center;
    gap: 0;

    button {
      border: none !important;
      background: none;
      box-shadow: none;
    }
  }

  .nav-title {
    font-size: 16px;
    color: $darkColor;
    margin: 0;
    font-weight: 800;
    line-height: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 132px;
  }

  .nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;

    button {
      border: none !important;
      background: none;
      box-shadow: none;
    }
  }

  .nav-icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: $inputInfoColor;
    transition: all 0.2s ease;

    &:hover {
      color: $primaryColor;
    }

    &:focus {
      outline-offset: 1px;
    }
  }

  .chat-button {
    background: $primaryColor !important;
    color: $whiteColor !important;
    border-radius: $borderRadius !important;
    padding: 6px 12px !important;
    font-size: 14px !important;
    font-weight: $normalFontWeight !important;
    box-shadow: none !important;
    width: 77px;
    height: 32px;

    &:hover {
      background: darken($primaryColor, 5%) !important;
    }

    .ia-btn-icon {
      margin-right: 4px;
    }
  }
  .impact_inputbox_container_with_icons {
    width: 100%;
  }
}

.channel_list {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-radius: $borderRadius;
  background: $inactiveInputBackground;
}
.chat_list {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-radius: $borderRadius;
}

.chat-channel-item,
.chat_list,
.channel_list {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-radius: $borderRadius;

  .ia-styles.ia-avatar {
    background: $inputInfoColor;
    border-radius: $borderRadiusLarge;
  }

  &:hover {
    background: $lightBlueColor;
    .ia-styles.ia-avatar {
      background: $primaryColor;
    }
    .unread-badge {
      background: $primaryColor;
    }
  }

  &.selected {
    background: $lightBlueColor;

    .ia-styles.ia-avatar {
      background: $primaryColor;
    }
    .unread-badge {
      background: $primaryColor;
    }
  }

  &.muted {
    opacity: 0.7;
  }

  &:focus {
    outline-offset: -2px;
  }

  &:last-child {
    border-bottom: none;
  }
}

.channel-checkbox {
  display: flex;
  align-items: center;
  padding-top: 2px;

  input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border: 1px solid $disabledSecondaryBorder;
    border-radius: 3px;
    cursor: pointer;
    accent-color: $primaryColor;

    &:checked {
      background: $primaryColor;
      border-color: $primaryColor;
    }
  }
}

.channel-avatar {
  flex-shrink: 0;
  margin-top: 2px;
  border-radius: $borderRadiusLarge;

  .ia-avatar {
    width: 32px !important;
    height: 32px !important;
    font-size: 14px !important;
    font-weight: $semiBoldFontWeight !important;
  }
}

.channel-content {
  flex: 1;
  min-width: 0;
}

.channel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.channel-title {
  font-size: 16px;
  font-weight: $semiBoldFontWeight;
  color: $darkColor;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  height: 24px;
  line-height: 24px;
}

.channel-meta {
  &.selected {
    background: $lightBlueColor;
  }
}

.muted-icon {
  color: $inputInfoColor;
  font-size: 16px !important;
}

.unread-badge {
  background: $inputInfoColor;
  color: $whiteColor;
  font-size: 10px;
  font-weight: $regularFontWeight;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.channel-subtitle {
  font-size: 12px;
  color: $inputInfoColor;
  margin: 0 0 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 16px;
  font-weight: $normalFontWeight;
}

.channel-time {
  font-size: 12px;
  color: $lightGrayColor;
  font-weight: $normalFontWeight;
  line-height: 16px;
}

// Responsive adjustments
@media (max-width: 768px) {
  .chat-header-navigation {
    .nav-title {
      font-size: 15px;
    }

    .chat-button {
      padding: 4px 8px !important;
      font-size: 13px !important;
    }
  }

  .chat-channel-item {
    padding: 10px 12px;
  }

  .channel-title {
    font-size: 13px;
  }

  .channel-subtitle {
    font-size: 12px;
  }
}

// Dark mode support (if needed)

.table-left-panel-container {
  background-image: url("../../../../assets/tableChat_bg.svg");
  background-repeat: repeat;
  background-position: center;
  box-shadow: 0px 1px 3px $boxShadowLight;
  background-size: cover;
  position: relative;
}

.chat-header-navigation {
  height: 64px;
  border-bottom-color: $disabledSecondaryBorder;
  padding-left: 16px;
  background: transparent;
  box-shadow: 0px 1px 3px $boxShadowLight;
  position: relative;
  overflow: hidden;
}

.nav-title {
  color: $whiteColor;
}

.chat-channel-list {
  margin: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 150px);
  overflow-y: auto;

  .no-channels-found-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    border-radius: $borderRadius;
    background: $inactiveInputBackground;
    .no-channels-found {
      font-size: 16px;
      font-weight: $semiBoldFontWeight;
      color: $darkColor;
    }
    .no-channels-found-description {
      font-size: 12px;
      color: $inputInfoColor;
      font-weight: $normalFontWeight;
      line-height: 16px;
      text-align: center;
    }
  }
}

.chat-channel-item {
  &:hover {
    background: $destructiveSecondaryFocusOutline;
  }

  &.selected {
    background: $destructiveSecondaryFocusOutline;
  }
}

.channel-time {
  color: $color-text-secondary;
}

.channel-list-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chanel_icon {
  max-height: 32px;
  padding: 8px;
  border-radius: $borderRadius;
  border: 1px solid $deactivateColor;
  background: $whiteColor;
}

.chanel_search {
  height: 32px;
  background: $textButtonPrimaryBg;
  width: 32px;
  border-radius: $borderRadius;
  display: flex;
  justify-content: center;
  align-items: center;

  svg {
    cursor: pointer;
  }
}

.chanel_right_navigation {
  display: flex;
  gap: 8px;
}

.delete_chat_container {
  width: 32px;
  height: 32px !important;
}

.pinnedChat_container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;

  .pinnedChat {
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
    flex-shrink: 0;

    &--active {
      opacity: 1;
    }
  }
}

.chat_list:hover .pinnedChat_container .pinnedChat:not(.pinnedChat--active) {
  opacity: 1;
}
