/* ========================================
   首頁專用樣式 - 精簡版
   從舊系統提取，保留視覺一致性
   ======================================== */

/* === CSS 變數 === */
:root {
  --theme: #3877ad;
  --light-theme: #1DA2E3;
  --light-orange: #F6A180;
  --light-teal: #51CDBD;
  --light-green: #68B689;
  --primary: #3877ad;
  --secondary: #F6A180;
  --success: #abe050;
  --info: #36d8e0;
  --warning: #f6c23e;
  --danger: #dc3545;
  --gray: #858796;
  --gray-light: #eaecf4;
  --gray-dark: #5a5c69;
}

/* === 基礎樣式 === */
* {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  width: 100%;
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  font-family: "Noto Sans TC", sans-serif, Roboto, Nunito, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 1.125em;
  font-weight: 400;
  line-height: 1.5;
  color: #3a3b45;
  background-color: #fff;
  letter-spacing: 1px;
}

#wrapper {
  margin: 0;
  padding: 0;
  width: 100%;
}

a {
  color: #3877ad;
  text-decoration: none;
}

a:hover {
  color: rgb(37.2925764192, 79.2467248908, 115.2074235808);
  text-decoration: underline;
}

/* === 背景顏色類別 === */
.bg-light-theme {
  background-color: #1DA2E3 !important;
}

a.bg-light-theme:hover, a.bg-light-theme:focus,
button.bg-light-theme:hover,
button.bg-light-theme:focus {
  background-color: rgb(22.5984251969, 129.9409448819, 182.4015748031) !important;
}

.bg-light-orange {
  background-color: #F6A180 !important;
}

a.bg-light-orange:hover, a.bg-light-orange:focus,
button.bg-light-orange:hover,
button.bg-light-orange:focus {
  background-color: rgb(242.625, 125.75, 80.375) !important;
}

.bg-light-teal {
  background-color: #51CDBD !important;
}

a.bg-light-teal:hover, a.bg-light-teal:focus,
button.bg-light-teal:hover,
button.bg-light-teal:focus {
  background-color: rgb(52.4553571429, 182.5446428571, 165.7589285714) !important;
}

.bg-light-green {
  background-color: #68B689 !important;
}

a.bg-light-green:hover, a.bg-light-green:focus,
button.bg-light-green:hover,
button.bg-light-green:focus {
  background-color: rgb(76.5848214286, 158.4151785714, 111.2053571429) !important;
}

/* === 按鈕樣式 === */
.btn-theme {
  color: #fff;
  background-color: #3877ad;
  border-color: #3877ad;
}

.btn-theme:hover {
  color: #fff;
  background-color: rgb(46.6462882096, 99.1233624454, 144.1037117904);
  border-color: rgb(43.5283842795, 92.4978165939, 134.4716157205);
}

.btn-theme:focus, .btn-theme.focus {
  color: #fff;
  background-color: rgb(46.6462882096, 99.1233624454, 144.1037117904);
  border-color: rgb(43.5283842795, 92.4978165939, 134.4716157205);
  box-shadow: 0 0 0 0.2rem rgba(85.85, 139.4, 185.3, 0.5);
}

.text-theme {
  color: #3877ad !important;
}

/* === Hover 動畫效果 === */
@-webkit-keyframes hvr-bob {
  0% {
    -webkit-transform: translateY(-8px);
    transform: translateY(-8px);
  }
  50% {
    -webkit-transform: translateY(-4px);
    transform: translateY(-4px);
  }
  100% {
    -webkit-transform: translateY(-8px);
    transform: translateY(-8px);
  }
}

@keyframes hvr-bob {
  0% {
    -webkit-transform: translateY(-8px);
    transform: translateY(-8px);
  }
  50% {
    -webkit-transform: translateY(-4px);
    transform: translateY(-4px);
  }
  100% {
    -webkit-transform: translateY(-8px);
    transform: translateY(-8px);
  }
}

@-webkit-keyframes hvr-bob-float {
  100% {
    -webkit-transform: translateY(-8px);
    transform: translateY(-8px);
  }
}

@keyframes hvr-bob-float {
  100% {
    -webkit-transform: translateY(-8px);
    transform: translateY(-8px);
  }
}

.hvr-bob {
  display: inline-block;
  vertical-align: middle;
  -webkit-transform: perspective(1px) translateZ(0);
  transform: perspective(1px) translateZ(0);
  box-shadow: 0 0 1px transparent;
}

.hvr-bob:active,
.hvr-bob:focus,
.hvr-bob:hover {
  -webkit-animation-name: hvr-bob-float, hvr-bob;
  animation-name: hvr-bob-float, hvr-bob;
  -webkit-animation-duration: 0.3s, 1.5s;
  animation-duration: 0.3s, 1.5s;
  -webkit-animation-delay: 0s, 0.3s;
  animation-delay: 0s, 0.3s;
  -webkit-animation-timing-function: ease-out, ease-in-out;
  animation-timing-function: ease-out, ease-in-out;
  -webkit-animation-iteration-count: 1, infinite;
  animation-iteration-count: 1, infinite;
  -webkit-animation-fill-mode: forwards;
  animation-fill-mode: forwards;
  -webkit-animation-direction: normal, alternate;
  animation-direction: normal, alternate;
}

/* === 首頁專用樣式 === */
.index .latestNews .new-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px 0px;
}

.index .latestNews .newsSwiper {
  height: auto;
  position: relative;
}

.index .latestNews .newsSwiper .swiper-pagination-box {
  position: relative;
}

.index .latestNews .newsSwiper .swiper-pagination-box .swiper-pagination {
  width: auto;
  position: absolute;
  bottom: 0;
  right: 0;
}

.index .latestNews .newsSwiper .swiper-pagination-box .swiper-pagination .swiper-pagination-bullet + .swiper-pagination-bullet {
  margin-left: 6px;
}

.index .latestNews .newsSwiper .swiper-wrapper {
  margin-top: 8px;
}

/* 單則新聞時隱藏分頁 */
.index .latestNews .newsSwiper .swiper-pagination {
  display: none;
}

.index .latestNews .newsSwiper .btn-pause {
  display: none;
}

.index .latestNews .card .card-body .info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.index .latestNews .card .card-body .info .bg-secondary {
  padding: 4px 8px;
  color: #7a2300;
}

.index .latestNews .card .card-body .info .date {
  color: #6e707e;
}

/* === 服務分類/機關單位樣式 === */
.index .classification .nav-tabs {
  border-bottom: 1px solid #fff;
}

.index .classification .nav-tabs .nav-link {
  font-weight: 500;
}

.index .classification .nav-tabs .nav-link.active,
.index .classification .nav-tabs .nav-item.show .nav-link {
  border-color: #fff;
}

.index .classification .nav-tabs .nav-link:hover,
.index .classification .nav-tabs .nav-link:focus {
  border-color: #f8f9fc #f8f9fc #fff;
}

.index .classification .tab-content {
  background-color: #fff;
  padding-top: 2rem;
}

.index .classification .tab-content .btn-index {
  display: block;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-bottom: 2rem;
}

.index .classification .tab-content .btn-index .rounded-circle {
  width: 90px;
  height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  margin-bottom: 4px;
}

/* === 熱門申辦樣式 === */
.index .popular .popular-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.index .popular .popular-list {
  display: flex;
  align-items: stretch;
  padding: 12px 8px;
  display: block;
  border-bottom: 1px solid #dddfeb;
}

.index .popular .popular-list .info {
  margin-bottom: 8px;
}

.index .popular .popular-list .title {
  color: #3877ad;
  overflow: hidden;
  -webkit-line-clamp: 1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
}

/* === 搜尋與操作教學樣式 === */
.index .inquiry .card {
  padding: 1rem 1.25rem;
}

.index .operationalTeaching {
  margin-bottom: 2rem;
}

.index .operationalTeaching .list-group-item {
  display: flex;
  align-items: center;
}

.index .operationalTeaching .list-group-item .icon {
  width: 33%;
}

.index .operationalTeaching .list-group-item .title {
  width: 67%;
  color: #3a3b45;
  font-weight: 500;
}

/* === 回頁首按鈕 === */
.btn-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.btn-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* === Header 樣式 === */
header {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  width: 100%;
  margin: 0;
  padding: 0;
}

header#header_apply {
  margin: 0;
  padding: 0;
}

header .navbar {
  padding: 0;
  margin: 0;
  width: 100%;
  position: relative;
  /* 關鍵：讓 nav-top 與 logo/選單「上下排列」，避免被 navbar 的 flex 橫向排版擠在左側 */
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
}

header .navbar .container {
  padding-left: 15px;
  padding-right: 15px;
  margin-left: auto;
  margin-right: auto;
}

/* 只套用在 navbar 的「第一層」nav-top（避免把折疊選單裡的 nav-top 也強制顯示，造成中間多一條） */
header .navbar > .nav-top {
  /* Bootstrap 的 d-xl-block 會把 display 設成 block !important，這裡強制覆蓋成 flex */
  display: flex !important;
  align-items: center;
  width: 100%;
  background-color: #3a3b45 !important;
}

header .navbar > .nav-top .container {
  height: 60px;
  padding: 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header .navbar > .nav-top a {
  color: #fff;
}

header .navbar > .nav-top .list-inline-item .btn-outline-primary {
  padding: 2px 6px;
  background-color: #3a3b45 !important;
  border-color: #3a3b45 !important;
  color: #fff;
}

header .navbar > .nav-top .list-inline-item .btn-outline-primary.active,
header .navbar > .nav-top .list-inline-item .btn-outline-primary:hover,
header .navbar > .nav-top .list-inline-item .btn-outline-primary:focus {
  background-color: #3877ad !important;
  border-color: #3877ad !important;
  color: #fff !important;
}

header .navbar .header-top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@media (min-width: 1200px) {
  header .navbar .header-top .nav-top {
    display: none;
  }
}

@media (max-width: 1199.98px) {
  header .navbar .header-top {
    flex-wrap: wrap;
  }
}

header .navbar .header-top .navbar-brand {
  display: flex;
  align-items: center;
  margin-right: 0rem !important;
}

header .navbar .header-top .logo {
  width: 372px;
  margin: 0 1rem;
  margin-right: 0.5rem;
}

@media (max-width: 1199.98px) {
  header .navbar .header-top .logo {
    width: 316px;
    margin-right: 0rem !important;
  }
}

@media (max-width: 767.98px) {
  header .navbar .header-top .logo {
    width: 250px;
  }
}

/* 舊系統 header 的圖示選單排版（避免跑版） */
header .navbar .header-top .navbar-nav {
  font-weight: 500;
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  margin-bottom: 0;
}

@media (max-width: 767.98px) {
  header .navbar .header-top .navbar-nav {
    flex-direction: column;
    align-items: center;
  }
}

header .navbar .header-top .navbar-nav .nav-item {
  width: 25%;
}

@media (max-width: 1199.98px) {
  header .navbar .header-top .navbar-nav .nav-item {
    width: 100%;
  }
}

header .navbar .header-top .navbar-nav .nav-link {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #3a3b45;
  text-decoration: none;
}

@media (min-width: 992px) {
  header .navbar .header-top .navbar-nav .nav-link {
    height: 120px;
  }
}

header .navbar .header-top .navbar-nav .nav-link:hover {
  color: #3877ad;
}

/* === Footer 樣式 === */
footer {
  background-color: #1b1c26;
  color: #fff;
  margin-top: 3rem;
}

footer a {
  display: inline-block;
  color: #fff;
}

footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-main {
  font-size: 1rem;
  padding-top: 30px;
  padding-bottom: 30px;
  display: flex;
}

@media (max-width: 991.98px) {
  .footer-main {
    flex-direction: column;
    justify-content: flex-start;
    text-align: center;
  }
}

.footer-main .footer-logo {
  width: 360px;
  margin-right: 1rem;
}

@media (max-width: 991.98px) {
  .footer-main .footer-logo {
    width: 100%;
    margin-right: 0rem;
  }
}

.footer-main .footer-logo img {
  margin-left: auto;
  margin-right: auto;
}

.footer-main .list-unstyled {
  margin-bottom: 0px;
}

@media (max-width: 991.98px) {
  .footer-main .list-unstyled {
    margin-top: 30px;
  }
}

.footer-main .list-unstyled li {
  line-height: 2;
}

.footer-main .footer-img {
  display: flex;
  margin-left: auto;
}

.footer-main .footer-img li + li {
  padding-left: 1rem;
}

.copyright {
  font-size: 0.875rem;
  background-color: #333333;
  padding: 1rem 0;
  color: #fff;
}

.copyright .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

.copyright ul {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.copyright ul li {
  display: inline-block;
}

.copyright a {
  color: #fff;
}

.copyright a:hover {
  color: #fff;
  text-decoration: underline;
}

/* === 響應式樣式 === */
@media (max-width: 1199.98px) {
  .index .latestNews .card {
    display: flex;
    flex-direction: row;
    justify-content: center;
  }
}

@media (max-width: 767.98px) {
  .index .latestNews .card {
    flex-direction: column;
  }
  
  .index .classification .nav-tabs .nav-link {
    font-size: 1rem;
  }
  
  .index .popular {
    margin-top: 1.5rem;
  }
}

/* === Bootstrap 4 樣式補充 === */
/* Bootstrap 4 已經有這些類別，這裡只是確保覆蓋 */

/* === 無障礙樣式 === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* === 內頁共用樣式（配合首頁風格）=== */
#content .chcg-page-header {
  background: linear-gradient(135deg, rgba(56, 119, 173, 0.08), rgba(56, 119, 173, 0.04));
  padding: 2rem 0;
  margin-bottom: 2rem;
  border-bottom: 2px solid #3877ad;
}

#content .chcg-page-header h1 {
  color: #3877ad;
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

#content .chcg-page-header h1 i {
  margin-right: 0.5rem;
}

#content .chcg-page-header p {
  color: #5a5c69;
  margin-bottom: 0;
}

#content .chcg-breadcrumb {
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

#content .chcg-breadcrumb a {
  color: #3877ad;
}

#content .chcg-breadcrumb a:hover {
  text-decoration: underline;
}

#content .chcg-btn-back {
  color: #3877ad;
  text-decoration: none;
  font-weight: 500;
}

#content .chcg-btn-back:hover {
  color: #2d5d8a;
  text-decoration: underline;
}

