/* assets/css/layout.css */
/* 負責：頁面結構、Header、Footer、Grid 網格系統、底部導航 */
/* 高端化升級：增加呼吸空間、精緻的毛玻璃特效 (Glassmorphism)、極簡俐落排版 */

/* --- 通用容器 --- */
.wrap { 
  position: relative; 
  max-width: 1240px; /* 加寬一點讓視覺更舒展 */
  margin: 0 auto; 
  padding: 24px 20px 60px; 
  width: 100%; 
  box-sizing: border-box; 
  flex: 1; 
}

/* --- 頂部搜尋列 (Header) - 頂級毛玻璃效果 --- */
.sticky-header { 
  position: -webkit-sticky; 
  position: sticky; 
  top: 0; 
  z-index: 100; 
  background: rgba(253, 253, 253, 0.85); 
  backdrop-filter: saturate(180%) blur(20px); 
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding: 16px 0; 
  margin: 0 -20px; 
  padding-left: 20px; 
  padding-right: 20px; 
  border-bottom: 1px solid rgba(0, 0, 0, 0.04); 
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); 
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.header-content { 
  display: block; 
} 

.search-row { 
  display: flex; 
  gap: 10px; 
  align-items: center; 
  margin-bottom: 12px; 
  width: 100%; 
}

.tools-row { 
  display: flex; 
  gap: 10px; 
  justify-content: space-between; 
}

/* Header 響應式佈局 (平板/桌機) */
@media (min-width: 768px) {
    .header-content { 
      display: flex; 
      align-items: center; 
      gap: 20px; 
      justify-content: space-between; 
    }
    .search-row { 
      margin-bottom: 0; 
      flex: 1; 
    }
    .tools-row { 
      flex: 0 0 auto; 
      gap: 16px; 
    }
}

/* --- 主要內容網格 (Grid) --- */
.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); 
    gap: 32px; /* 增加卡片間距，提升呼吸感 */
    padding-bottom: 40px; 
}

@media (max-width: 700px) {
    .grid { 
      grid-template-columns: 1fr; 
      gap: 24px; 
    }
}

/* --- 底部導航 (Mobile Nav) - 質感升級 --- */
.bottom-nav { 
  position: fixed; 
  bottom: 0; 
  left: 0; 
  width: 100%; 
  height: 72px; /* 稍微增高提升點擊手感 */
  background: rgba(253, 253, 253, 0.85); 
  backdrop-filter: saturate(180%) blur(20px); 
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.04); 
  display: flex; 
  justify-content: space-around; 
  align-items: stretch; 
  padding-bottom: env(safe-area-inset-bottom); 
  z-index: 10000; 
  box-shadow: 0 -4px 20px rgba(0,0,0,0.02); 
}

/* 導航按鈕樣式 */
.bottom-nav-btn { 
  background: transparent; 
  border: none; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  gap: 6px; 
  color: var(--muted); 
  cursor: pointer; 
  flex: 1; 
  height: 100%; 
  padding: 4px 0 0 0; 
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); 
  position: relative;
}

/* 圖示樣式 */
.bottom-nav-btn .nav-icon { 
  font-size: 22px; 
  line-height: 1;
  filter: grayscale(100%); 
  opacity: 0.6;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s, opacity 0.3s; 
  margin-bottom: 0; 
}

/* 文字標籤樣式 */
.bottom-nav-btn .nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.8;
  transition: opacity 0.3s;
}

/* 激活狀態 (Active) */
.bottom-nav-btn.active { 
  color: var(--brand); 
}

.bottom-nav-btn.active .nav-icon { 
  filter: grayscale(0%); 
  opacity: 1;
  transform: translateY(-3px) scale(1.15); 
}

.bottom-nav-btn.active .nav-label {
  font-weight: 700;
  opacity: 1;
}

/* 點擊回饋 (Ripple/Scale) */
.bottom-nav-btn:active .nav-icon {
  transform: scale(0.9);
}

/* --- 頁尾 (Footer) --- */
.site-footer { 
  background: var(--bg); /* 改為與背景融合的極簡風格 */
  color: var(--muted); 
  padding: 60px 20px 40px; 
  margin-top: auto; 
  text-align: center; 
  border-top: 1px solid var(--border);
}

.footer-logo { 
  font-size: 20px; 
  font-weight: 800; 
  color: var(--ink); 
  margin-bottom: 12px; 
  letter-spacing: 1px;
}

.footer-links {
  margin-bottom: 20px;
}

.footer-links a { 
  color: var(--muted); 
  text-decoration: none; 
  margin: 0 12px; 
  font-size: 14px; 
  font-weight: 500;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: var(--brand);
}

/* --- Dark Mode 佈局調整 --- */
html[data-theme="dark"] .sticky-header { 
  background: rgba(11, 17, 32, 0.75); 
  border-bottom-color: var(--border); 
}

html[data-theme="dark"] .bottom-nav { 
  background: rgba(11, 17, 32, 0.75); 
  border-top-color: var(--border); 
}

html[data-theme="dark"] .bottom-nav-btn {
  color: var(--muted);
}

html[data-theme="dark"] .bottom-nav-btn.active {
  color: var(--brand); /* 對應到深色模式的亮眼青色 */
}

html[data-theme="dark"] .site-footer {
  background: var(--bg);
  border-top-color: var(--border);
}

html[data-theme="dark"] .footer-logo {
  color: var(--ink);
}