/* === 基本設定 === */
body {
  font-family: "Noto Sans TC", sans-serif;
  margin: 0;
  background-color: #fffaf3;
  background-image: url("image/背景圖.png");
  background-size: 900px auto;      /* ✅ 調整圖片大小（建議 800~1000px 間） */
  background-position: center top;  /* ✅ 置中靠上 */
  background-repeat: repeat;        /* ✅ 平鋪 */
  background-attachment: fixed;
  color: #333;
  display: flex;
  flex-direction: row;
  min-height: 100vh;
}

/* ✅ 淡淡柔焦遮罩層：讓背景不搶主體 */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 250, 240, 0.75); /* 米白半透明層 */
  backdrop-filter: blur(2px);            /* 模糊柔焦 */
  z-index: -1;
}

/* === 側邊導覽欄 === */
.sidebar {
  background: #fff;
  width: 260px;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.1);
  position: fixed;
  left: 0;
  top: 0;
  transition: transform 0.3s ease-in-out;
  z-index: 999;
}

/* Logo */
.sidebar .logo {
  background: #e8953c;
  color: #fff;
  font-weight: bold;
  text-align: center;
  padding: 16px 0;
  font-size: 1.2em;
}

/* === 主要選單結構 === */
.sidebar nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar nav ul > li {
  border-bottom: 1px solid #eee;
}

/* 父層分類標題 */
.sidebar nav span {
  display: block;
  background: #fff5e9;
  color: #e8953c;
  font-weight: bold;
  padding: 10px 15px;
}

/* === 子項目（第二層） === */
.sidebar nav ul ul li {
  color: #444;
  transition: background 0.25s, color 0.25s;
}

/* 🔗 子項連結樣式 */
.sidebar nav ul ul li a {
  color: inherit;
  text-decoration: none;
  display: block;
  width: 100%;

  /* 🔧 關鍵修正 */
  padding: 8px 32px 8px 25px; /* 右邊多留空間給 scrollbar */
  white-space: normal;        /* 允許自動換行 */
  word-break: break-word;    /* 中文安全換行 */

  line-height: 1.6;
  transition: all 0.25s ease-in-out;
  border-left: 4px solid transparent;
  box-sizing: border-box;    /* 防止寬度計算錯誤 */
}


/* hover 效果 */
.sidebar nav ul ul li a:hover {
  color: #e8953c;
  background-color: #fff2de;
  border-left-color: #f1b972;
}

/* 🔸 被選取項目高亮 */
.sidebar nav ul ul li a.active {
  background-color: #ffe8c4;
  color: #b96a00;
  font-weight: 600;
  border-left: 4px solid #e8953c;
  box-shadow: inset 0 0 6px rgba(233, 149, 60, 0.2);
}

/* 🚫 非連結項目（純文字） */
.sidebar nav ul ul li:not(:has(a)) {
  color: #aaa;
  padding: 6px 25px;
  font-style: italic;
  text-decoration: underline dotted #ccc;
  cursor: not-allowed;
}

/* === 主內容區 === */
.content {
  margin-left: 260px;
  padding: 40px;
  width: calc(100% - 260px);
  min-height: 100vh;
  transition: margin-left 0.3s ease-in-out;
}

/* 卡片容器 */
.card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  padding: 40px 30px;
  max-width: 900px;
  margin: 40px auto;
  text-align: center;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
}

/* === 區塊樣式 === */
.section {
  padding: 18px 20px;
  border-radius: 12px;
  margin: 18px 0;
  text-align: left;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.section.yellow {
  background: #fff7e5;
  border-left: 6px solid #e8953c;
}

.section.blue {
  background: #eaf4ff;
  border-left: 6px solid #7ab6f8;
}

.section.white {
  background: #fff;
  border-left: 6px solid #ddd;
}

/* === Footer === */
footer {
  text-align: center;
  padding: 20px;
  color: #666;
}

/* === 手機版選單按鈕 === */
.menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  background: rgba(232, 149, 60, 0.92);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 50px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  z-index: 1001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
  transition: all 0.25s ease-in-out;
}

.menu-toggle:hover {
  background: rgba(241, 166, 74, 0.95);
  transform: scale(1.05);
}

.menu-toggle:active {
  transform: scale(0.96);
}

/* === 手機版 RWD 調整 === */
@media (max-width: 800px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    height: 100%;
    width: 230px;
    z-index: 1000;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.15);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .content {
    margin-left: 0;
    padding: 20px;
    width: 100%;
  }

  .menu-toggle {
    display: block;
  }
}

/* === 燈箱樣式（圖片放大） === */
.lightbox {
  display: none;
  position: fixed;
  z-index: 10000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
}

.lightbox img {
  max-width: 95%;
  max-height: 95%;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  cursor: zoom-out;
}

/* === 圖鑑網格樣式 === */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  justify-items: center;
  margin: 15px 0 30px 0;
}

.gallery img {
  width: 100%;
  max-width: 200px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s;
  cursor: pointer;
}

.gallery img:hover {
  transform: scale(1.05);
}

/* === 橫圖展示 === */
.gallery-horizontal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  margin: 25px 0 40px 0;
}

.gallery-horizontal img {
  width: 100%;
  max-width: 900px;
  border-radius: 15px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transition: transform 0.3s ease;
  cursor: pointer;
}

.gallery-horizontal img:hover {
  transform: scale(1.02);
}

/* === 圖片與影片通用樣式 === */
.media-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 25px 0;
}

.media-box img,
.media-box video {
  max-width: 90%;
  border-radius: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.media-box img:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.media-box video {
  width: 90%;
  height: auto;
}

.media-box .caption {
  margin-top: 10px;
  font-size: 0.9em;
  color: #777;
  text-align: center;
  line-height: 1.4;
}

ol {
  padding-left: 25px;     /* 調整整體縮排距離 */
  margin-top: 10px;
  line-height: 1.8;
}

ol li {
  margin-bottom: 6px;     /* 每項之間的距離 */
  padding-left: 4px;      /* 讓文字靠近數字一點 */
  text-indent: -4px;      /* 把文字往回拉，讓「1.」和文字更接近 */
}

.line-section {
  background: #f0f9ff;
  border-radius: 15px;
  padding: 25px;
  text-align: center;
  margin: 30px auto;
  max-width: 600px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.line-section h2 {
  color: #0ea5e9;
  margin-bottom: 10px;
}

.line-section p {
  color: #374151;
  line-height: 1.7;
}

.join-btn {
  display: inline-block;
  background-color: #06c755;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  transition: 0.2s;
}

.join-btn:hover {
  background-color: #04a046;
}

/* === 首頁按鈕強調 === */
.home-btn {
  display: block;
  background: #e8953c;
  color: white !important;
  font-weight: bold;
  padding: 12px 18px;
  border-radius: 10px;
  margin: 15px;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
  transition: 0.25s ease;
}

.home-btn:hover {
  background: #ffab47;
  transform: scale(1.06);
}

/* === 下拉展開動畫 === */
.sidebar nav ul ul {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease-in-out;
}

.sidebar nav li > span {
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar nav li > span::after {
  content: "▾";
  font-size: 0.9em;
  color: #e8953c;
  transition: transform 0.3s ease;
}

.sidebar nav li.open > span::after {
  transform: rotate(180deg);
}

/* 🔍 搜尋框 */
.search-box {
  margin: 15px;
  display: flex;
  gap: 8px;
}
.search-box input {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #aaa;
}
.search-box button {
  padding: 8px 12px;
  background: #ff8800;
  border: none;
  color: white;
  border-radius: 6px;
  cursor: pointer;
}
.search-box button:hover {
  background: #cc6f00;
}

/* 🔍 搜尋結果 */
.search-results {
  background: white;
  padding: 20px;
  border-radius: 10px;
  margin: 20px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}
.result-card {
  border-bottom: 1px solid #ddd;
  padding: 10px 0;
}
.result-card:last-child {
  border-bottom: none;
}
.result-card h3 {
  margin: 0;
}
.result-card a {
  color: #0077cc;
  font-weight: bold;
}

.search-list {
  list-style: none;
  padding-left: 0;
}

.search-list li {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.search-list li a {
  color: #0077cc;
  text-decoration: none;
  font-size: 18px;
}

.search-list li a:hover {
  text-decoration: underline;
}

.search-results {
  background: white;
  padding: 20px;
  border-radius: 12px;
  margin: 20px auto;
  max-width: 900px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.search-list {
  list-style: none;
  padding-left: 0;
}

.search-list li {
  padding: 12px 0;
  border-bottom: 1px solid #ddd;
}

.search-list li:last-child {
  border-bottom: none;
}

.search-list li a {
  color: #0077cc;
  font-size: 20px;
  text-decoration: none;
}

.search-list li a:hover {
  text-decoration: underline;
}

/* ✅ 修正下拉選單文字被裁切問題 */
.sidebar nav li.open > ul {
  max-height: 3000px;
  overflow: visible;
}

.sidebar nav ul ul li a {
  line-height: 1.6;
  padding-top: 8px;
  padding-bottom: 8px;
}
