/* 全局樣式重置 */
body {
  margin: 0;
  font-family: 'Noto Sans TC', 'Poppins', sans-serif;
  background-color: #ffffff;
  color: #1a1a1a;
  transition: background-color 0.3s, color 0.3s;
  scroll-behavior: smooth;
  position: relative;
  z-index: 0;
}

/* 超連結設定 */
a {
  color: #0077b5;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* 粒子背景 */
#particles-js {
  position: fixed;
  width: 100%;
  height: 100%;
  z-index: 0;
  top: 0;
  left: 0;
}

/* 側邊欄 Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 200px;
  height: 100%;
  background-color: rgba(0, 30, 60, 0.9);
  padding-top: 60px;
  box-shadow: 2px 0 8px rgba(0,0,0,0.15);
  z-index: 1000;
  transform: translateX(0);
  transition: transform 0.3s ease;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  text-align: center;
}

.sidebar ul li {
  margin: 25px 0;
}

.sidebar ul li a {
  color: #ffffff;
  font-weight: bold; /* 字體加粗 */
  font-size: 18px; /* 字體稍大 */
  letter-spacing: 0.5px;
  transition: color 0.3s;
}

.sidebar ul li a:hover {
  color: #90caf9;
}

/* 淺色模式 active 項目 */
.sidebar ul li a.active {
  color: #000000; /* 黑色字 */
  font-weight: bold;
  background-color: rgba(0, 119, 181, 0.15); /* 淡藍背景 */
  padding: 8px 12px;
  border-radius: 6px;
  display: inline-block;
}

/* 深色模式 sidebar */
body.dark-mode .sidebar {
  background-color: rgba(20, 20, 20, 0.95); /* 比內文區塊更亮一點的灰黑色 */
  backdrop-filter: blur(8px); /* 加一點模糊玻璃感 */
}

/* 深色模式 active 項目 */
body.dark-mode .sidebar ul li a.active {
  color: #90caf9; /* 深色模式維持藍色字 */
  background-color: rgba(144, 202, 249, 0.15); /* 淺藍背景 */
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%); /* 預設隱藏左邊 */
    transition: transform 0.3s ease;
  }

  .sidebar.active {
    transform: translateX(0); /* 點了漢堡出現 */
  }

  header, section, .site-footer {
    margin-left: 0;
  }
}

/* 小漢堡按鈕 */
.menu-toggle {
  background-color: #0077b5;
  color: white;
  border: none;
  padding: 10px 12px;
  font-size: 24px;
  border-radius: 8px;
  cursor: pointer;
  width: 50px;
  height: 50px;
}

/* 漢堡按鈕在手機版才出現 */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }
}

/* 主要內容區 */
header, section {
  margin-left: 200px;
  padding: 60px 20px;
  max-width: 83%;
  position: relative;
  z-index: 1;
}

h1, h2, h3 {
  text-align: center;
}

section, .section-content {
  font-size: 18px; /* 內文字體加大 */
  line-height: 1.8; /* 行高加大，閱讀更舒服 */
  color: #333333;
}

/* 深色模式下內文字色 */
body.dark-mode section, 
body.dark-mode .section-content {
  color: #dddddd;
}

/* 主視覺 Hero */
.hero {
  text-align: center;
  padding: 100px 20px 40px;
}

.profile-img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 20px;
}

.social-links {
  margin-top: 10px;
}

/* 主題切換按鈕 */
#toggle-theme {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 10px 14px;
  border: none;
  background-color: #0077b5;
  color: white;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  z-index: 999;
}

/* 技能 Skill Bar */
.skills-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.skills-list li {
  background-color: rgba(0, 119, 181, 0.1);
  padding: 12px 20px;
  border-radius: 8px;
  color: #0077b5;
  font-weight: bold;
  text-align: center;
  display: flex; /* 新增這兩行 */
  align-items: center; /* 垂直置中 */
  justify-content: center; /* 水平置中 */
  transition: background-color 0.3s;
}

.skills-list li:hover {
  background-color: rgba(0, 119, 181, 0.2);
}

/* 深色模式 */
body.dark-mode .skills-list li {
  background-color: rgba(144, 202, 249, 0.1);
  color: #90caf9;
}

body.dark-mode .skills-list li:hover {
  background-color: rgba(144, 202, 249, 0.2);
}

.skill-category {
  margin-bottom: 40px;
}

.skill-category h3 {
  font-size: 22px;
  color: #0077b5;
  margin-bottom: 15px;
  text-align: left;
}

/* 深色模式下小標題 */
body.dark-mode .skill-category h3 {
  color: #90caf9;
}

/* 經歷 Timeline */
.timeline {
  border-left: 3px solid #0077b5;
  padding-left: 20px;
  margin-left: 20px;
}

.timeline-item {
  margin-bottom: 30px;
}

/* 專案作品清單 */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.project-item {
  background-color: rgba(0, 119, 181, 0.05);
  padding: 20px;
  margin-bottom: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.project-item h3 {
  margin-bottom: 10px;
  color: #0077b5;
}

.project-item p {
  margin: 5px 0;
}

.project-meta {
  font-size: 14px;
  color: #777;
  margin: 5px 0 15px 0;
  text-align: left;
}

.project-meta span {
  margin-right: 8px;
}

.project-description p {
  margin-bottom: 10px;
  line-height: 1.8;
  font-size: 18px; /* 字體加大 */
  color: #333;
}

/* 深色模式下內文 */
body.dark-mode .project-description p {
  color: #ddd;
}

.project-tags {
  margin-top: 10px;
}

.project-tags span {
  display: inline-block;
  background-color: #0077b5;
  color: #fff;
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 14px;
  margin-right: 8px;
  margin-top: 5px;
}

/* 深色模式適配 */
body.dark-mode .project-item {
  background-color: rgba(144, 202, 249, 0.1);
}

body.dark-mode .project-tags span {
  background-color: #90caf9;
  color: #000;
}

/* 深色模式設定 */
body.dark-mode {
  background-color: #121212;
  color: #eeeeee;
}

body.dark-mode .sidebar {
  background-color: rgba(30,30,30,0.9);
}

body.dark-mode a {
  color: #90caf9;
}

/* 響應式 RWD */
@media (max-width: 768px) {
  header, section {
    margin-left: 0;
    padding: 40px 20px;
  }

  #toggle-theme {
    right: 10px;
  }
}

/* 回到頂部 */
#backToTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 12px 18px;
  background-color: #0077b5;
  color: white;
  font-size: 14px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  display: none;
  z-index: 999;
  transition: opacity 0.3s;
}

/* 深色模式按鈕 */
body.dark-mode #backToTop {
  background-color: #2196f3;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 20px;
  font-size: 14px;
  color: #666;
  background-color: #f9f9f9;
  margin-left: 200px; /* 注意有Sidebar的情況 */
}

/* 響應式修正 Footer */
@media (max-width: 768px) {
  .site-footer {
    margin-left: 0;
    padding: 15px 10px;
    font-size: 13px;
  }
}

/* 深色模式下Footer */
body.dark-mode .site-footer {
  background-color: #1a1a1a;
  color: #bbb;
}

/* 每個區塊固定滿版高度 */
section {
  min-height: 100vh;
  margin-left: 200px;
  padding: 40px 20px;
  max-width: 83%;
  width: calc(100% - 200px);
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.85);
  margin-bottom: 0;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
}

/* 深色模式 section */
body.dark-mode section {
  background: rgba(30,30,30,0.85);
}

/* 深色模式下區塊背景 */
body.dark-mode section {
  background: rgba(30,30,30,0.85);
}

section h2 {
  position: sticky;
  top: 20px;
  background-color: rgba(255, 255, 255, 0.85);
  margin-bottom: 20px; /* 增加下方間距，避免蓋到內容 */
  padding: 15px 0;
  z-index: 2;
  font-size: 28px;
}

/* 深色模式下標題 */
body.dark-mode section h2 {
  background-color: rgba(30,30,30,0.85);
}

.section-header {
  position: sticky;
  top: 20px;
  background-color: rgba(255, 255, 255, 0.7); /* 背景透明度更亮 */
  backdrop-filter: blur(10px); /* 模糊背景，更有層次 */
  z-index: 2;
  padding: 15px 0;
  border-bottom: 2px solid rgba(0, 119, 181, 0.3); /* 淡淡底線，增加分隔感 */
}

.section-header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: bold;
}

/* 內文部分 */
.section-content {
  margin-top: 40px;
}

/* 深色模式 */
body.dark-mode .section-header {
  background-color: rgba(30, 30, 30, 0.7);
  border-bottom: 2px solid rgba(144, 202, 249, 0.3);
}

@media (max-width: 768px) {
  header, section {
    margin-left: 0;
    padding: 60px 20px 40px;
    max-width: 100%;
  }

  section {
    width: auto;
  }

  .section-content {
    font-size: 16px;
    padding: 0 10px;
    margin-top: 30px;
  }

  .skills-list {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
  }

  .project-item {
    padding: 15px;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .sidebar {
    width: 160px;
    padding-top: 50px;
  }

  header, section, .site-footer {
    margin-left: 160px;
  }

  .skills-list {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
  }

  .project-item {
    padding: 15px;
  }

  .project-description p {
    font-size: 17px;
  }
}

/* 小漢堡按鈕容器 */
.mobile-header {
  position: fixed;
  top: 20px;
  left: 20px;
  display: none;
  z-index: 2000;
}

/* 只有手機版出現 */
@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }
}

/* 主題切換按鈕 */
.toggle-theme {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: #0077b5;
  color: white;
  border: none;
  padding: 10px 12px;
  font-size: 20px;
  border-radius: 8px;
  cursor: pointer;
  z-index: 2000;
}