/*
 * TCHAT NAVIGATION
 *
 * UI/UX navigation utama TChat.
 *
 * Satu file navigasi aktif.
 * Tidak membuat sistem navigasi tambahan.
 */


/* =========================================================
   MOBILE NAV DEFAULT
   ========================================================= */

/*
 * Mobile navigation dibuat oleh navigation-v2.js
 * tetapi secara default HARUS tersembunyi.
 *
 * Ini penting agar mobile navigation tidak bocor
 * ke tampilan desktop.
 */

.tchat-mobile-nav-v2 {
  display: none;
}


/* =========================================================
   DESKTOP APP LAYOUT
   ========================================================= */

@media (min-width: 721px) {

  /*
   * Struktur:
   *
   * [ NAV RAIL ] [ SIDEBAR CHAT ] [ CHAT PANE ]
   */

  #app.app {
    display: flex;

    width: 100%;
    max-width: 1500px;

    margin: 0 auto;

    overflow: hidden;
  }


  /*
   * Navigation rail kiri.
   */

  .tchat-nav-v2-rail {

    width: 64px;
    min-width: 64px;

    flex: 0 0 64px;

    height: 100%;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: space-between;

    background: #ffffff;

    border-right: 1px solid #e6e9ed;

    padding: 10px 7px;

    position: relative;

    z-index: 10;
  }


  /*
   * Bagian atas rail.
   */

  .tchat-nav-v2-top {

    width: 100%;

    display: flex;
    flex-direction: column;

    align-items: center;

    gap: 12px;
  }


  /*
   * Logo.
   */

  .tchat-nav-v2-logo {

    width: 44px;
    height: 44px;

    padding: 5px;

    border: 0;
    border-radius: 13px;

    background: transparent;

    display: grid;
    place-items: center;

    cursor: pointer;

    transition:
      background .15s ease,
      transform .15s ease;
  }


  .tchat-nav-v2-logo:hover {

    background: #f1f4f7;

    transform: translateY(-1px);
  }


  .tchat-nav-v2-logo img {

    width: 34px;
    height: 34px;

    display: block;
  }


  /*
   * Divider.
   */

  .tchat-nav-v2-divider {

    width: 34px;
    height: 1px;

    background: #edf0f3;

    margin: 1px 0 3px;
  }


  /*
   * Menu utama.
   */

  .tchat-nav-v2-menu {

    width: 100%;

    display: flex;
    flex-direction: column;

    align-items: center;

    gap: 5px;
  }


  /*
   * Tombol navigation.
   */

  .tchat-nav-v2-item {

    position: relative;

    width: 50px;
    height: 50px;

    padding: 0;

    border: 0;
    border-radius: 14px;

    background: transparent;

    color: #697586;

    display: flex;

    align-items: center;
    justify-content: center;

    cursor: pointer;

    transition:
      background .15s ease,
      color .15s ease,
      transform .15s ease;
  }


  .tchat-nav-v2-item:hover {

    background: #f2f4f7;

    color: #17202a;
  }


  .tchat-nav-v2-item.active {

    background: #eef5ff;

    color: #0b6bff;
  }


  /*
   * Icon.
   */

  .tchat-nav-v2-icon {

    width: 24px;
    height: 24px;

    display: grid;
    place-items: center;

    color: currentColor;

    line-height: 1;

  }


  .tchat-nav-v2-icon svg {

    width: 22px;
    height: 22px;

    display: block;

    color: currentColor;

  }


  /*
   * Tooltip.
   */

  .tchat-nav-v2-item::after {

    content: attr(data-tooltip);

    position: absolute;

    left: calc(100% + 9px);

    top: 50%;

    transform:
      translateY(-50%)
      translateX(-4px);

    padding: 7px 10px;

    background: #17202a;

    color: #ffffff;

    border-radius: 8px;

    font-size: 11px;

    font-weight: 600;

    white-space: nowrap;

    opacity: 0;

    pointer-events: none;

    transition:
      opacity .12s ease,
      transform .12s ease;

    z-index: 1000;
  }


  .tchat-nav-v2-item:hover::after {

    opacity: 1;

    transform:
      translateY(-50%)
      translateX(0);
  }


  /*
   * Bagian bawah rail.
   */

  .tchat-nav-v2-bottom {

    width: 100%;

    display: flex;

    flex-direction: column;

    align-items: center;

    gap: 6px;
  }


  /*
   * Profile avatar.
   */

  .tchat-nav-v2-profile {

    width: 42px;
    height: 42px;

    padding: 0;

    border-radius: 50%;

    border: 1px solid #dfe5eb;

    background: #e8edf3;

    color: #17202a;

    display: grid;

    place-items: center;

    font-size: 14px;

    font-weight: 800;

    cursor: pointer;

    transition:
      background .15s ease,
      transform .15s ease,
      box-shadow .15s ease;
  }


  .tchat-nav-v2-profile:hover {

    background: #eef2f6;

    transform: translateY(-1px);

    box-shadow:
      0 4px 12px rgba(0,0,0,.08);
  }


  /*
   * Sidebar setelah navigation rail.
   */

  #app .tchat-nav-v2-rail + .sidebar {

    width: 360px;
    min-width: 360px;

    flex: 0 0 360px;

    border-right: 1px solid #e6e9ed;
  }


  /*
   * Chat pane desktop.
   */

  #app .chat-pane {

    display: flex !important;

    flex: 1 1 auto;

    min-width: 0;
  }


  /*
   * Sidebar tidak melebar ketika chat belum dipilih.
   */

  #app:not(.chat-open)
  .tchat-nav-v2-rail + .sidebar {

    width: 360px !important;

    min-width: 360px !important;

    flex: 0 0 360px !important;

    border-right:
      1px solid #e6e9ed !important;
  }


  /*
   * Tombol kembali chat tetap tersedia di desktop.
   *
   * Sistem tombol kembali sudah diatur oleh
   * chat-back-v1.js agar desktop dan mobile seragam.
   */

  #app.chat-open .chat-head #backBtn {

    display: grid !important;

    place-items: center !important;

    visibility: visible !important;

    opacity: 1 !important;
  }


  /*
   * PENTING:
   *
   * Mobile navigation TIDAK boleh muncul
   * pada desktop dalam kondisi apa pun.
   */

  .tchat-mobile-nav-v2 {

    display: none !important;
  }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 720px) {

  /*
   * Rail desktop disembunyikan.
   */

  .tchat-nav-v2-rail {

    display: none !important;
  }


  /*
   * Bottom navigation mobile.
   */

  .tchat-mobile-nav-v2 {

    position: fixed;

    left: 0;
    right: 0;
    bottom: 0;

    height: 66px;

    padding:
      6px
      max(8px, env(safe-area-inset-right))
      max(7px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));

    background: #ffffff;

    border-top: 1px solid #e6e9ed;

    box-shadow:
      0 -4px 18px rgba(0,0,0,.05);

    z-index: 100;

    display: flex;

    align-items: stretch;

    justify-content: space-around;
  }


  /*
   * Item mobile.
   */

  .tchat-mobile-nav-v2-item {

    flex: 1;

    max-width: 110px;

    padding: 4px 5px;

    border: 0;

    border-radius: 12px;

    background: transparent;

    color: #697586;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 3px;

    font-size: 10px;

    font-weight: 700;

    cursor: pointer;

    transition:
      background .15s ease,
      color .15s ease;
  }


  .tchat-mobile-nav-v2-item:hover {

    background: #f3f5f7;
  }


  .tchat-mobile-nav-v2-item.active {

    background: #eef5ff;

    color: #0b6bff;
  }


  /*
   * Icon mobile.
   */

  .tchat-mobile-nav-v2-icon {

    width: 22px;
    height: 22px;

    display: grid;
    place-items: center;

    color: currentColor;

    line-height: 1;

  }


  .tchat-mobile-nav-v2-icon svg {

    width: 21px;
    height: 21px;

    display: block;

    color: currentColor;

  }


  /*
   * Beri ruang untuk bottom navigation.
   */

  #app .chat-list {

    padding-bottom: 72px;
  }


  /*
   * Saat chat dibuka:
   *
   * bottom navigation hilang.
   *
   * Tombol back di header dipakai.
   */

  #app.chat-open
  .tchat-mobile-nav-v2 {

    display: none !important;
  }

}


/* =========================================================
   VERY SMALL MOBILE
   ========================================================= */

@media (max-width: 420px) {

  .tchat-mobile-nav-v2 {

    height: 62px;
  }


  .tchat-mobile-nav-v2-item {

    font-size: 9px;
  }


  .tchat-mobile-nav-v2-icon {

    font-size: 18px;
  }

}

/* =========================================================
   PROFILE MENU + LOGOUT
   ========================================================= */

@media (min-width: 721px) {

  .tchat-nav-v2-profile-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .tchat-nav-v2-profile {
    position: relative;
    z-index: 2;
  }

  .tchat-profile-menu {
    position: absolute;
    left: 56px;
    bottom: 0;
    width: 260px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid #e2e7ec;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(23, 32, 42, .14);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px) scale(.98);
    transform-origin: left bottom;
    transition:
      opacity .16s ease,
      transform .16s ease,
      visibility .16s ease;
    z-index: 2000;
  }

  .tchat-profile-menu.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .tchat-profile-menu-head {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
  }

  .tchat-profile-menu-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e8edf3;
    color: #17202a;
    font-size: 14px;
    font-weight: 800;
  }

  .tchat-profile-menu-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .tchat-profile-menu-info strong {
    overflow: hidden;
    color: #17202a;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tchat-profile-menu-info small {
    overflow: hidden;
    color: #697586;
    font-size: 11px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tchat-profile-menu-divider {
    height: 1px;
    margin: 13px 0 9px;
    background: #edf0f3;
  }

  .tchat-profile-logout-slot {
    width: 100%;
  }

  .tchat-profile-logout-slot #logoutBtn {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #4f5d6d;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
    transition:
      background .15s ease,
      color .15s ease;
  }

  .tchat-profile-logout-slot #logoutBtn:hover {
    background: #f3f5f7;
    color: #17202a;
  }

  .tchat-profile-logout-icon {
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
    display: grid;
    place-items: center;
  }

  .tchat-profile-logout-icon svg {
    width: 19px;
    height: 19px;
    display: block;
  }

  .tchat-profile-logout-text {
    line-height: 1.2;
  }

}


@media (max-width: 720px) {

  /*
   * Profile menu desktop tidak boleh bocor ke mobile.
   * Mobile tetap menggunakan navigasi mobile yang sudah ada.
   */

  .tchat-profile-menu {
    display: none !important;
  }

}
