﻿/* ============================================
 一.  /portal/assets/css/portal.nav.css
   ============================================ */
/* ============================================
   导航栏（PC 端）
   ============================================ */
/* 3. 固定导航栏（企业级门户专用） */
.portal-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  height: var(--portal-nav-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 1000;
}

/* 导航内部容器（全宽 + 左右留白 + 居中） */
.portal-nav-inner {
  display: flex;
  align-items: center;
  position: relative; /* ⭐ 在这里加这一行 */

  width: 100%;
  max-width: none; /* ⭐ 关键：让导航真正占满全宽 */
  margin: 0; /* ⭐ 不要居中，否则汉堡永远靠不到右边 */
  padding: 0 24px; /* ⭐ PC 端左右各留 24px */
}

/* 左侧整体：Logo + 菜单 */
.portal-nav-left {
  display: flex;
  align-items: center;
  gap: 32px;
  flex: 1; /* ⭐ 关键：左侧占据中间所有空间 */
}

/* 右侧按钮区域：始终贴右 */
.portal-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* PC：登录 / 注册 / 已登录区域默认隐藏，交给 JS 控制显示，避免闪烁 */
#portal-btn-login,
#portal-btn-register,
#portal-user-area {
  display: none;
}

/* 页面处于 portal-loading 状态时，先把 PC 端会切换状态的区域隐身 */
body.portal-loading #portal-btn-login,
body.portal-loading #portal-btn-register,
body.portal-loading #portal-user-area {
  visibility: hidden;
}

/* 手机端汉堡按钮（默认隐藏） */
.portal-nav-toggle {
  display: none;
  font-size: 22px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  user-select: none;
}

/* 全局头像样式（PC + Mobile + Dropdown 统一） */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

/* 用户名昵称设置 */
.portal-nav-actions .username {
  font-size: 16px;
  font-weight: 400;
  color: var(--portal-text-main);

  max-width: 6em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: middle;
}

/* ============================================
   Logo 区域
   ============================================ */
/* 左侧 Logo 区域 */
.portal-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 18px;
  color: var(--portal-text-main);
}

.portal-nav-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

/* ============================================
   PC 菜单 + 二级菜单
   ============================================ */

/* 中间菜单区域 */
.portal-nav-menu {
  display: flex;
  align-items: center;
  gap: 20px;
}

.portal-nav-link {
  font-size: 16px;
  font-weight: 400;
  color: var(--portal-text-main);
  text-decoration: none;

  height: auto;              /* ⭐ 显式写出 */
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;

  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;
}

/* PC：导航栏菜单字体颜色 + hover 风格 */
.portal-nav-link:hover {
  color: var(--portal-primary);   /* 蓝色hover（字体变蓝），原来是var(--portal-text-main); */
  background: #f3f4f6;            /* 如不要灰底hover就换成：transparent;  */
}

/* ⭐ 一级菜单：当 mega panel 打开时保持高亮 */
.portal-nav-item-with-children.active-parent > .portal-nav-link {
    color: var(--portal-primary) !important;
    background: #f3f4f6 !important;
}

/* ⭐ 激活态（当前页面） */
.portal-nav-link.active {
  color: var(--portal-primary);
  background: var(--portal-primary-soft);
}

/* ====== PC 二级菜单（hover 下拉） ====== */

/* 包含子菜单的导航项 */
.portal-nav-item-with-children {
  position: relative;
  display: flex;
  align-items: center;
  height: var(--portal-nav-height);
}

/* 一级菜单（有子菜单）样式 */
.portal-nav-link.has-children {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* PC 菜单下拉箭头（尺寸对齐右上角用户箭头） */
.portal-nav-link.has-children .arrow {
  font-size: 12px;      /* 缩小到和右上角一致的视觉大小 */
  line-height: 1;
  opacity: 0.7;
  font-weight: 400;
  transform: translateY(1px); /* 微调垂直位置，让箭头更居中 */
}

/* ⭐ PC 菜单：隐藏下拉箭头（不影响右上角用户菜单箭头） */
.portal-nav-menu .portal-nav-link.has-children .arrow {
    display: none !important;
}

/* 二级菜单容器 */
.portal-submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  padding: 4px 0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  z-index: 2000;
}

/* hover 展开二级菜单 */
.portal-nav-item-with-children:hover .portal-submenu {
  display: block;
}

.portal-submenu a {
  display: block;
  padding: 6px 14px;
  white-space: nowrap;
  color: #111;
}

.portal-submenu a:hover {
  background: #f3f4f6;
}

/* ================================
   PC Mega Menu（阿里云风格）
   ================================ */

.mega-menu {
  position: absolute;
  top: 100%;
  left: 0;

  width: 560px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  padding: 0;
  overflow: hidden;

  z-index: 3000;

  /* ⭐ 初始为收起状态 */
  display: flex;          /* 让布局正常，但高度为 0 看不到内容 */
  flex-direction: row;
  height: 0;
  opacity: 0;
  pointer-events: none;

  transition:
    height 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.25s ease-out;
}

/* ⭐ 打开状态（由 JS 加 .open） */
.mega-menu.open {
  opacity: 1;
  pointer-events: auto;
}

.mega-left {
  width: 180px; /* 阿里云左栏宽度 */
  background: #f9fafb;
  border-right: 1px solid #f0f0f0;
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mega-right {
  flex: 1;
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 一级标题（左栏顶部） */
.mega-l1-title {
  font-size: 15px;
  font-weight: 600;
  padding: 0 16px 6px;
  color: #111827;
}

/* 二级菜单（左栏） */
.mega-l2-list {
  display: flex;
  flex-direction: column;
}

.mega-l2-item {
  padding: 8px 16px;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s ease;
}

.mega-l2-item:hover {
  background: #eef2ff;
}

.mega-l2-item.active {
  background: #e0e7ff;
  color: #1d4ed8;
  font-weight: 500;
}

/* 右栏（无三级菜单时）二级菜单 */
.mega-l2-link {
  padding: 8px 16px;
  font-size: 14px;
  color: #374151;
  text-decoration: none;
  transition: background 0.15s ease;
}

.mega-l2-link:hover {
  background: #f3f4f6;
}

/* 右栏三级菜单 */
.mega-l3-list {
  display: none;
  flex-direction: column;
  gap: 2px;
}

.mega-l3-list.active {
  display: flex;
}

.mega-l3-link {
  padding: 8px 16px;
  font-size: 14px;
  color: #374151;
  text-decoration: none;
  transition: background 0.15s ease;
}

.mega-l3-link:hover {
  background: #f3f4f6;
}

/* 有三级 / 无三级的布局差异 */

/* 无三级菜单时：右栏显示二级，左栏更窄 */
.mega-menu.no-l3 .mega-left {
  width: 160px;
}

.mega-menu.no-l3 .mega-right {
  padding-left: 0;
}

/* 有三级菜单时：左栏显示二级，右栏显示三级 */
.mega-menu.has-l3 .mega-left {
  width: 200px;
}

.mega-menu.has-l3 .mega-right {
  padding-left: 0;
}

/* ============================================
   按钮体系（统一 + danger 按钮）
   ============================================ */
/* 按钮体系 */
.portal-btn-ghost,
.portal-btn-primary,
.portal-btn-secondary,
.portal-btn-danger {
  font-size: 15px;
  font-weight: 400;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

/* 登录按钮 */
.portal-btn-ghost {
  border: none;
  background: transparent;
  padding: 6px 12px;
  color: var(--portal-text-muted);
}
.portal-btn-ghost:hover {
  background: #f3f4f6;
  color: var(--portal-text-main);
}

/* 注册按钮 */
.portal-btn-primary {
  border: none;
  background: var(--portal-primary);
  color: #ffffff;
  padding: 8px 16px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}
.portal-btn-primary:hover {
  background: var(--portal-primary-hover);
  transform: translateY(-1px);
}

/* 你的后台按钮 */
.portal-btn-secondary {
  border: none;
  background: #e5e7eb;
  color: #111827;
  padding: 8px 16px;
}
.portal-btn-secondary:hover {
  background: #d1d5db;
  transform: translateY(-1px);
}

/* 退出登录按钮 */
.portal-btn-danger {
  border: none;
  background: #ef4444;
  color: #ffffff;
  padding: 8px 16px;
}
.portal-btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}


/* PC 端隐藏 mobile 按钮 */
@media (min-width: 769px) {
  #portal-btn-login-mobile,
  #portal-btn-register-mobile,
  #portal-btn-dashboard-mobile,
  #portal-user-info-mobile,
  #portal-btn-logout-mobile {
    display: none;
  }

  /* ⭐ PC 端彻底隐藏 mobile 菜单 */
  .mobile-menu-list {
    display: none !important;
  }

  /* ⭐ PC 端隐藏 mobile 双栏菜单 */
  .portal-mobile-mega {
    display: none !important;
  }
}
