* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #fff;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

#news-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    justify-content: center;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto; /* 使容器居中 */
}

.article-card {
    display: flex;
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
    height: 250px; /* 固定卡片高度 */
    max-width: 800px; /* 調整卡片寬度 */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); /* 設定背景顏色 */
    background-color: rgba(255, 255, 255, 0.9);
    transition: transform 0.3s, box-shadow 0.3s;
}

.article-card:hover {
    transform: translateY(-10px); /* 向上移動 */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); /* 增加陰影 */
}

.image-container {
    flex-shrink: 0;
    width: 250px; /* 固定圖片寬度 */
    height: 100%; /* 固定圖片高度 */
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; /* 使子元素定位基於此容器 */
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 圖片填充容器 */
}

.date-container {
    position: absolute;
    bottom: 10px; /* 距離圖片底部 */
    left: 10px; /* 距離圖片左側 */
    background: rgba(0, 0, 0, 0.8); /* 半透明背景 */
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9em;
}

.text-container {
    padding: 15px;
    flex-grow: 1;
}

.text-container h2 {
    margin-top: 0;
    font-size: 1.2em;
}

.text-container p {
    margin: 10px 0;
}

.text-container .category,
.text-container .author {
    font-size: 0.9em;
    color: #666;
}


.header2 {
    width: 100%;
    height: 480px; /* 設定一個合適的高度 */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-image: url("../img/最新2.png");
}

/* Header樣式 */
.top-bar {
    background-size: cover;
    background-position: center;
    display: flex;
    width: 100%;
    padding: 20px;
    height: 100px;
    box-sizing: border-box;
    margin: 0;
}

.header {
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
}

.logo {
    max-width: 150px;
    height: auto;
    margin-right: 30px;
}

.banner-img {
    max-width: 100px;
    height: auto;
}

#container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 0;
    margin: 0;
}

/* 導航欄樣式 */

nav {
  display: flex;
  padding: 2rem 3.15rem;
  border-radius: 20px;
  margin-bottom: 20px;
  align-items: center; /* 確保所有項目垂直居中 */
}

nav a, .dropdown .dropbtn {
  color: inherit;
  text-decoration: none;
  margin: 0 0.2rem;
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-radius: 30px;
  position: relative;
  --hover-bg: #91131320;
  --hover-c: #999ae8;
  color: #000;
  height: 40px; /* 設置一個固定高度 */
}

nav a svg, .dropdown .dropbtn svg {
  width: 20px;
  height: 20px;
  margin-right: 0.5rem;
}

nav a span, .dropdown .dropbtn span {
  font-size: 0.9rem;
  color: #000;
  white-space: nowrap; /* 防止文字換行 */
}


.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 200px; /* 增加最小寬度 */
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
  border-radius: 4px;
}

.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  white-space: nowrap; /* 防止文字換行 */
  overflow: hidden; /* 隱藏超出部分 */
  text-overflow: ellipsis; /* 使用省略號表示超出部分 */
}

.dropdown-content a:hover {
  background-color: #f1f1f1;
}

.dropdown:hover .dropdown-content {
  display: block;
}

.dropbtn {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
  margin: 0 0.2rem;
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-radius: 30px;
  position: relative;
  --hover-bg: #91131320;
  --hover-c: #999ae8;
  color: #000; /* 確保導航欄鏈接文字是黑色 */
}

a:hover {
  color: #999ae8;
}

span:hover {
  color: #999ae8;
}

  /* Pagination樣式 */
#pagination-container {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  margin-bottom: 50px;

}

.pagination-button {
  margin: 0 5px;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  background-color: #f0f0f0;
  cursor: pointer;
  transition: background-color 0.3s;
}

.pagination-button.active {
  background-color: #999ae8;
  color: #fff;
}

.pagination-button:hover {
  background-color: #999ae8;
  color: #fff;
}

#footer {
  background-image: url("../img/color.png");
  background-size: cover;
  background-repeat: no-repeat; 
  color: #fff;
  padding: 20px 0;
  text-align: center;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.footer-content p {
  margin: 0;
}

.footer-nav {
  display: flex;
  gap: 20px;
}

.footer-nav a {
  color: #fff;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-nav a:hover {
  color: #999ae8;
}

/* 文章容器样式 */
#article-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 文章标题样式 */
#article-container h1 {
    font-size: 2em;
    margin-bottom: 10px;
    color: #999ae8;
}

/* 文章日期样式 */
#article-container .date {
    font-size: 0.9em;
    color: #777;
    margin-bottom: 20px;
}

/* 文章内容样式 */
#article-container .content {
    font-size: 1em;
    line-height: 1.8;
    color: #333;
}

/* 文章图片样式 */
#article-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 20px;
}