body {
    position: relative;
    padding-top: 20px;
    padding-bottom: 20px;
    font-family: "Times New Roman", Times, serif;
    transition: background-color 0.3s, color 0.3s;
}
h2, 
.h2 {
    font-family: "Times New Roman", Times, serif;
    /* font-size: 1.5rem ; */
    font-weight: 500;
    color: var(--bs-dark);
    transition: color 0.3s;
}
p {
    text-indent: 0.5in;
    font-size: large;
    transition: color 0.3s;
}
blockquote {
    /* font-style: italic; */
    font-size: large;
    margin: 1rem;
    padding: 0.5em;
    border-left: 3px solid #ccc;
    padding-left: 10px;
    transition: color 0.3s;
}
img {
    max-width: 100%;
    height: auto;
}
/* Custom sidebar scrollbar styles */
#sidebar::-webkit-scrollbar {
    width: 5px; 
}

#sidebar::-webkit-scrollbar-track {
    background: #e1e1e1; 
}

#sidebar::-webkit-scrollbar-thumb {
    background: #cccccc; 
    border-radius: 1px; 
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: #00000033; 
}
.dark-mode {
    background-color: #333;
    color: #d5d9dd;
    transition: color 0.3s;
}
.dark-mode h2 {
    color: #f8f9fa;
}
.dark-mode .h2 {
    color: #f8f9fa;
}
.dark-mode .datetime {
    color: #ddd;
    transition: color 0.3s;
}
.back-to-top {
    position: fixed;
    z-index: 100;
    bottom: 20px;
    right: 20px;
    background-color: #00000066;
    color: #fff;
    display: none;
}
.back-to-top:hover {
    background-color: #00000099;
    color: #fff;
}
.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    margin-left: 10px;
}
.language-dropdown {
    display: inline-block;
}
/* .subtitle {
    font-size: large;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.authornames {
    width: 100%;
    text-align: center;
    font-size: 1rem;
}
.datetime {
    width: 100%;
    text-align: center;
    font-size: 0.95rem;
    margin: 1.5px 0 2% 0;
    color: #414141;
    transition: color 0.3s;
} */
.apacite {
    text-indent: -0.5in;
    padding-left: 0.5in;
}
.content-wrapper {
    font-size: large;
    max-width: 100%;
}
.sidebar {
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    overflow-y: auto;
    transition: background-color 0.3s;
}
.position-sticky {
    padding-left: 1%;
    list-style: none;
    margin-top: 60px;
    margin-bottom: 50px;
}
.nav-link {
    transition: all 0.3s;
}
.nav-link:hover {
    transform: translateX(5px);
}
.nav-link.active {
    /* color: #007bff; */
    font-weight: bold;
}
.nxt-pagelink {
    color: #00bfff;
    text-shadow: 1px 0px 2px #00000050;
}
.main-content {
    display: flex;
    flex-direction: column;
    padding-left: 15px;
    padding-right: 15px;
}
.header-content {
    order: 0;
    text-align: center;
}
.content-wrapper {
    max-width: 97.5%;
}
/* @media (min-width: 768px) {
    .position-sticky{
        margin-top: 60px;
        margin-bottom: 50px;
    }
} */
.offcanvas {
    background-color: #ffffff !important;
    font-family: 'Segoe UI', sans-serif;
    font-size: 1rem;
    color: #212529;
    }

    /* 調整選單內部文字的內距與對齊 */
.offcanvas-body .nav-link,
.offcanvas-body .dropdown-item {
    padding-left: 1rem;
    padding-right: 1rem;
    /* font-weight: 500; */
    color: #333;
    }

    /* hover 效果一致 */
.offcanvas-body .nav-link:hover,
.offcanvas-body .dropdown-item:hover {
    text-decoration: underline;
    background-color: #f8f9fa;
    }
.offcanvas-start {
        max-width: 250px;
    }

/* 基本樣式與互動 */
.sidebar-tree .nav-link {
  color: #000000;
  padding: .4rem .25rem;
      font-family: "Times New Roman", Times, serif;
}
.sidebar-tree .nav-link:hover {
  text-decoration: underline;
}

.btn-toggle {
  background: transparent;
  border: 0;
  padding: .4rem .25rem;
  font-weight: 600;
}
.btn-toggle:hover {
  background-color: rgba(0,0,0,.04);
  border-radius: .5rem;
}

/* 小箭頭旋轉動畫 */
.btn-toggle .chevron {
  transition: transform .2s ease;
}
.btn-toggle:not(.collapsed) .chevron {
  transform: rotate(90deg);
}

/* 次層連結字級/間距更緊湊 */
.sidebar-tree .small {
  font-size: .92rem;
}

/* 緊密行距 & 無首行縮排 */
.tight-text p,
.tight-text {
  line-height: 1.2;     /* 調整行距更緊密，預設大約 1.5 */
  text-indent: 0;       /* 首行不縮排 */
  margin-bottom: 0.5rem; /* 段落之間縮小間距 */
}
/* ===== Sidebar 階層字級設定 ===== */
:root{
  --nav-l1: 1.28rem;   /* 最上層：Introduction / ICLS / UNESCO / Participants / Others */
  --nav-l2: 1.12rem;   /* 群組層：Online Forum / More Documents */
  --nav-l3: 1.00rem;   /* 檔案葉節點 */
}

.navbar-nav .nav-link{
  font-weight: 400;           /* 移除粗體 */
  line-height: 1.35;          /* 舒適行距 */
  white-space: normal;        /* 自動換行 */
  word-break: break-word;     /* 長字/URL 可斷行 */
  overflow-wrap: anywhere;    /* 避免撐出水平卷軸 */
  padding-left: 0;            /* 由階層類別決定內距 */
}

.navbar-nav .nav-l1{
  font-size: var(--nav-l1);
  padding: .35rem 0;
}
.navbar-nav .nav-l2{
  font-size: var(--nav-l2);
  padding: .3rem 0;
  padding-left: .25rem;
}
.navbar-nav .nav-l3{
  font-size: var(--nav-l3);
  padding: .25rem 0;
  padding-left: .5rem;
}

/* 巢狀 UL 的左縮排更乾淨 */
.navbar-nav .list-unstyled{ margin-left: .25rem; }

/* 展開箭頭動畫（可留可不留） */
.chevron{ font-size: .9em; transition: transform .2s ease; }
a.nav-link[aria-expanded="true"] .chevron{ transform: rotate(90deg); }

/* 安全：側欄容器只垂直滾動、不出現水平捲軸 */
.sidebar-tree, nav.sticky-top{
  overflow-x: hidden;
}

/* ===== Sidebar 項目間距（依階層）===== */
:root{
  --gap-l1: .7rem;   /* 最上層項目之間的距離 */
  --gap-l2: .5rem;   /* 群組內（第二層）項目之間的距離 */
  --gap-l3: .4rem;   /* 第三層（檔案列表）項目之間的距離 */
}

/* 讓清單用 flex column + gap 管理間距 */
.navbar-nav,
.navbar-nav .list-unstyled{
  display: flex;
  flex-direction: column;
  margin: 0;              /* 清掉 ul 預設 margin */
  padding-left: 0;        /* 由你原本的 ps-3 控制左縮排即可 */
}

/* 各層 gap 設定 */
.navbar-nav{ gap: var(--gap-l1); }
.navbar-nav .list-unstyled{ gap: var(--gap-l2); }
.navbar-nav .list-unstyled .list-unstyled{ gap: var(--gap-l3); }

/* 群組展開後，群組標題與清單間留一點空隙 */
.collapse > .list-unstyled{ margin-top: .35rem; }

/* 保險：避免長字撐出水平捲軸 */
.navbar-nav .nav-link{ white-space: normal; word-break: break-word; overflow-wrap: anywhere; }


@media (min-width: 1200px) {
    .content-wrapper {
        max-width: 87.5%;
    }
    .position-sticky{
        margin-top: 60px;
        margin-bottom: 50px;
    }
}
@media (max-width: 768px) {
    .sidebar {
        position: static;
        height: auto;
    }
    .header-content {
        margin-bottom: 20px;
    }
    .position-sticky{
        margin-top: 10px;
        margin-bottom: 10px;
    }
}