/* assets/css/modules.css */
/* 負責：功能性模組 (精選區塊、彈窗、地圖Popup、通知、PWA提示) */

/* --- 精選區塊 (Highlights) --- */
.highlight-section { 
  margin: 10px 0 14px; 
  padding: 14px; 
  border-radius: 16px; 
  background: #f0f9ff; 
  border: 1px solid var(--link-border); 
  transition: all 0.3s ease;
}

/* 標題區域設為可點擊 */
.highlight-header { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: 8px; 
  margin-bottom: 8px; 
  cursor: pointer; /* 讓使用者知道可以點 */
  user-select: none;
}

.highlight-title-main { 
  font-size: 16px; 
  font-weight: 700; 
  color: var(--ink); 
  display: flex;
  align-items: center;
}

.highlight-sub { 
  font-size: 13px; 
  color: var(--muted); 
  white-space: nowrap; 
  margin-top: 2px;
}

/* --- 折疊功能樣式 (New) --- */

/* 1. 當區塊被折疊時，隱藏列表 */
.highlight-section.collapsed .highlight-list {
    display: none;
}

/* 2. 當區塊被折疊時，減少下方 margin，讓版面更緊湊 */
.highlight-section.collapsed {
    padding-bottom: 14px; /* 保持原樣或微調 */
}

/* 3. 箭頭圖示動畫 */
.toggle-icon {
    transition: transform 0.3s ease;
    transform: rotate(180deg); /* 預設展開時，箭頭朝上 (或是表示可收起) */
    font-size: 14px;
    color: var(--muted);
}

/* 當折疊時，箭頭轉回朝下 */
.highlight-section.collapsed .toggle-icon {
    transform: rotate(0deg);
}

/* 4. 「點我展開」提示樣式 */
.click-hint {
    display: inline-block;
    font-size: 12px;
    color: #db2777;
    background: #fce7f3;
    padding: 2px 8px;
    border-radius: 99px;
    margin-left: 8px;
    vertical-align: middle;
    animation: pulse 1.5s infinite ease-in-out;
}

/* 當區塊已展開時，隱藏提示文字，保持清爽 */
.highlight-section:not(.collapsed) .click-hint {
    display: none;
}

/* 呼吸燈動畫 */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- 列表與卡片樣式 --- */
.highlight-list { 
  display: flex; 
  flex-wrap: nowrap; 
  gap: 10px; 
  overflow-x: auto; 
  padding-top: 6px; 
  scrollbar-width: none; 
  /* 增加淡入動畫 */
  animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.highlight-list::-webkit-scrollbar { display: none; }

.highlight-pill { 
  min-width: 200px; 
  max-width: 280px; 
  padding: 10px 12px; 
  border-radius: 12px; 
  border: 1px solid rgba(148, 163, 184, 0.35); 
  background: #ffffff; 
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04); 
  text-align: left; 
  cursor: pointer; 
  flex-shrink: 0; 
  transition: transform 0.15s ease, box-shadow 0.15s ease; 
}
.highlight-pill:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08); 
}

/* 文字流動排版 */
.hp-title { 
  font-size: 14px; 
  font-weight: 600; 
  color: var(--ink); 
  margin-bottom: 4px; 
  display: inline; 
  line-height: 1.5; 
}

.hp-meta { 
  font-size: 12px; 
  color: var(--muted); 
  display: flex; 
  flex-wrap: wrap; 
  align-items: center; 
  gap: 4px; 
  margin-top: 4px; 
}

/* 「今天」標籤 */
.hp-badge-today { 
  font-size: 10px; 
  font-weight: 600; 
  padding: 2px 6px; 
  border-radius: 99px; 
  background: #f97316; 
  color: #ffffff; 
  display: inline-block; 
  vertical-align: middle; 
  margin-left: 6px;
  white-space: nowrap; 
}

/* 卡片高亮動畫 (用於隨機推薦) */
.card-highlight-pulse { 
  animation: cardHighlightPulse 1.4s ease-out; 
}
@keyframes cardHighlightPulse { 
  0% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.35); } 
  70% { box-shadow: 0 0 0 10px rgba(20, 184, 166, 0); } 
  100% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0); } 
}

/* --- 系統公告列 (System Notice) --- */
#system-notice-bar { 
  background: #fffbeb; 
  color: #92400e; 
  border-bottom: 1px solid #fcd34d; 
  height: 40px; 
  display: flex; 
  align-items: center; 
  overflow: hidden; 
  white-space: nowrap; 
  position: relative; 
  font-size: 14px; 
}
#system-notice-bar.notice-hidden { display: none; }
.notice-icon { 
  position: absolute; 
  left: 0; 
  z-index: 2; 
  background: #fffbeb; 
  padding: 0 10px; 
  height: 100%; 
  display: flex; 
  align-items: center; 
  font-weight: bold; 
  box-shadow: 2px 0 5px rgba(0,0,0,0.05); 
}
#notice-content { 
  display: inline-block; 
  padding-left: 100%; 
  animation: marquee 15s linear infinite; 
  font-weight: 600; 
}
@keyframes marquee { 
  0% { transform: translateX(0); } 
  100% { transform: translateX(-100%); } 
}

/* --- 雙擊愛心動畫 --- */
.double-click-heart { 
    position: absolute; top: 50%; left: 50%; 
    transform: translate(-50%, -50%) scale(0); 
    font-size: 5rem; 
    color: #db2777;
    pointer-events: none; 
    animation: heart-pop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; 
    z-index: 10; 
    text-shadow: 0 4px 20px rgba(0,0,0,0.2); 
    opacity: 0;
}
@keyframes heart-pop { 
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; } 
    30% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; } 
    50% { transform: translate(-50%, -50%) scale(1.0); opacity: 1; } 
    100% { transform: translate(-50%, -120%) scale(1.5); opacity: 0; } 
}

/* --- 圖片燈箱 (Lightbox) --- */
#image-viewer-modal { 
  display: none; 
  position: fixed; 
  z-index: 30000; 
  padding-top: 50px; 
  left: 0; top: 0; 
  width: 100%; height: 100%; 
  overflow: auto; 
  background-color: rgba(0,0,0,0.9); 
  backdrop-filter: blur(5px); 
  justify-content: center; 
  align-items: center; 
}
#full-image { 
  margin: auto; 
  display: block; 
  max-width: 90%; 
  max-height: 90vh; 
  border-radius: 8px; 
  box-shadow: 0 0 20px rgba(0,0,0,0.5); 
  animation: zoom 0.3s; 
}
.close-modal { 
  position: absolute; 
  top: 20px; right: 30px; 
  color: #fff; 
  font-size: 40px; 
  cursor: pointer; 
  z-index: 30001; 
}
.clickable-image { cursor: zoom-in; }
@keyframes zoom { from {transform:scale(0)} to {transform:scale(1)} }

/* --- 地圖 Popup 樣式 (Leaflet Overrides) --- */
.leaflet-popup-content-wrapper { 
  border-radius: 12px; 
  padding: 0; 
  overflow: hidden; 
  box-shadow: 0 10px 25px rgba(0,0,0,0.15); 
}
.leaflet-popup-content { margin: 0; width: 260px !important; }
.map-card { display: flex; flex-direction: column; background: #fff; }
.map-card-img { width: 100%; height: 130px; object-fit: cover; display: block; }
.map-card-body { padding: 12px; }
.map-card-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; color: var(--ink); line-height: 1.4; }
.map-card-meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.map-card-btn { 
  display: block; text-align: center; 
  background: var(--brand); color: #fff; 
  padding: 8px; border-radius: 8px; 
  text-decoration: none; font-size: 13px; font-weight: 600; 
}

/* --- 通知 Toast --- */
.toast { 
  background: rgba(15, 23, 42, 0.9); 
  color: #fff; 
  padding: 10px 16px; 
  border-radius: 8px; 
  font-size: 14px; 
  box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
  animation: fadeInOut 3s forwards; 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  max-width: 80%; 
  margin: 0 auto; 
  backdrop-filter: blur(4px); 
}
@keyframes fadeInOut { 
  0% { opacity: 0; transform: translateY(20px); } 
  10% { opacity: 1; transform: translateY(0); } 
  90% { opacity: 1; transform: translateY(0); } 
  100% { opacity: 0; transform: translateY(-10px); } 
}

/* --- 自訂 Alert 彈窗 --- */
.custom-alert-overlay { 
  position: fixed; top: 0; left: 0; 
  width: 100%; height: 100%; 
  background: rgba(0,0,0,0.5); 
  z-index: 10000; 
  display: flex; align-items: center; justify-content: center; 
  opacity: 0; pointer-events: none; transition: 0.3s; 
}
.custom-alert-overlay.show { opacity: 1; pointer-events: auto; }
.custom-alert-box { 
  background: #fff; 
  width: 85%; max-width: 320px; 
  padding: 24px; border-radius: 16px; 
  text-align: center; 
  box-shadow: 0 10px 25px rgba(0,0,0,0.2); 
  transform: scale(0.8); transition: 0.3s; 
}
.custom-alert-overlay.show .custom-alert-box { transform: scale(1); }
.ca-btn { 
  background: var(--brand); color: #fff; 
  border: none; padding: 10px 24px; 
  border-radius: 99px; width: 100%; 
  margin-top: 16px; font-weight: 600; cursor: pointer; 
}

/* --- PWA 安裝提示條 (App Guide Bar) --- */
.app-guide-bar {
    position: fixed; bottom: 60px; left: 0; width: 100%;
    background: #fffbeb; color: #92400e; padding: 12px;
    text-align: center; font-size: 14px; z-index: 9999;
    border-top: 1px solid #fcd34d;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    display: flex !important; /* 強制顯示 */
    align-items: center; justify-content: center; gap: 8px;
    cursor: pointer;
    animation: slideUpBar 0.5s ease-out;
}
@keyframes slideUpBar { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* --- 通用彈窗 (Modal) --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 20000; }
.modal-content { 
  position: fixed; top: 50%; left: 50%; 
  transform: translate(-50%, -50%); 
  background: #fff; padding: 24px; 
  border-radius: 12px; width: 90%; max-width: 400px; 
  z-index: 20001; 
  box-shadow: 0 10px 25px rgba(0,0,0,0.2); 
}
.modal-hidden { display: none !important; }
.close-btn { 
  position: absolute; top: 10px; right: 10px; 
  background: none; border: none; 
  font-size: 24px; cursor: pointer; color: #64748b; 
}

/* --- 宣傳小卡 (Promo) --- */
/* 合作 / 宣傳：一列四欄（桌機）＋固定高度（手機改橫向滑動） */
.promo-grid{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
  margin-bottom: 10px;
}

@media (max-width: 980px){
  .promo-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px){
  .promo-grid{
    display: flex;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }
  .promo-grid::-webkit-scrollbar{ height: 6px; }
  .promo-tile{ flex: 0 0 82%; }
}

.promo-tile{
  display: flex;
  align-items: center;
  gap: 12px;
  height: 90px;
  text-decoration: none;
  border-radius: 14px;
  padding: 14px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 12px #0206170d;
  transition: transform .2s ease, box-shadow .2s ease;
  overflow: hidden;

  background-size: cover;
  background-position: center;
  background-image: linear-gradient(#00000080, #00000080), url(https://i.meee.com.tw/6cI1hr0.jpg);
}

.promo-tile:hover{ transform: translateY(-2px); box-shadow: 0 8px 20px #02061714; }

/* 各卡背景（注意：本檔案在 assets/css/，本地圖片要用 ../img/） */
.promo-tile.promo-backpacker{
  background-image: linear-gradient(#00000080, #00000080), url(https://i.meee.com.tw/6cI1hr0.jpg);
}
.promo-tile.promo-puffer-tile{
  background-image: linear-gradient(#00000080, #00000080), url(../img/qmpuffer_banner_1200x630.jpg);
}
.promo-tile.promo-eel{
  background-image: linear-gradient(#00000080, #00000080), url(../img/yunlin_eel_kids_popup.jpg);
}
.promo-tile.promo-farm{
  background-image: linear-gradient(#00000080, #00000080), url(../img/chihchiafarm.jpg);
}

/* 讓固定高度版更好讀 */
.promo-grid .promo-text{ min-width: 0; font-size: 15px; font-weight: 700; }
.promo-grid .promo-text small{ font-size: 12px; }
.promo-grid .promo-text,
.promo-grid .promo-text small{
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.promo-tile .promo-avatar{ width: 52px; height: 52px; }

.promo-avatar { 
  width: 60px; height: 60px; 
  border-radius: 999px; object-fit: cover; 
  border: 2px solid rgba(255, 255, 255, .8); flex-shrink: 0; 
}
.promo-text { 
  font-size: 16px; font-weight: 600; color: #fff; 
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5); 
}
.promo-text small { display: block; font-size: 13px; font-weight: 400; color: #ffffffe6; }

.site-promo-float { 
  position: fixed; z-index: 99999; 
  left: 16px; bottom: 180px; 
  width: min(360px, 32vw); max-width: 60vw; 
  background: var(--panel); 
  border-radius: 18px; 
  border: 1px solid rgba(15, 23, 42, 0.08); 
  box-shadow: var(--shadow); 
  padding: 12px 8px 8px; box-sizing: border-box; 
  display: flex; flex-direction: column; 
  align-items: center; justify-content: center; gap: 8px; 
}
.site-promo-link { display: block; width: 100%; }
.site-promo-img { display: block; width: 100%; height: auto; border-radius: 14px; }
.site-promo-close { 
  position: absolute; top: -8px; right: -8px; 
  border: none; border-radius: 999px; 
  width: 24px; height: 24px; 
  font-size: 16px; line-height: 24px; 
  cursor: pointer; 
  background: rgba(15, 23, 42, 0.85); color: #f9fafb; 
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.35); 
  display: flex; align-items: center; justify-content: center; 
  z-index: 10; 
}

.site-promo-actions{
  display: flex;
  gap: 8px;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}
.site-promo-action{
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  padding: 8px 10px;
  flex: 1;
  text-align: center;
}
.site-promo-toggle{
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  border-radius: 999px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  flex: 1;
}
.site-promo-more{
  width: 100%;
  margin-top: 6px;
  display: none;
}


/* --- 載入狀態 (Skeleton & Empty) --- */
#empty-state { 
  display: none; 
  padding: 40px 20px; 
  border: 2px dashed #cbd5e1; 
  border-radius: 16px; 
  background: #fff; 
  color: #64748b; 
  text-align: center; 
}
.skeleton-card { min-height: 160px; pointer-events: none; display: block; }
.skeleton-line { 
  height: 16px; background: #e2e8f0; 
  border-radius: 4px; margin-bottom: 10px; width: 100%; 
  animation: shimmer 1.5s infinite linear; 
  background-image: linear-gradient(to right, #e2e8f0 0%, #f1f5f9 20%, #e2e8f0 40%, #e2e8f0 100%); 
  background-size: 1000px 100%; 
}
@keyframes shimmer { 0% { background-position: -1000px 0; } 100% { background-position: 1000px 0; } }

/* --- 主題切換器 (Theme Switcher) --- */
.theme-switcher { 
  position: absolute; top: 18px; right: 12px; 
  display: flex; align-items: center; z-index: 10; 
}
.theme-label { font-size: 12px; margin-right: 4px; color: var(--ink); }
.theme-select { 
  font-size: 12px; padding: 2px 4px; 
  border-radius: 6px; 
  border: 1px solid #d1d5db; 
  background: var(--panel); 
  color: var(--ink); 
  cursor: pointer; 
}

/* --- 表單區塊 (Form Section) --- */
.form-section { 
  background: var(--panel); 
  border: 1px solid #e5e7eb; 
  border-radius: 14px; 
  padding: 20px 24px; 
  margin-top: 20px; 
  box-shadow: var(--shadow); 
}
.form-group input { 
  width: 100%; padding: 10px 12px; 
  font-size: 15px; 
  border: 1px solid #d1d5db; 
  border-radius: 8px; 
  box-sizing: border-box; 
}
.submit-btn { 
  background: var(--brand); color: #fff; 
  border: none; border-radius: 999px; 
  padding: 10px 18px; 
  font-size: 14px; font-weight: 600; 
  cursor: pointer; 
  box-shadow: 0 10px 24px #14b8a647; 
  display: block; margin: 0 auto; 
}

/* --- Dark Mode 模組調整 --- */
html[data-theme="dark"] .highlight-section { background: #020617; border-color: #1e293b; }
html[data-theme="dark"] .highlight-pill { background: #0f172a; border-color: #1e293b; }
html[data-theme="dark"] .form-group input { background: #334155; color: var(--ink); border-color: #475569; }
html[data-theme="dark"] .form-section { background: var(--panel-card); border-color: #334155; }
html[data-theme="dark"] .site-promo-float { background: var(--panel); border-color: #334155; }
html[data-theme="dark"] .custom-alert-box { background: #1e293b; color: #f1f5f9; }
html[data-theme="dark"] .app-guide-bar { background: #451a03; color: #fcd34d; border-top-color: #78350f; }
html[data-theme="dark"] .toggle-icon { color: #94a3b8; }
html[data-theme="dark"] .click-hint { background: #831843; color: #fbcfe8; }
/* 讓「雲林三寶鰻 / 自家莊園」圓圈頭像偏左，避免遮住背景人物 */
.promo-tile.promo-eel,
.promo-tile.promo-farm{
  overflow: visible; /* 允許頭像稍微跑出卡片邊界 */
  background-position: left center; /* 左側人物優先顯示 */
}
.promo-tile.promo-eel .promo-avatar{
  object-position: 20% 50%;  /* 越小越偏左：0% = 最左 */
}
.promo-tile.promo-farm .promo-avatar{
  object-position: 15% 50%;
}
@media (max-width: 560px){
  .promo-tile.promo-eel .promo-avatar,
  .promo-tile.promo-farm .promo-avatar{
    transform: translateX(-12px);
  }
}
}
