/* ========================================
   Custom Menu Font Size & Family Override
   & Responsive Typography with REM Units
   ======================================== */

* {
    font-family: '微軟正黑體', 'Microsoft JhengHei', sans-serif !important;
}

.form-control,
.form-select {
    font-size: 1.05rem !important;
    padding: 8px;
}

/* 主選單字級 — 用 !important 強制蓋過 Bootstrap 預設,確保不被任何 CSS isolation
   或其他規則覆蓋。改數字時 4 個 selector 同步調整,讓 nav-link / caption / 容器一致。
   仍以 rem 為單位 → 會跟 cookie fontSize 縮放。 */
.mainnav,
.mainnav .nav-link,
.mainnav__menu .nav-link,
.mainnav__caption {
    font-size: 0.95rem !important;
    height: 2.5rem;
}

.mainnav__caption {
    font-weight: 500;
    padding: 10px;
}


/* ========================================
   Responsive Page Typography (using REM units)
   ======================================== */

/* 頁面標題 - 根據根元素 font-size 自動縮放 */
.page-title {
    font-size: 1.5rem;
    /* cookie=16 時 24px / 13 時 19.5px,標題感比 2rem 收斂 */
    font-family: "標階體", "Microsoft JhengHei", sans-serif;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* 副標題 (h2, h3, h4, h5, h6) */
.page-title~h2,
.page-title~h3,
.page-title~h4,
.page-title~h5,
.page-title~h6 {
    font-size: 1.0rem;
    /* 如果根元素是 18px，則為 23.4px */
    font-family: "標階體", "Microsoft JhengHei", sans-serif;
    font-style: italic;
    font-weight: 600;
}

/* 詳細描述文字 */
.page-title~p {
    font-size: 0.9rem;
    font-family: "標階體", "Microsoft JhengHei", sans-serif;
    line-height: 1.6;
}

/* 通用 h5 樣式 */
h5 {
    font-family: "微軟正黑體", "Microsoft JhengHei", sans-serif;
}

/* ========================================
   菜單活跃项高亮样式（仅二级菜单项）
   ======================================== */


/* 移除一级菜单项的深蓝色背景 */
.nav-item.has-sub>.nav-link.active {
    background-color: transparent !important;
    /* 无背景 */
    color: inherit !important;
    /* 保持原有颜色 */
    
}

/* 只对二级菜单项应用 active 样式 */
.mininav-content .nav-item .nav-link.active {
    background-color: #e8f4ff !important;
    /* 浅蓝色背景 */
    color: #0066cc !important;
    /* 蓝色文字 */
    font-weight: 600;
    /* 加粗 */
    border-left: 3px solid #0066cc;
    /* 左侧蓝色边框 */
    padding-left: 12px !important;
    /* 调整内边距 */
    border-radius: 4px;
    /* 圆角 */
}

.mininav-content .nav-item .nav-link.active:hover {
    background-color: #d4ebff !important;
    /* 悬停时更深的蓝色 */
}

/* ========================================
   左側主選單(mainnav)展開寬度 — 使用 Nifty 預設
   (--nf-mainnav-max-width 只作用於 max 模式,min 模式吃 --nf-mainnav-min-width)
   ======================================== */
.mn--max {
    --nf-mainnav-max-width: 15.75rem;
}

/* ========================================
   設定面板齒輪鈕位置 — 從面板頂端 1.5rem 移到垂直中央,
   避免擋到頁面上方的操作按鈕(breadcrumb / 標題列右側 icon 等)
   想再往上往下調就改 inset-block-start 的 %(0% 最上、100% 最下)
   ======================================== */
._dm-btn-settings {
    inset-block-start: 95% !important;
    transform: translateX(-100%) translateY(-50%) !important;
}

/* ========================================
   系統功能清單上下捲動 — 項目多時可以滾
   (Nifty 預設靠 .mainnav__inner height 撐;這裡加保險,直接限制
    .mainnav__top-content 高度與 overflow,確保任何情況都能捲)
   ======================================== */
.mainnav__top-content {
    max-height: calc(100vh - var(--nf-header-height, 3.625rem));
    overflow-y: auto;
}