/*! _sidebar-panel.scss | Vuero | Css ninja 2020-2024 */

/*
    1. Sidebar Panel
    2. Sidebar Panel Dark mode
    3. Generic Panel
    4. Generic Panel Dark Mode
    5. Messaging Sidebar
    6. Messaging Sidebar Dark mode
    7. Collapsed Messaging
*/

[dir='rtl'] {
  .vuero-hamburger {
    margin-left: 1rem;
  }
}

/* ==========================================================================
1. Sidebar Panel
========================================================================== */

.sidebar-panel {
  position: fixed;
  top: 0;
  inset-inline-start: 80px;
  height: 100%;
  width: 240px;
  background: var(--white);
  z-index: 31;

  .inner {
    position: relative;
    height: calc(100vh - 60px);
    width: 240px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--white);

    &::-webkit-scrollbar {
      width: 3px;
    }

    &::-webkit-scrollbar-thumb {
      border-radius: 5px;
      background: rgb(0 0 0 / 20%);
    }
  }

  .navbar-divider {
    width: 75%;
    height: 1px;
    margin: 0 auto;
    background-color: var(--border);
  }
}

/* ==========================================================================
2. Sidebar Panel Dark mode
========================================================================== */

.is-dark {
  .sidebar-panel {
    background: color-mix(in oklab, var(--dark-sidebar), white 5%);
    border-color: color-mix(in oklab, var(--dark-sidebar), white 5%) !important;

    .panel-close {
      .iconify {
        color: var(--muted-grey) !important;
      }
    }

    .subpanel-header {
      background: color-mix(in oklab, var(--dark-sidebar), white 5%);
    }

    .inner {
      background: color-mix(in oklab, var(--dark-sidebar), white 5%);
    }
  }
}

/* ==========================================================================
3. Generic Panel
========================================================================== */

.sidebar-panel {
  &.is-generic {
    .subpanel-header {
      height: 60px;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      padding: 0 20px;

      h3 {
        font-family: var(--font-alt);
        color: var(--light-text);
        font-size: 1.3rem;
      }

      .panel-close {
        margin-inline-start: auto;
        display: block;
        width: 18px;
        height: 18px;

        .iconify {
          width: 18px;
          height: 18px;
        }
      }
    }

    .inner {
      ul {
        padding: 10px 0;
      }

      li {
        height: 36px;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        border-inline-start: 2px solid transparent;
        cursor: pointer;

        &.is-active {
          a {
            font-weight: 500;
            color: var(--primary);
          }

          > a {
            font-weight: 600;
          }
        }

        > a.router-link-exact-active {
          font-weight: 600;
          color: var(--primary);
        }

        &.has-children {
          .is-submenu.router-link-exact-active {
            font-weight: 500;
            color: var(--primary);
          }
        }

        &.divider {
          cursor: default;
          pointer-events: none;
          height: 10px;
          margin: 5px 20px 10px;
          border-bottom: 1px solid rgb(0 0 0 / 15%);

          &.with-label {
            border-bottom: 0;
            margin-top: 25px;

            &::after,
            &::before {
              flex: 0;
            }

            .divider-label {
              font-size: 0.7rem;
            }
          }
        }

        &.has-children {
          display: block;
          height: unset;
          min-height: 36px;
          margin-bottom: 4px;

          &.active {
            .collapse-wrap > a {
              color: var(--dark-text);
              font-weight: 600;

              .iconify {
                transform: rotate(calc(var(--transform-direction) * 90deg)) !important;
              }
            }
          }

          &:hover {
            .collapse-wrap > a {
              color: var(--dark-text);
            }
          }

          &.is-flex {
            display: flex;
            justify-content: space-between;
            align-items: center;

            .tag {
              margin-inline-start: auto;
              margin-inline-end: 20px;
              border-radius: 100px;
              background: var(--danger);
              color: var(--white);
              font-size: 0.8rem;
              font-weight: 600;
            }
          }

          .collapse-wrap {
            display: flex;
            align-items: stretch;
            height: 100%;
            min-height: 36px;

            > a {
              font-family: var(--font-alt);
              display: flex;
              align-items: center;
              font-size: 0.9rem;
              font-weight: 500;
              color: var(--light-text);

              .iconify {
                position: relative;
                top: 1px;
                font-size: 18px;
                margin-inline-start: auto;
                transform: rotate(0);
                color: var(--light-text);
                transition:
                  color 0.3s,
                  background-color 0.3s,
                  border-color 0.3s,
                  height 0.3s,
                  width 0.3s,
                  transform 0.3s;
              }
            }
          }

          ul {
            padding: 0;
            overflow: hidden;

            li {
              height: 32px;
              font-family: var(--font);

              &.is-active,
              .router-link-exact-active {
                .is-submenu {
                  font-weight: 500;

                  .iconify {
                    display: block;
                  }
                }
              }

              .is-submenu {
                display: flex;
                font-weight: 400;
                font-family: var(--font);
                align-items: center;
                padding-inline-start: 32px;
                font-size: 0.9rem;

                &.is-active,
                .router-link-exact-active {
                  font-weight: 500;
                  color: var(--primary);
                }

                .lnil,
                .lnir {
                  font-size: 1.2rem;
                  margin-inline-end: 10px;
                }

                > span {
                  font-family: var(--font);
                }

                .iconify {
                  display: none;
                  height: 8px;
                  width: 8px;
                  max-width: 8px;
                  min-width: 8px;
                  stroke-width: 2px;
                  margin-inline-end: 8px;

                  &.is-auto {
                    margin-inline-start: auto;
                    height: 15px;
                    width: 15px;
                    max-width: 15px;
                    min-width: 15px;
                    stroke-width: 2px;
                    margin-inline-end: 4px;
                  }
                }
              }
            }
          }
        }

        a {
          font-family: var(--font);
          display: block;
          width: 100%;
          padding: 0 20px;
          font-size: 0.95rem;
          color: var(--light-text);

          &:hover,
          &:focus {
            color: var(--dark-text);
          }

          .tag {
            line-height: 1.8;
            height: 1.8em;
            font-size: 0.7rem;
            margin-inline-start: 0.25rem;
          }
        }

        > a {
          font-family: var(--font-alt);
          font-size: 0.9rem;
          font-weight: 500;
          color: var(--light-text);
        }
      }

      .docked-action {
        position: absolute;
        bottom: 0;
        inset-inline-start: 0;
        inset-inline-end: 0;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        height: 64px;
        width: 100%;
        padding: 0 26px 0 16px;
        margin: 0;

        &.has-search {
          bottom: 160px;
        }

        &.action-wrap {
          .button {
            height: 36px !important;

            .iconify {
              height: 16px;
              width: 16px;
              margin-inline-end: 2px;
              margin-inline-start: -2px;
            }
          }
        }
      }
    }
  }
}

/* ==========================================================================
4. Generic Panel Dark Mode
========================================================================== */

.is-dark {
  .sidebar-panel {
    &.is-generic {
      .inner {
        ul {
          li {
            &.is-active {
              a {
                color: var(--primary) !important;
              }
            }

            a.router-link-exact-active {
              color: var(--primary) !important;
            }

            &.has-children {
              &.active {
                .collapse-wrap > a {
                  color: var(--smoke-white);
                }
              }

              &:hover {
                .collapse-wrap > a {
                  color: color-mix(in oklab, var(--dark-dark-text), white 14%);
                }
              }
            }

            a {
              &:hover {
                color: var(--dark-dark-text);
              }
            }

            .is-submenu {
              &:hover {
                color: var(--primary);
              }
            }
          }
        }
      }
    }
  }
}

/* ==========================================================================
5. Messaging Sidebar
========================================================================== */

.sidebar-panel {
  &.is-messages {
    z-index: 21;

    .messages-header {
      height: 60px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 20px;

      h3 {
        color: var(--muted-grey);
        font-size: 1.4rem;
      }

      .vuero-hamburger {
        position: relative;
        top: 2px;
      }
    }

    // Messages inner
    .inner {
      overflow-y: hidden !important;

      #conversations-list {
        position: relative;
        height: 100%;
        overflow-y: auto !important;

        // Webkit scrollbar
        &::-webkit-scrollbar {
          width: 3px;
        }

        &::-webkit-scrollbar-thumb {
          border-radius: 5px;
          background: rgb(0 0 0 / 20%);
        }

        li {
          .recipient-meta {
            span:nth-child(2) {
              max-width: 135px;
              overflow: hidden;
              white-space: nowrap;
              text-overflow: ellipsis;
            }
          }

          .group-message {
            max-width: 230px !important;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
          }
        }
      }

      // New conversation
      .is-new-conversation {
        height: 60px;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        border-bottom: 1px solid rgb(0 0 0 / 5%);
        cursor: pointer;

        .button {
          height: 36px !important;
          margin: 0 20px;

          .iconify {
            height: 16px;
            width: 16px;
            font-size: 16px;
            margin-inline-end: 10px;
            margin-inline-start: -10px;
          }
        }
      }

      // New conversation section
      .new-chat-sidebar {
        overflow: auto;
        height: 100%;

        // Autocomplete
        .is-autocomplete {
          justify-content: center;
          padding: 0 20px;

          &.is-active,
          &:hover {
            background: transparent !important;
          }

          // Control
          .control {
            position: relative;

            .icon {
              position: absolute;
              top: 7px;
              inset-inline-start: 7px;
              color: var(--placeholder);

              .iconify {
                font-size: 20px;
                transition:
                  color 0.3s,
                  background-color 0.3s,
                  border-color 0.3s,
                  height 0.3s,
                  width 0.3s;
              }
            }

            // Input
            .easy-autocomplete {
              width: 100% !important;

              input {
                padding-inline-start: 40px;
                background: var(--fade-grey);
                border: none;
                box-shadow: none;
                color: var(--muted-grey);
                transition:
                  color 0.3s,
                  background-color 0.3s,
                  border-color 0.3s,
                  height 0.3s,
                  width 0.3s;

                &:focus {
                  background: var(--body-color);

                  + .icon {
                    color: var(--primary);
                  }
                }
              }

              // template
              .template-wrapper {
                display: flex !important;
                justify-content: flex-start;
                align-items: center;

                // avatar
                .avatar-wrapper {
                  position: relative;
                  width: 40px !important;
                  height: 40px !important;

                  .autocpl-avatar {
                    width: 40px !important;
                    height: 40px !important;
                    border-radius: var(--radius-rounded) !important;
                  }

                  .avatar-badge {
                    position: absolute;
                    bottom: 0;
                    inset-inline-end: -5px;
                    width: 18px;
                    height: 18px;
                    border: 2px solid var(--white);
                    border-radius: var(--radius-rounded);
                  }
                }

                // text
                .entry-text {
                  margin-inline-start: 15px;

                  span {
                    font-size: 0.8rem;
                    color: var(--title-grey);
                  }
                }
              }
            }
          }

          // List item
          li {
            height: auto !important;
            padding-top: 8px;
            padding-bottom: 8px;
            border-inline-start: none !important;
            border-inline-end: none !important;
          }

          // Container
          .easy-autocomplete-container {
            top: 120% !important;
            border: none !important;

            ul {
              border-radius: var(--radius) !important;
              box-shadow: -1px 3px 10px 0 rgb(0 0 0 / 6%) !important;
            }
          }
        }

        // cancel button
        .is-cancel {
          height: 80px;
          display: flex;
          align-items: center;
          justify-content: center;

          button {
            height: 36px;
            margin: 0 20px;
          }
        }
      }

      // Messages list
      ul {
        overflow: auto;
        height: 100%;
      }

      // Conversation item
      li {
        position: relative;
        height: 64px;

        // height: 70px;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        border-inline-start: 2px solid transparent;
        border-bottom: 1px solid rgb(0 0 0 / 5%);
        cursor: pointer;

        &.is-active {
          border-inline-start-color: var(--primary);
          background: color-mix(in oklab, var(--primary), white 51%);

          &:hover,
          &:focus {
            background: color-mix(in oklab, var(--primary), white 51%);
          }
        }

        // conversation block
        .recent-user {
          position: relative;
          width: 100%;
          display: flex;
          justify-content: flex-start;
          align-items: center;
          padding-inline-start: 20px;
          cursor: pointer;

          // Avatar
          .user-container {
            position: relative;

            img {
              height: 36px;
              width: 36px;
              border-radius: var(--radius-rounded);
              display: block;

              &.is-user {
                min-width: 36px;
              }

              &.is-badge {
                display: block;
                position: absolute;
                inset-inline-end: -5px;
                bottom: 0;
                border: 2px solid var(--white);
                height: 16px;
                width: 16px;
                border-radius: var(--radius-rounded);
              }
            }
          }

          .recipient-meta {
            margin-inline-start: 10px;

            span {
              display: block;

              &:first-child {
                color: var(--dark-text);
                font-weight: 500;
                font-size: 0.9rem;
              }

              &:nth-child(2) {
                font-size: 0.75rem;
                color: var(--muted-grey);

                /* &.is-unread {
                                    color: var(--dark-text);
                                    font-weight: 500;
                                } */
              }
            }

            // Timstamp

            /* time {
                            display: block;
                            position: absolute;

                            // top: 2px;
                            top: -14px;
                            inset-inline-end: 20px;
                            font-size: .75rem;
                            color: var(--muted-grey);
                        } */
          }
        }

        // user group
        .user-group {
          position: relative;
          width: 100%;
          display: flex;
          justify-content: flex-start;
          align-items: center;
          margin-inline-start: 20px;
          cursor: pointer;

          img {
            height: 36px;
            width: 36px;
            border: 3px solid var(--white);
            border-radius: var(--radius-rounded);
            display: block;

            &.is-user {
              min-width: 36px;
            }

            &:nth-child(2),
            &:nth-child(3),
            &:nth-child(4) {
              margin-inline-start: -15px;
            }
          }

          // More Indicator
          .more-indicator {
            height: 36px;
            width: 36px;
            min-width: 36px;
            border-radius: var(--radius-rounded);
            background: var(--primary);
            display: flex;
            justify-content: center;
            align-items: center;
            margin-inline-start: -15px;
            border: 2px solid var(--white);

            span {
              display: block;
              color: var(--white);
              font-weight: 600;
              font-size: 0.8rem;
            }
          }
        }

        // Timestamp
        time {
          display: block;
          position: absolute;
          top: 2px;
          inset-inline-end: 20px;
          font-size: 0.75rem;
          color: var(--muted-grey);
        }

        // Group message
        .group-message {
          padding: 0 20px;
          margin-top: -20px;
          font-size: 0.75rem;
          color: var(--muted-grey);

          &.is-unread {
            color: var(--dark-text);
            font-weight: 500;
          }
        }

        // Conversation item hover state
        &:hover {
          background: #fafafa;
        }
      }
    }
  }
}

/* ==========================================================================
6. Messaging Sidebar Dark mode
========================================================================== */

.is-dark {
  .sidebar-panel {
    &.is-messages {
      li {
        &.is-active {
          background: color-mix(in oklab, var(--dark-sidebar), white 10%) !important;

          &:hover,
          &:focus {
            background: color-mix(in oklab, var(--dark-sidebar), white 10%) !important;
          }

          img,
          .more-indicator {
            border-color: color-mix(in oklab, var(--dark-sidebar), white 10%) !important;
          }
        }

        &:hover {
          background: color-mix(in oklab, var(--dark-sidebar), white 6%) !important;
        }

        img,
        .more-indicator {
          border-color: color-mix(in oklab, var(--dark-sidebar), white 6%) !important;
        }

        .more-indicator {
          background: var(--primary) !important;
        }

        .recipient-meta {
          span {
            &:first-child {
              color: color-mix(in oklab, var(--primary-grey), white 6%) !important;
            }

            &.is-unread {
              color: color-mix(in oklab, var(--primary-grey), white 6%) !important;
            }
          }
        }
      }

      .start-conversation {
        background: var(--primary) !important;
        border: 1px solid var(--primary) !important;
      }
    }
  }
}

/* ==========================================================================
7. Collapsed Messaging
========================================================================== */

.collapsed-messaging {
  position: fixed;
  top: 0;
  inset-inline-start: 80px;
  height: 100%;
  width: 80px;
  background-color: var(--body-color);
  box-shadow: none;
  z-index: 24;
  border-inline-start: 1px solid var(--fade-grey);
  transform: translateX(calc(var(--transform-direction) * -100%));
  transition: all 0.3s; // transition-all test

  &.is-active {
    transform: translateX(calc(var(--transform-direction) * 0));
  }

  .inner {
    position: relative;
    height: 100%;
    width: 100%;

    .collapsed-menu {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 60px;
      width: 100%;
    }

    .collapsed-add {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 64px;
      width: 100%;

      .button {
        height: 36px;
        width: 36px;
        border-radius: var(--radius-rounded);
        padding: 4px;
        transition: all 0.3s; // transition-all test

        &:hover {
          box-shadow: var(--primary-box-shadow);
        }

        .iconify {
          font-size: 18px;
          height: 18px;
          width: 18px;
        }
      }
    }

    .collapsed-conversations {
      height: calc(100vh - 80px);

      li {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 64px;
        border-inline-start: 2px solid transparent;
        transition: all 0.3s; // transition-all test
        cursor: pointer;

        &.is-active {
          border-inline-start-color: var(--primary);
          background: color-mix(in oklab, var(--primary), white 51%);

          &:hover,
          &:focus {
            background: color-mix(in oklab, var(--primary), white 51%);
          }
        }

        // Avatar
        .user-container {
          position: relative;

          img {
            height: 36px;
            width: 36px;
            border-radius: var(--radius-rounded);
            display: block;

            &.is-user {
              min-width: 36px;
            }

            &.is-badge {
              display: block;
              position: absolute;
              inset-inline-end: -5px;
              bottom: 0;
              border: 2px solid var(--white);
              height: 16px;
              width: 16px;
              border-radius: var(--radius-rounded);
            }
          }

          .is-count {
            position: absolute;
            inset-inline-end: -12px;
            bottom: -5px;
            border-radius: var(--radius-rounded);
            border: 2px solid var(--white);
            height: 28px;
            width: 28px;
            background: var(--primary);
            display: flex;
            justify-content: center;
            align-items: center;

            span {
              display: block;
              font-size: 0.7rem;
              font-size: 700;
              color: var(--smoke-white);

              &::before {
                content: '+';
              }
            }
          }
        }
      }
    }
  }
}

@media only screen and (width >= 768px) and (width <= 1024px) and (orientation: landscape) {
  .collapsed-messaging {
    width: 60px;
    left: 60px;
  }
}
