/* assets/css/layout.css */
/* 負責：頁面結構、Header、Footer、Grid 網格系統、底部導航 */

/* --- 通用容器 --- */
.wrap { 
  position: relative; 
  max-width: 1200px; 
  margin: 0 auto; 
  padding: 20px 16px 40px; 
  width: 100%; 
  box-sizing: border-box; 
  flex: 1; 
}

/* --- 頂部搜尋列 (Header) --- */
.sticky-header { 
  position: -webkit-sticky; 
  position: sticky; 
  top: 0; 
  z-index: 100; 
  background: rgba(248, 250, 252, 0.98); 
  backdrop-filter: blur(12px); 
  -webkit-backdrop-filter: blur(12px);
  padding: 12px 0; 
  margin: 0 -12px; 
  padding-left: 12px; 
  padding-right: 12px; 
  border-bottom: 1px solid var(--border); 
  transition: all 0.3s ease; 
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.header-content { 
  display: block; 
} 

.search-row { 
  display: flex; 
  gap: 8px; 
  align-items: center; 
  margin-bottom: 10px; 
  width: 100%; 
}

.tools-row { 
  display: flex; 
  gap: 8px; 
  justify-content: space-between; 
}

/* Header 響應式佈局 (平板/桌機) */
@media (min-width: 768px) {
    .header-content { 
      display: flex; 
      align-items: center; 
      gap: 16px; 
      justify-content: space-between; 
    }
    .search-row { 
      margin-bottom: 0; 
      flex: 1; 
    }
    .tools-row { 
      flex: 0 0 auto; 
      gap: 12px; 
    }
}

/* --- 主要內容網格 (Grid) --- */
.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); 
    gap: 24px; 
    padding-bottom: 20px; 
}

@media (max-width: 700px) {
    .grid { 
      grid-template-columns: 1fr; 
      gap: 16px; 
    }
}

/* --- 底部導航 (Mobile Nav) - 美化版 --- */
.bottom-nav { 
  position: fixed; 
  bottom: 0; 
  left: 0; 
  width: 100%; 
  height: 65px; /* 稍微增高 */
  background: rgba(255, 255, 255, 0.95); 
  backdrop-filter: blur(12px); 
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(226, 232, 240, 0.8); 
  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.04); 
}

/* 導航按鈕樣式 */
.bottom-nav-btn { 
  background: transparent; 
  border: none; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  gap: 4px; 
  color: #94a3b8; 
  cursor: pointer; 
  flex: 1; 
  height: 100%; 
  padding: 4px 0 0 0; 
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); 
  position: relative;
}

/* 圖示樣式 */
.bottom-nav-btn .nav-icon { 
  font-size: 24px; 
  line-height: 1;
  filter: grayscale(100%); 
  opacity: 0.7;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s, opacity 0.2s; 
  margin-bottom: 0; 
}

/* 文字標籤樣式 */
.bottom-nav-btn .nav-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* 激活狀態 (Active) */
.bottom-nav-btn.active { 
  color: var(--brand); 
}

.bottom-nav-btn.active .nav-icon { 
  filter: grayscale(0%); 
  opacity: 1;
  transform: translateY(-2px) scale(1.15); 
}

.bottom-nav-btn.active .nav-label {
  font-weight: 700;
}

/* 點擊回饋 (Ripple/Scale) */
.bottom-nav-btn:active .nav-icon {
  transform: scale(0.9);
}

/* --- 頁尾 (Footer) --- */
.site-footer { 
  background: #1e293b; 
  color: #94a3b8; 
  padding: 40px 20px; 
  margin-top: auto; 
  text-align: center; 
}

.footer-logo { 
  font-size: 18px; 
  font-weight: 700; 
  color: #f8fafc; 
  margin-bottom: 8px; 
}

.footer-links a { 
  color: #cbd5e1; 
  text-decoration: none; 
  margin: 0 8px; 
  font-size: 14px; 
}

/* --- Dark Mode 佈局調整 --- */
html[data-theme="dark"] .sticky-header { 
  background: rgba(15, 23, 42, 0.95); 
  border-color: #334155; 
}

html[data-theme="dark"] .bottom-nav { 
  background: rgba(15, 23, 42, 0.90); 
  border-top-color: #334155; 
}

html[data-theme="dark"] .bottom-nav-btn {
  color: #64748b;
}

html[data-theme="dark"] .bottom-nav-btn.active {
  color: #2dd4bf; /* 深色模式下用亮一點的 Teal */
}