/* ==========================================================
   FileName: assets/css/pages/custom.css
   Description: 客製化模組頁面專用樣式 (去重複化版本)
   Dependencies: variables.css, ui-elements.css
   ========================================================== */

/* section {
  padding-bottom: 5rem;
} */

/* ==========================================================
   1. 佈局容器 (Layout & Container)
   ========================================================== */

/* --- 頂部形象圖 (Page Banner) --- */
/* 這是頁面特有的 Banner 樣式，ui-elements 沒有，故保留 */
.page-banner {
  width: 100%;
  position: relative;
  display: block;
  overflow: hidden;
  margin-top: var(--nav-height-mobile, 46px);
}

.page-banner img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  max-height: 60vh;
}

@media (min-width: 768px) {
  .page-banner {
    margin-top: var(--nav-height-tablet, 56px);
  }
}

@media (min-width: 1024px) {
  .page-banner {
    margin-top: var(--nav-height-desktop, 80px);
  }
}

/* --- 全域容器 (Fluid Container) --- */
.x720-container {
  width: var(--container-fluid-width, 90%);
  margin-left: auto;
  margin-right: auto;
  padding-left: 15px;
  padding-right: 15px;
  position: relative;
}

/* ==========================================================
   2. 導覽元件 (Breadcrumb)
   ========================================================== */

/* 麵包屑也是頁面特有元件，保留 */
.x720-breadcrumb {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0;
  gap: 8px;
  margin-top: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.breadcrumb-link {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--color-header);
  font-size: var(--fs-body-base);
  font-weight: var(--fw-semilight);
  border-bottom: 1px solid transparent;
  transition: all 0.3s ease;
  padding-bottom: 2px;
}

.breadcrumb-link span {
  border-bottom: 1px solid var(--color-light);
  padding-bottom: 1px;
}

.breadcrumb-link:hover {
  color: var(--color-black);
}

.breadcrumb-link:hover span {
  border-bottom-color: var(--color-black);
}

.breadcrumb-link img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.breadcrumb-sep {
  width: 14px;
  height: 14px;
  object-fit: contain;
  opacity: 0.6;
}

.breadcrumb-current {
  color: var(--primary-color);
  font-size: var(--fs-body-base);
  font-weight: var(--fw-semilight);
  letter-spacing: 0.5px;
}

@media (max-width: 1024px) {
  .breadcrumb-link,
  .breadcrumb-current {
    font-size: var(--fs-body-md);
  }
}

/* ==========================================================
   3. 頁面專用 Typography (Content Specific)
   ========================================================== */

/* 內文標題 (對應 H2) - 用於 About Intro 的標題 */
.about-h2 {
  font-family: var(--font-family-base);
  font-size: var(--fs-h1);
  font-weight: var(--fw-bold);
  color: var(--color-header);
  margin-bottom: 1.5rem;
  line-height: 1.3;
}

/* 內文文字 (Body Text) - 用於各種描述 */
.about-context-word {
  font-family: var(--font-family-base);
  font-size: var(--fs-body-focus);
  font-weight: var(--fw-semilight);
  color: var(--color-header);
  line-height: 1.8;
  white-space: pre-line;
}

@media (max-width: 1024px) {
  .about-h2 {
    font-size: var(--fs-h2);
  }
  .about-context-word {
    font-size: var(--fs-body-base);
  }
}

/* ==========================================================
   7. 模組：通用雙欄表格 (Generic Table) - [Updated]
   ========================================================== */

.about-center-table {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  border: 1px solid #eee;
  margin-top: 2rem;
  margin-bottom: 4rem;
}

.theme-table {
  width: 100%;
  border-collapse: collapse;
  /* 預設對齊由 JS 控制 style="text-align: ..." */
}

/* --- 表頭 --- */
.theme-table thead th {
  background-color: var(--secondary-color-1);
  color: #fff;
  padding: 1.2rem;
  font-size: 1.1rem;
  font-weight: 500;
  border-bottom: 3px solid var(--primary-color);
  /* 寬度設定：這裡設為 30% / 70% 或 50% / 50%，視需求而定 */
  /* 如果不設，瀏覽器會自動依照內容分配 */
  width: 30%;
}
.theme-table thead th:last-child {
  width: 70%;
}

/* --- 表格內容 --- */
.theme-table tbody tr {
  border-bottom: 1px solid #eee;
}

.theme-table tbody tr:hover {
  background-color: #f8fbff;
}

/* 通用單元格樣式 (不再區分 title-cell / content-cell) */
.theme-general-cell {
  padding: 1.5rem;
  vertical-align: top; /* 內容多時靠上對齊比較好看 */
  line-height: 1.8;
  color: var(--color-header);
  font-size: var(--fs-body-focus);
}

/* 清單樣式微調 */
.custom-list {
  padding-left: 1.2em; /* 縮排 */
  margin: 0;
  display: inline-block; /* 讓清單區塊跟隨父層對齊 */
  text-align: left; /* 清單項目內的文字保持靠左，比較易讀 */
}

/* 特殊：如果全域是對齊中間，清單本身居中，但文字靠左 */
.theme-table[style*="text-align: center"] .custom-list {
  text-align: left;
}
/* 特殊：如果全域靠右，清單文字也靠右 */
.theme-table[style*="text-align: right"] .custom-list {
  text-align: right;
  direction: rtl; /* 讓圓點/數字跑到右邊 */
}

/* --- 📱 手機版 RWD --- */
@media (max-width: 768px) {
  .theme-table,
  .theme-table thead,
  .theme-table tbody,
  .theme-table th,
  .theme-table td,
  .theme-table tr {
    display: block;
  }

  .theme-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .theme-table tbody tr {
    border: 1px solid #eee;
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  }

  .theme-general-cell {
    width: 100%;
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
  }

  /* 在手機版，第一欄通常當作標題，加點背景色區隔 */
  .theme-general-cell:first-child {
    background-color: #fcfcfc;
    font-weight: 700;
    color: var(--secondary-color-1);
  }
}

/* ==========================================================
   5. 模組：交通方式 (Transport Info)
   ========================================================== */

.section-transport {
  padding-top: 1rem;
  padding-bottom: 4rem;
}

/* 交通資訊容器 */
.transport-details {
  /* background-color 由 JS 控制 (支援透明度) */
  padding: 2.5rem;
  border-radius: 16px;
  height: 400px;
  display: flex;
  flex-direction: column;
  /* justify-content 由 JS 控制 (垂直對齊) */

  /* 加一點 backdrop-filter 讓半透明背景更有質感 (毛玻璃效果) */
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);

  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05); /* 淡淡的邊框 */
}

/* 內容區域 */
.transport-content-body {
  font-size: var(--fs-body-focus);
  line-height: 1.8;
  font-weight: var(--fw-semilight);
  width: 100%;
}

.transport-content-body ul,
.transport-content-body ol {
  padding-left: 1.2rem;
  margin: 0;
  display: inline-block;
  width: 100%;
}

/* 地圖容器 */
.map-container {
  width: 100%;
  height: 400px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  z-index: 1;
}

@media (max-width: 991px) {
  .transport-details {
    height: auto;
    min-height: 300px;
    margin-top: 1rem;
  }
}
/* ==========================================================
   6. 模組：圖片集 (Flex 比例排版 + 標題區塊)
   ========================================================== */

.about-content {
  text-align: center; /* 讓內容預設置中 */
}

/* --- 新增：標題區塊樣式 --- */

/* 主標題 (H2) */
.features-main-title {
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  color: var(--color-header);
  margin-top: 1rem;
  margin-bottom: 1rem;
  line-height: 1.3;
  margin: 0 1%;
}

/* 描述內文 (P) */
.features-description {
  font-size: var(--fs-body-focus);
  color: var(--color-header);
  font-weight: var(--fw-regular);
  line-height: 1.8;
  margin: 0 1%;
  white-space: pre-line; /* 支援換行 */
}

/* --- 圖片集容器 (維持之前的 Flex 設定) --- */
.about-center-reality {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: stretch;

  width: 100%;
  margin-top: 3rem; /* 增加與上方文字的距離 */
  position: relative;
  z-index: 2;
}

/* 個別圖片項目 */
.feature-item {
  margin: 0 1%; /* 2% 間距 */
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  transition: all 0.3s ease;
}

.feature-content-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.feature-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.feature-img:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

/* 圖片介紹 (P) */
.feature-caption {
  margin-top: 12px;
  font-size: var(--fs-body-focus);
  color: var(--color-black);
  font-weight: var(--fw-regular);
  text-align: center;
  width: 100%;
  white-space: pre-wrap;
}

/* --- RWD 設定 (維持之前邏輯) --- */
@media (max-width: 1024px) {
  .feature-item {
    margin: 0 0.5%;
  }

  /* 主標題 (H2) */
  .features-main-title {
    font-size: var(--fs-h3);
  }

  /* 描述內文 (P) */
  .features-description {
    font-size: var(--fs-body-base);
    font-weight: var(--fw-semilight);
  }

  /* 圖片介紹 (P) */
  .feature-caption {
    margin-top: 12px;
    font-size: var(--fs-body-base);
    color: var(--color-semilight);
  }
}

@media (max-width: 768px) {
  .about-center-reality {
    flex-direction: column;
    align-items: center;
  }

  .feature-item {
    width: 100% !important;
    flex: none !important;
    margin: 0 0 24px 0;
    align-self: center !important;
  }

  .feature-content-wrapper {
    align-items: center !important;
  }

  .feature-img {
    max-width: 400px;
    margin: 0 auto;
  }
}

/* ==========================================================
   7. 模組：主題導覽表格 (Custom Theme Table) - 🆕 新增部分
   ========================================================== */

/* 容器樣式 */
.about-center-table {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  border: 1px solid #eee;
  margin-top: 2rem;
  margin-bottom: 4rem; /* 與下方保持距離 */
}

.theme-table {
  width: 100%;
  border-collapse: collapse;
}

/* --- 表頭樣式 --- */
.theme-table thead th {
  background-color: var(--secondary-color-1); /* 使用變數 */
  color: #fff;
  padding: 1.2rem;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-align: center;
  border-bottom: 3px solid var(--primary-color);
}

/* --- 表格內容樣式 --- */
.theme-table tbody tr {
  border-bottom: 1px solid #eee;
  transition: background-color 0.3s ease;
}

.theme-table tbody tr:last-child {
  border-bottom: none;
}

.theme-table tbody tr:hover {
  background-color: #f8fbff;
}

.theme-table td {
  padding: 1.5rem;
  vertical-align: middle;
  line-height: 1.8;
  color: var(--color-black);
  font-size: var(--fs-body-focus);
  font-weight: var(--fw-semilight);
}

/* 左側主題欄位 */
.theme-title-cell {
  background-color: #fcfcfc;
  border-right: 1px solid #eee;
  width: 25%; /* 電腦版固定寬度 */
  text-align: center;
}

.theme-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-weight: 700;
  color: var(--secondary-color-1);
  font-size: 1.1rem;
}

.theme-x {
  color: var(--primary-color);
  font-size: 0.8rem;
  opacity: 0.7;
  margin: 2px 0;
}

/* 右側內容欄位 */
.theme-content-cell {
  width: 75%;
}

.spot-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.spot-list li {
  display: inline-block;
  color: #555;
}

/* --- 📱 手機版 RWD (Stacked Cards Mode) --- */
@media (max-width: 768px) {
  /* 1. 強制變成區塊堆疊 */
  .theme-table,
  .theme-table thead,
  .theme-table tbody,
  .theme-table th,
  .theme-table td,
  .theme-table tr {
    display: block;
  }

  /* 2. 隱藏原本的表頭 */
  .theme-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  /* 3. 卡片外觀 */
  .theme-table tbody tr {
    border: 1px solid #eee;
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  }

  /* 4. 主題標題區 (變身為卡片標題) */
  .theme-title-cell {
    width: 100%;
    border-right: none;
    background-color: #eaf4f8; /* 淺色背景區隔 */
    padding: 1rem;
    border-bottom: 1px solid #ddd;
  }

  .theme-box {
    flex-direction: row;
    gap: 8px;
    font-size: 1.1rem;
  }

  .theme-x {
    margin: 0;
    font-size: 0.9rem;
  }

  /* 5. 內容區 */
  .theme-content-cell {
    width: 100%;
    padding: 1rem 1.2rem;
  }

  .spot-list {
    display: block;
  }

  .spot-list li {
    display: block;
    margin-bottom: 4px;
    padding-left: 4px;
  }
}

/* ==========================================================
   8. 模組：互動地圖與列表 (Interactive Map & List)
   ========================================================== */
.section-interactive-map {
  padding-top: 1rem;
  padding-bottom: 4rem;
}

/* 標題線條裝飾 */
.map-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  margin: 0 auto;
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  color: var(--secondary-color-1);
}

.map-header::before,
.map-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--secondary-color-1);
  opacity: 0.2;
}

.store-map-container {
  display: flex;
  gap: 1.2rem;
  width: 100%;
}

.store-map {
  flex: 1 1 65%;
  height: 600px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  z-index: 1;
}

.store-list {
  flex: 1 1 35%;
  max-height: 600px;
  overflow-y: auto;
  background-color: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
}

/* 滾動條美化 */
.store-list::-webkit-scrollbar {
  width: 6px;
}
.store-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* 列表每項樣式 */
.store-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0.5rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    padding-left 0.2s ease;
  border-radius: 8px;
}

.store-item:hover {
  background-color: var(--secondary-color-2, #f8fafc);
  padding-left: 0.8rem;
}

.store-item .item-badge {
  width: 26px;
  height: 26px;
  font-size: 0.8rem;
  background-color: var(--secondary-color-1);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: bold;
}

.store-item .item-name {
  font-weight: 600;
  color: var(--color-header, #333);
  font-size: 0.95rem;
}

.store-item .item-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

/* 互動地圖專用 Modal */
.store-modal {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1060;
  justify-content: center;
  align-items: center;
}

.store-modal-content {
  display: flex;
  flex-direction: column;

  /* 🔥 換上全域變數，與頁面內容完美對齊齊平 */
  width: var(--container-fluid-width, 90%);
  max-width: none;

  /* 👇 新增這兩行：限制彈窗最大高度為螢幕的 90%，並允許內容過長時滾動 */
  max-height: 90vh;
  overflow-y: auto;

  border-radius: 16px;
  background-color: #fff;
  position: relative;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
  animation: modalPopUp 0.3s ease;
}

@keyframes modalPopUp {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.store-modal-top {
  width: 100%;
  background-color: #e2e8f0;
  position: relative;
}

/* 👇 修正圖片爆炸問題的核心 */
.store-modal-top img {
  width: 100%;
  max-height: 45vh; /* 限制圖片高度最多只能佔螢幕高度的 45% */
  object-fit: cover; /* 確保圖片不變形，多餘的部分會像背景圖一樣自動置中裁切 */
  display: block;
}

.store-modal-bottom {
  padding: 1.5rem;
}

.store-modal-close {
  position: absolute;
  right: 1rem;
  top: 1rem;
  background: rgba(0, 0, 0, 0.4);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  color: #fff;
  z-index: 2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.store-modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

.store-button-group {
  display: flex;
  gap: 10px;
  margin-top: 1.2rem;
}

.store-button-group button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.6rem;
  font-size: 0.95rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

/* ==========================================================
   互動地圖 Modal 按鈕樣式 (對齊舊版設計)
   ========================================================== */
.store-btn-intro {
  background-color: #ffffff;
  color: var(--color-header, #333333);
  border: 1px solid #cccccc;
  font-weight: 500;
  transition: all 0.2s ease;
}

.store-btn-intro:hover {
  background-color: #f8f9fa;
  border-color: #aaaaaa;
  color: var(--color-black, #000000);
}

.store-btn-route {
  background-color: var(--secondary-color-1);
  color: #ffffff;
  border: 1px solid var(--secondary-color-1);
  font-weight: 500;
  transition: all 0.2s ease;
}

.store-btn-route:hover {
  filter: brightness(0.9);
  color: #ffffff;
}

.store-btn-gps {
  background-color: var(--primary-color);
  color: #ffffff;
  border: 1px solid var(--primary-color);
  font-weight: 500;
  transition: all 0.2s ease;
}

.store-btn-gps:hover {
  filter: brightness(0.9);
  color: #ffffff;
}
/* --- RWD --- */
@media (max-width: 991px) {
  .store-map-container {
    flex-direction: column;
  }
  .store-map {
    height: 400px;
    flex: none;
    width: 100%;
  }
  .store-list {
    max-height: 450px;
    flex: none;
    width: 100%;
  }
}
@media (max-width: 576px) {
  .store-button-group {
    flex-direction: column;
  }
  .store-modal-top {
    /* height: 200px; */
  }
}

/* ==========================================================
   9. 互動地圖：客製化 Logo 大頭針 (Custom Map Pin)
   ========================================================== */
.custom-map-pin-wrapper {
  background: transparent;
  border: none;
}

.custom-map-pin {
  width: 44px;
  height: 44px;
  background-color: var(--primary-color); /* 外框與下方箭頭使用系統主色 */
  border-radius: 50%;
  border: 2px solid #ffffff; /* 白邊外框，讓圖片有立體感 */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition:
    transform 0.2s ease,
    z-index 0.2s;
  z-index: 10;
  /* ⚠️注意：父層絕對不能加 overflow: hidden，否則下方的箭頭(::after)會被喀嚓裁切掉 */
}

/* 懸停時放大一點，凸顯互動感 */
.custom-map-pin:hover {
  transform: scale(1.15) translateY(-5px);
  z-index: 100 !important;
}

/* 內部的 Logo 圖片 (修正重點在這裡 👇) */
.custom-map-pin img {
  width: 100% !important; /* 填滿父層 (.custom-map-pin) 扣除 border 後的空間 */
  height: 100% !important; /* 填滿父層空間 */
  aspect-ratio: 1 / 1; /* 絕對鎖死 1:1 正方形比例，拒絕橢圓 */
  border-radius: 50%; /* 將正方形削成完美的正圓形 */
  object-fit: cover; /* 確保圖案不變形，多餘的部分自動置中裁切 */
  background-color: #fff; /* 避免透明背景的 PNG 變成黑底 */
  display: block; /* 消除 img 標籤原生的底部微小空隙 */
  max-width: none !important; /* 避免 Leaflet 預設樣式覆寫 */
}

/* 下方的定位小箭頭 (用 CSS 三角形畫出) */
.custom-map-pin::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 10px solid var(--primary-color); /* 箭頭顏色跟隨外框主色 */
}

/*=================================*/
.section-about,
.about-content {
  margin-bottom: 5%;
}

@media (max-width: 1025px) {
  .section-about,
  .about-content {
    margin-bottom: 10%;
  }
}
@media (max-width: 576px) {
  .section-about,
  .about-content {
    margin-bottom: 10%;
  }
}
