/* -----------------------------------
App Menu Mobile: 
tampilkan hanya saat layar <= 720px ---*/

/* Default: sembunyikan navbar di semua ukuran */
.bottom-navbar {
  display: none;
}

/* App Menu Mobile: tampilkan hanya saat layar <= 720px */
@media (max-width: 720px) {
  /* Styling utama bottom navbar */
  .bottom-navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #08512f;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: space-around;
    padding: 5px 0;
    z-index: 99999 !important;
    box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.1);
    height: 68px;
  }

  /* Wrapper tiap item menu */
  .bottom-nav-item-wrapper {
    position: relative;
    flex-grow: 1;
    text-align: center;
  }

  /* Link menu utama */
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    color: #fff;
    text-decoration: none;
    padding: 5px 0;
    cursor: pointer;
    user-select: none;
    border-left: 1px solid rgb(255 255 255 / 17%);
    border-right: 1px solid rgb(255 255 255 / 28%);
  }

  /* Ikon menu */
  .bottom-nav-item i {
    font-size: 18px;
    margin-bottom: 2px;
  }

  /* Ikon toggle submenu */
  .submenu-toggle-icon {
    font-size: 12px;
    margin-top: 2px;
    transition: transform 0.3s ease;
  }

  /* Submenu container */
  .submenu {
    position: absolute;
    bottom: 56px;
    left: 0%;
    transform: translateX(-39%);
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    min-width: 520%;
    z-index: 9999;
    display: none;
    flex-direction: column;
    transition: 0.6s ease-out;
  }

  /* Submenu item */
  .submenu-item {
    padding: 10px 30px;
    font-size: 12px;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
  }

  .submenu-item:last-child {
    border-bottom: none;
  }

  .submenu-item:hover {
    background-color: #f0f0f0;
    color: #007bff;
  }

  /* Tampilkan submenu saat aktif */
  .bottom-nav-item-wrapper.active .submenu {
    display: flex;
  }

  /* Rotasi ikon toggle saat submenu aktif */
  .bottom-nav-item-wrapper.active .submenu-toggle-icon {
    transform: rotate(180deg);
  }

  /* Padding bawah body agar konten tidak tertutup navbar */
  body {
    padding-bottom: 60px;
  }

  body.no-scroll {
    overflow: hidden;
  }

  /* Popup Submenu Fullscreen */
  .submenu-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100000;
    display: none;
    justify-content: center;
    align-items: center;
  }
  .submenu-grid-item span {
    font-size: 10px;
    line-height: 12px;
  }
  .submenu-popup-inner {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    width: 100%;
    max-width: 720px;
    max-height: 100%;
    overflow-y: auto;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
  }

  .submenu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
  }

  .submenu-header span {
    font-size: 16px;
    font-weight: bold;
  }

  .submenu-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
  }

  .submenu-grid {
    display: grid;
    grid-template-columns: repeat(4, 0.5fr);
    gap: 0px;
  }

  .submenu-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: #333;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #f9f9f9;
    transition: all 0.3s;
  }

  .submenu-grid-item i {
    font-size: 30px;
    margin-bottom: 5px;
  }

  .submenu-grid-item:hover {
    background-color: #e1f5e4;
    color: #08512f;
  }
  /* Animasi Fade & Slide Up */
  @keyframes popupFadeSlideIn {
    0% {
      opacity: 0;
      transform: translateY(40px) scale(0.95);
    }
    100% {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  @keyframes popupFadeSlideOut {
    0% {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
    100% {
      opacity: 0;
      transform: translateY(40px) scale(0.95);
    }
  }

  /* Efek masuk popup */
  .submenu-popup.show {
    display: flex !important;
    animation: popupFadeSlideIn 0.4s ease-out forwards;
  }

  /* Efek keluar popup */
  .submenu-popup.hide {
    animation: popupFadeSlideOut 0.3s ease-in forwards;
  }

  /* Hindari scroll saat popup tampil */
  body.no-scroll {
    overflow: hidden;
  }
  .submenu-popup {
    opacity: 0;
    transform: translateY(40px);
  }
}
