/* ========================================
   導航欄修正 - 確保所有頁面一致
   ======================================== */

/* 重置可能造成衝突的樣式 */
.navbar .nav-link {
  font-size: inherit !important;
  padding: 0.5rem 1rem !important;
  font-weight: 500 !important;
}

.navbar-brand img {
  height: auto !important;
  max-height: 90px !important;
  width: auto !important;
}

/* AI 專區樣式 - 與其他選單一致，僅修改字體顏色 */
.nav-link-ai {
  color: #4A90E2 !important;
}

.nav-link-ai:hover,
.nav-link-ai:focus {
  color: #2E5C8A !important;
}

.nav-link-ai.active,
.nav-link-ai[aria-current="page"] {
  color: #2E5C8A !important;
}

/* AI 專區下劃線顏色 */
.nav-link-ai::after {
  background: #4A90E2 !important;
}

.nav-link-ai:hover::after,
.nav-link-ai.active::after,
.nav-link-ai[aria-current="page"]::after {
  background: #2E5C8A !important;
}

/* 手機版調整 */
@media (max-width: 991px) {
  .navbar-brand img {
    height: auto !important;
    max-height: 70px !important;
    width: auto !important;
  }
}

@media (max-width: 768px) {
  .navbar .nav-link {
    padding: 0.75rem 1rem !important;
  }
  
  .banner {
    margin-top: 0 !important;
  }
}

/* 桌面版 - 增加導航欄與內容之間的間距 */
@media (min-width: 1200px) {
  .banner {
    margin-top: 120px !important;
  }
  
  /* 增加第一個內容區域的頂部間距 */
  .newest {
    padding-top: 80px !important;
  }
}

/* 中等桌面版 (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
  .banner {
    margin-top: 110px !important;
  }
  
  .newest {
    padding-top: 70px !important;
  }
}

/* 防止頁面跳轉時的閃爍和跳躍 */
html {
  scroll-behavior: smooth;
}

body {
  /* 確保頁面載入時不會有跳躍 */
  min-height: 100vh;
  /* 防止內容被固定導航欄遮擋 */
  padding-top: 0;
}

/* 確保固定導航欄不會造成內容跳躍 */
.navbar.fixed-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  /* 確保導航欄載入時不會造成頁面跳躍 */
  will-change: transform;
}

/* 減少頁面跳轉時的視覺跳躍 */
.page-transition {
  opacity: 1;
  transition: opacity 0.15s ease-in-out;
}

.page-transition.loading {
  opacity: 0.98;
}
