/*=============================================
MENU HORIZONTAL (version Custom)
Solo aplica con body.layout-top-nav
=============================================*/

body.layout-top-nav{--nav-h:3.6rem}

/* ---- barra fija arriba; el contenido baja lo que mide la barra ---- */
body.layout-top-nav .wrapper .main-header.top-nav{
  position:fixed; top:0; left:0; right:0; width:100%; margin-left:0 !important;
  z-index:1035; min-height:var(--nav-h); padding:0 1rem; flex-wrap:nowrap; align-items:center;
}
body.layout-top-nav .wrapper .content-wrapper{margin-left:0 !important; margin-top:0 !important; padding-top:var(--nav-h); min-height:100vh}
body.layout-top-nav .wrapper .main-footer{margin-left:0 !important}

/* ---- marca ---- */
.top-brand{display:flex; align-items:center; gap:.6rem; padding:0; margin-right:1.2rem; color:#fff !important; font-weight:700; letter-spacing:.08em; font-size:1.02rem; white-space:nowrap}
.top-brand img{border-radius:8px; box-shadow:0 2px 8px rgba(0,0,0,.25)}
.top-toggler{border:0; color:#fff; font-size:1.2rem; padding:.4rem .6rem; margin-left:auto}
.top-toggler:focus{outline:0; box-shadow:none}

/* ---- opciones del menu ---- */
.top-menu{align-items:center; gap:.15rem; flex-direction:row}
.top-menu > .nav-item{position:relative}
.main-header .top-menu .nav-link{display:flex; align-items:center; gap:.5rem; white-space:nowrap; padding:.55rem .8rem; font-weight:500; font-size:.92rem; cursor:pointer}
.top-menu .nav-link p{display:inline; margin:0; font-size:inherit}
.top-menu .nav-link .nav-icon{width:auto; margin:0; font-size:.95rem; opacity:.95}
.main-header .top-menu > .nav-item > .nav-link.active{background:rgba(255,255,255,.2) !important; box-shadow:inset 0 -3px 0 #fff}

/* flecha de los grupos: hacia abajo en la barra, hacia la derecha dentro de un desplegable */
.top-menu .nav-link .right{float:none; margin-left:.15rem; transform:rotate(-90deg); font-size:.8rem; transition:transform .15s}

/* ---- desplegables (cualquier nivel) ---- */
.top-menu .nav-treeview{
  display:none !important; position:absolute; left:0; top:100%; min-width:240px;
  background:#fff; border-radius:12px; box-shadow:0 14px 38px rgba(30,27,58,.22);
  padding:.45rem; margin:0; list-style:none; z-index:1040; flex-direction:column;
}
.top-menu li.open > .nav-treeview{display:block !important}
.top-menu .nav-treeview .nav-treeview{left:100%; top:-.45rem; margin-left:.25rem}
.top-menu .nav-treeview .nav-item{display:block; width:100%}
.main-header .top-menu .nav-treeview .nav-link{color:var(--ink,#1e1b3a) !important; border-radius:8px; padding:.55rem .8rem; gap:.65rem}
.main-header .top-menu .nav-treeview .nav-link:hover{background:var(--brand-50,#efeef9) !important; color:var(--brand-700,#423f80) !important}
.main-header .top-menu .nav-treeview .nav-link.active{background:var(--brand-50,#efeef9) !important; color:var(--brand-700,#423f80) !important; font-weight:600}
.top-menu .nav-treeview .nav-link .nav-icon{color:var(--brand,#605ca8); width:1.2rem; text-align:center}
.top-menu .nav-treeview .nav-link .right{margin-left:auto; transform:none}

/* con raton: se abren al pasar */
@media (min-width:1200px) and (hover:hover){
  .top-menu li:hover > .nav-treeview{display:block !important}
}

/* ---- usuario ---- */
.top-user-link{display:flex; align-items:center; gap:.5rem}
.top-user-link img{width:30px; height:30px; object-fit:cover; border:2px solid rgba(255,255,255,.65)}
.top-user-nombre{max-width:170px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.88rem; font-weight:500}
.top-user-flecha{font-size:.65rem; opacity:.8}
.top-user .dropdown-item i{width:1.2rem; color:var(--brand,#605ca8)}

/* ---- pantallas medianas y moviles: menu desplegable en columna ---- */
@media (max-width:1199.98px){
  body.layout-top-nav .wrapper .main-header.top-nav{flex-wrap:wrap; padding:.35rem 1rem}
  #menuTop{max-height:calc(100vh - var(--nav-h)); overflow-y:auto; padding-bottom:.6rem}
  .top-menu{flex-direction:column; align-items:stretch; gap:0}
  .top-menu .nav-treeview,
  .top-menu .nav-treeview .nav-treeview{position:static; box-shadow:none; background:rgba(255,255,255,.1); margin:.1rem 0 .3rem .9rem; min-width:0}
  .main-header .top-menu .nav-treeview .nav-link{color:#fff !important}
  .main-header .top-menu .nav-treeview .nav-link:hover,
  .main-header .top-menu .nav-treeview .nav-link.active{background:rgba(255,255,255,.18) !important; color:#fff !important}
  .top-menu .nav-treeview .nav-link .nav-icon{color:#fff}
  .top-menu .nav-link .right{margin-left:auto}
  .top-menu li.open > .nav-link .right{transform:rotate(0)}
  .top-user{border-top:1px solid rgba(255,255,255,.2); margin-top:.4rem; padding-top:.4rem}
  .top-user .dropdown-menu{position:static !important; transform:none !important; float:none; margin:.2rem 0}
}
