/* =========================================================
   FORCE VANILLA — TOP NAV SUBMENU
   ========================================================= */


/* =========================================================
   MENU ITEM
   ========================================================= */

.menu-list > li {
  position: relative;
}


/* =========================================================
   SUBMENU
   ========================================================= */

.menu-list > li.has-submenu > .submenu {
  display: none;

  position: absolute;

  top: 100%;
  left: 0;

  transform: none;

  width: max-content;
  min-width: 210px;

  margin: 0;
  padding: 8px 0;

  list-style: none;

  background: #ffffff;

  border: 1px solid rgba(0, 0, 0, 0.08);

  border-radius: 8px;

  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.08);

  z-index: 9999;
}


/* =========================================================
   SHOW SUBMENU
   ========================================================= */

.menu-list > li.has-submenu:hover > .submenu {
  display: block;
}


/* =========================================================
   SUBMENU ITEM
   ========================================================= */

.menu-list > li.has-submenu > .submenu > li {
  width: 100%;

  margin: 0;
  padding: 0;

  background: transparent;

  border-radius: 0;
}


/* =========================================================
   SUBMENU LINK
   ========================================================= */

.menu-list > li.has-submenu > .submenu > li > a {
  display: block;

  width: 100%;

  box-sizing: border-box;

  padding: 11px 18px;

  color: #333333;

  font-family: "Manrope", Arial, sans-serif;

  font-size: 13px;

  font-weight: 500;

  line-height: 1.3;

  text-decoration: none;

  white-space: nowrap;
}


/* =========================================================
   SUBMENU HOVER
   ========================================================= */

.menu-list > li.has-submenu > .submenu > li > a:hover {
  background: var(--accent);

  color: #ffffff;
}


/* =========================================================
   MOBILE — FORCE'VANILLA NAVIGATION
   ========================================================= */

@media (max-width: 600px) {

  /* Menu utama dapat digeser ke samping */
  .top-nav {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .top-nav::-webkit-scrollbar {
    display: none;
  }

  .menu-list {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 4px;
    width: max-content;
    min-width: max-content;
    padding: 8px 12px;
    margin: 0;
  }

  .menu-list > li {
    flex: 0 0 auto;
    padding: 8px 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  .menu-list > li > a {
    font-size: 13px;
    white-space: nowrap;
  }

  /* Submenu lebih mudah dibaca dan disentuh */
  .menu-list > li.has-submenu > .submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 210px;
    max-width: calc(100vw - 24px);
    max-height: 65vh;
    overflow-y: auto;
    white-space: normal;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  }

  .menu-list > li.has-submenu > .submenu > li > a {
    padding: 13px 16px;
    font-size: 14px;
    white-space: normal;
    line-height: 1.4;
  }

  /* Dukungan submenu saat item mendapat fokus keyboard */
  .menu-list > li.has-submenu:focus-within > .submenu {
    display: block;
  }
}


/* MOBILE HAMBURGER MENU */
.mobile-menu-toggle {
  display: none;
}

@media screen and (max-width: 600px) {
  .mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    margin: 8px 12px;
    padding: 8px;
    background: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 8px;
    cursor: pointer;
  }

  .mobile-menu-toggle span {
    display: block;
    width: 23px;
    height: 2px;
    background: #222222;
    border-radius: 2px;
  }

  .top-nav {
    display: none;
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }

  .top-nav.mobile-menu-open {
    display: block;
  }

  .top-nav .menu-list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    gap: 0;
    padding: 0;
    margin: 0;
  }

  .top-nav .menu-list > li {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0;
    white-space: normal;
    border-bottom: 1px solid #eeeeee;
  }

  .top-nav .menu-list > li > a {
    display: block;
    padding: 14px 18px;
    font-size: 14px;
    white-space: normal;
  }

  .top-nav .menu-list > li.has-submenu > .submenu {
    display: none;
    position: static;
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: none;
    overflow: visible;
    box-sizing: border-box;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #f7f7f7;
    transform: none;
  }

  .top-nav .menu-list > li.has-submenu.submenu-open > .submenu {
    display: block;
  }

  .top-nav .menu-list > li.has-submenu > .submenu > li > a {
    padding: 12px 32px;
    font-size: 14px;
    white-space: normal;
  }
}


/* TANDA SUBMENU PADA MENU HP */
@media screen and (max-width: 600px) {
  .top-nav .menu-list > li.has-submenu > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .top-nav .menu-list > li.has-submenu > a::after {
    content: "⌄";
    display: inline-block;
    font-size: 20px;
    line-height: 1;
    color: #333333;
    transition: transform 0.2s ease;
  }

  .top-nav .menu-list > li.has-submenu.submenu-open > a::after {
    transform: rotate(180deg);
  }
}

