

  header {
    position: sticky;
    top:0;
    left: 0;
    /* width: 100vw; */
    width: 100%;
    z-index: 998;
    background-color: white;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  }
  nav{
    position: relative;
    height: 4rem;
  }

  header > nav > ul a {
    background-color: rgb(255, 255, 255); /*цэснүүдийн товчны дэвгэр өнгө*/
    color: rgb(0, 0, 0);/*цэснүүдийн техтийн дэвгэр өнгө*/
    padding: 1rem 0.2rem;
    display: block;
  }

  nav > ul li {
    position: relative; 
  }

  nav > ul li ul {
    display: none;
    position: static;
    padding-left: 20px; 
  }

  nav > ul li ul li ul {
    padding-left: 30px; 
  }

  nav > ul li a {
    display: block;
  }

  #hamburger {
    display: none;
    cursor: pointer;
  }
  #hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--gb-color);
    margin: 5px 0;
  }


  @media screen and (min-width: 1199px) { /*DESKTOP--------------------------------------------*/
    nav {
      max-width: 1140px;
      margin: auto;
      position: relative;
      overflow: visible;
      white-space: nowrap;
      text-align: center; 
    }

    nav > a:nth-of-type(1) img { /*Лого зүүн талд*/
      width: 150px;
      height: auto;
      position: absolute;     
      top: 50%;
      left: 1rem;             
      transform: translateY(-50%); 
      z-index: 999;
    }
    nav > ul { /*голлуулах*/
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      z-index: 999;
    }
    nav > a:last-of-type {  /*Хэл баруун талд зүүн талд*/
      position: absolute;       
      top: 50%;
      right: 0;               
      transform: translateY(-50%); 
      background-color: rgb(255, 255, 255);
      color: rgb(0, 0, 0);
      border-radius: 5px;
      z-index: 999;
      display: flex;            
      align-items: center;      
      gap: 0.3rem;               
    }
    nav > a:last-of-type img {/*language туг*/
      float: left;
      width: 25px;
      height: auto;
    }
    nav > a:last-of-type span {/*language техт*/
      float: left;
      padding-left: 0.2rem; /*хоорондох зай*/
      vertical-align: middle;
    }


    nav > ul {
      display: inline-block;
    }

    nav > ul > li {
      display: inline-block;
      position: relative;
      text-align: left; 
    }

    nav > a:nth-of-type(1),
    nav > a:last-of-type {
      display: inline-block;
      vertical-align: middle;
    }

    nav > a:nth-of-type(1) {
      float: left;
    }

    nav > a:last-of-type {
      float: right;
    }

    /* Дэд цэсийг default-оор нуух */
    nav > ul li ul {
      position: absolute;
      top: 100%;
      left: 0;
      background-color: rgb(255, 255, 255);
      min-width: 200px;
      display: none;
      padding-left: 1rem;
      padding-right: 1rem;
      box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
    }
    /*
    Үйл ажиллагаа
    ---------------------------------------
    |  <-> Барилга, үл хөдлөх хөрөнгө <-> |
    |  <-> Худалдаа, үйлчилгээ <->        |
    |  <-> Үйлдвэрлэл <->                 |
    ---------------------------------------
    */

    /* show класс нэмэгдсэн үед дэд цэсийг харуулах */
    nav > ul li ul.show {
      display: block !important;
    }

    nav > ul li ul li ul {
      top: 0;
      left: 100%;
      position: absolute;
      display: none;
      margin-left: 1rem;
      margin-right: 1rem;
    }

    nav > ul li ul li ul.show {
      display: block !important;
    }

    nav > ul li ul li ul li ul {
      top: 0;
      left: 100%;
    }

    nav > ul li ul li ul {
      padding-left: 0;
    }

    header > nav > ul a::after {
      content: "";
    }
  }




  @media screen and (max-width: 1198.8px) { /*MOBILE--------------------------------------------*/
    nav {
      display: table;
      width: 100%;
      position: relative;
    }
    nav > a:nth-of-type(1) img { /*Лого зүүн талд*/
      width: 150px;
      height: auto;
      position: absolute;     
      top: 50%;
      left: 1rem;             
      transform: translateY(-50%); 
      z-index: 999;
    }
    nav > a:last-of-type img {
      /* float: left; */
      width: 25px;
      height: auto;
      position: absolute;
      top: 50%;
      right: 50px; /*<--------*/
      transform: translate(-50%, -50%);
      z-index: 999;
    }
      
    nav > a:last-of-type span { /*English Тэхт нь харагдахгүй */
      display: none;
      /* 
      float: left;
      vertical-align: middle;
      line-height: 40px;     
      */
    }

    /***********
    #hamburger {
      display: block;
      position: absolute;
      top: 50%;
      right: 15px; <--------
      transform: translate(-50%, -50%);
    } 
    ************/

    /* HAMBURGER → X АНИМАЦ */
    #hamburger {
      display: block;
      width: 30px;
      height: 22px;
      position: absolute;
      top: 50%;
      right: 15px; /*<--------*/
      transform: translateY(-50%);
      cursor: pointer;
      z-index: 1000;
    }

    #hamburger span {
      display: block;
      height: 3px;
      width: 100%;
      background-color: var(--gb-color);
      border-radius: 3px;
      transition: all 0.3s ease;
      position: relative;
    }

    /* Дээд, доод зураас хооронд зай */
    #hamburger span:nth-child(1) {
      top: 0;
    }
    #hamburger span:nth-child(2) {
      margin: 6px 0;
    }
    #hamburger span:nth-child(3) {
      bottom: 0;
    }

    /* Хөдөлгөөн – “X” болгох */
    #hamburger.active span:nth-child(1) {
      transform: rotate(45deg) translate(5px, 5px);
    }
    #hamburger.active span:nth-child(2) {
      opacity: 0;
    }
    #hamburger.active span:nth-child(3) {
      transform: rotate(-45deg) translate(6px, -6px);
    }



    nav > ul {
      display: none;
      position: absolute;
      top: 62px;
      left: 20px; /*-->|    |*/
      width: 350px; /*100%*/  /*|<---------->|*/
      background-color: white;
      /* max-height: 200px; */
      overflow-y: auto;
      z-index: 999;
      box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
    }

    nav > ul.show {
      display: block;
    }

    nav > ul li {
      display: block;
      position: relative;
      padding-left: 20px;
    }

    nav > ul li ul {
      position: static;
      /* padding-left: 20px; */
      display: none;
    }

    nav > ul li ul.show {
      display: block !important;
    }

    /* 
    nav > ul li ul ul {
      padding-left: 30px;
    } 
    */

    nav > a:nth-of-type(1),
    nav > a:last-of-type {
      display: inline-block;
      padding: 10px 20px;
    }

    nav > a:last-of-type {
      float: right;
      line-height: 40px;   
      height: 40px;
      padding: 0 10px;
    }
    nav > a:last-of-type img {
      vertical-align: middle;
    }
  }


  /* submenu байгаа a tag-ийн ард ▼ icon гаргах */
  nav ul li:has(ul) > a::after {
    content: "▾"; /* доош сум */
    font-size: 1.3rem;
    margin-left: 6px;
    display: inline-block;
    transition: transform 0.2s ease;
  }

  /* submenu нээгдэх үед сум эргэх */
  /*nav ul li ul.show {*/
  nav ul li ul.show ~ a::after {
    display: block !important;
  }

  /*nav ul li ul.show ~ a::after, nav ul li:has(ul.show) > a::after {*/
  nav ul li:has(ul.show) > a::after {
    transform: rotate(180deg);
  }

  
  /* ↓↓↓ ЭНЭ НЭМЭГДСЭН — баз .show дүрэм ↓↓↓ */
  nav > ul li ul.show {
    display: block !important;
  }
  nav > ul li ul li ul.show {
    display: block !important;
  }


/* ========== НЭВТЭРСЭН ХЭРЭГЛЭГЧ ========== */
.nav-user-info {
  position: relative;
}
.nav-user-info > a {
  display: inline-block !important;
  padding: 0 !important;
  background: none !important;
}
.nav-user-info > .nav-user-icon {
  display: none;
}
.nav-user-info > .nav-user-name {
  display: inline-block;
  padding: 0.35rem 1rem;
  background-color: var(--accent-2);
  color: #fff;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  vertical-align: middle;
  cursor: default;
  transition: background-color 0.25s ease;
}
.nav-user-info > .nav-user-name:hover {
  background-color: var(--accent);
}

@media screen and (min-width: 1199px) {
  .nav-user-info {
    display: inline-block;
    vertical-align: middle;
    margin-left: 1.2rem;
  }
}

@media screen and (max-width: 1198.8px) {
  .nav-user-info {
    display: block;
    padding: 10px 20px 10px 40px;
  }
  .nav-user-info > .nav-user-icon {
    display: inline-block;
    margin-right: 6px;
    font-size: 1rem;
  }
  .nav-user-info > .nav-user-name {
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-size: 0.88rem;
  }
}

