/* 猛健樂 Lab - 主樣式表 - 現代化 SaaS 風格 */

/* 基礎設定 */
:root {
  --bg-primary: #F8FAFC;
  --bg-gradient-start: #E8F4F8;
  --bg-gradient-end: #FFFFFF;
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --accent: #6FB7E9;
  --accent-light: #60A5FA;
  --accent-lighter: #DBEAFE;
  --secondary: #CBD5E1;
  --border: #E2E8F0;
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --card-shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft JhengHei', 'PingFang TC', 'Noto Sans TC', sans-serif;
  line-height: 1.7;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  padding-top: 72px; /* 為固定 header 預留空間 */
}

/* 回到頂部按鈕 */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(111, 183, 233, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease-out;
  z-index: 100;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(111, 183, 233, 0.4);
}

.back-to-top:active {
  transform: translateY(0);
}

.back-to-top svg {
  width: 24px;
  height: 24px;
  stroke: white;
  stroke-width: 2;
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
  }
  
  .back-to-top svg {
    width: 20px;
    height: 20px;
  }
}

/* 固定 header 樣式 */
header.fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
}

/* 標題樣式 - 放大字級 */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2.75rem; /* 約 44px */
  margin-bottom: 1rem;
  font-weight: 800;
}

h2 {
  font-size: 2rem; /* 約 32px */
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

h3 {
  font-size: 1.5rem; /* 約 24px */
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

/* 副標題顏色變淡 */
.subtitle,
p.text-xl.opacity-80,
.text-secondary {
  color: var(--text-secondary);
  font-size: 1.125rem;
  line-height: 1.6;
}

/* 正文行高提高 */
p {
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* 連結樣式 */
a {
  color: var(--accent);
  transition: color 0.25s ease-out;
  text-decoration: none;
}

a:hover {
  color: var(--accent-light);
}

/* 卡片樣式 - 現代化設計 */
.card {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  /* 進場動畫初始狀態 */
  opacity: 0;
  transform: translateY(20px);
  animation: cardFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
  opacity: 0;
  transition: opacity 0.25s ease-out;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

.card:hover::before {
  opacity: 1;
}

/* 卡片進場動畫 */
@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 內容區塊 - 卡片式設計 */
.content-section {
  background: white;
  border-radius: 24px;
  padding: 3rem;
  margin: 3rem 0;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  /* 進場動畫 */
  opacity: 0;
  transform: translateY(20px);
  animation: cardFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* 按鈕樣式 */
.btn {
  display: inline-block;
  padding: 0.875rem 1.75rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  color: white;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(111, 183, 233, 0.3);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(111, 183, 233, 0.4);
}

.btn-secondary {
  background: white;
  color: var(--text-primary);
  border: 2px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  background: var(--accent-lighter);
  border-color: var(--accent);
}

/* 資料顯示樣式 */
.data-box {
  background: var(--accent-lighter);
  border-left: 4px solid var(--accent);
  padding: 1.5rem 2rem;
  margin: 2rem 0;
  border-radius: 12px;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
}

/* 風險提示框 */
.risk-alert {
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border-left: 4px solid #F59E0B;
  padding: 1.5rem 2rem;
  margin: 2rem 0;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.risk-alert strong {
  color: #92400E;
}

/* Breadcrumb - Gemini 風格按鈕 */
.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.breadcrumb a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: #F8FAFC;
  color: #475569;
  text-decoration: none;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.05),
    inset 0 1px 2px rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(226, 232, 240, 0.5);
}

.breadcrumb a::before {
  content: '←';
  font-size: 1rem;
  line-height: 1;
}

.breadcrumb a:hover {
  background: #F1F5F9;
  color: var(--accent);
  box-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 2px rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

.breadcrumb a:active {
  transform: translateY(0);
  box-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.05),
    inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.breadcrumb span {
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 0 0.5rem;
}

/* 搜尋框 */
.search-box {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-box input {
  width: 100%;
  padding: 1.25rem 1.25rem 1.25rem 3.5rem;
  border: 2px solid var(--border);
  border-radius: 16px;
  font-size: 1rem;
  transition: border-color 0.25s ease-out, 
              box-shadow 0.25s ease-out;
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(111, 183, 233, 0.2);
}

.search-box svg {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  opacity: 0.6;
}

/* 表格樣式 - 現代化卡片式 */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  margin: 2rem 0;
}

table thead {
  background: linear-gradient(135deg, var(--accent-lighter) 0%, #E0E7FF 100%);
}

table thead th {
  padding: 1.5rem 1.25rem;
  text-align: left;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
}

table thead th:first-child {
  border-top-left-radius: 20px;
}

table thead th:last-child {
  border-top-right-radius: 20px;
}

table tbody tr {
  transition: background-color 0.25s ease-out;
  border-bottom: 1px solid var(--border);
}

table tbody tr:last-child {
  border-bottom: none;
}

table tbody tr:hover {
  background-color: var(--accent-lighter);
}

table tbody td {
  padding: 1.5rem 1.25rem;
  color: var(--text-primary);
  border: none;
}

table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 20px;
}

table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 20px;
}

/* 強調色用於關鍵數據 */
.highlight,
.text-accent {
  color: var(--accent);
  font-weight: 600;
}

.text-accent-light {
  color: var(--accent-light);
}

/* 響應式調整 */
@media (max-width: 768px) {
  h1 {
    font-size: 2.25rem;
  }
  
  h2 {
    font-size: 1.75rem;
  }
  
  .content-section {
    padding: 2rem 1.5rem;
    border-radius: 20px;
    margin: 2rem 0;
  }
  
  .card {
    padding: 1.5rem;
    border-radius: 16px;
  }
  
  table {
    font-size: 0.9rem;
  }
  
  table thead th,
  table tbody td {
    padding: 1rem 0.75rem;
  }
}

/* 動畫 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* 漸層背景增強 */
.bg-gradient-to-br {
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
}

/* 容器間距 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* 卡片間距加大 */
.mb-8 {
  margin-bottom: 4rem;
}

/* 選擇建議卡片樣式 */
.recommendation-card {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--card-shadow);
  border-left: 4px solid var(--accent);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  /* 進場動畫 */
  opacity: 0;
  transform: translateY(20px);
  animation: cardFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.recommendation-card:nth-child(1) { animation-delay: 0.1s; }
.recommendation-card:nth-child(2) { animation-delay: 0.2s; }
.recommendation-card:nth-child(3) { animation-delay: 0.3s; }

.recommendation-card:hover {
  transform: translateX(4px) translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

/* 數據卡片樣式 */
.data-card {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  text-align: center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  /* 進場動畫 */
  opacity: 0;
  transform: translateY(20px);
  animation: cardFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.data-card:nth-child(1) { animation-delay: 0.1s; }
.data-card:nth-child(2) { animation-delay: 0.2s; }
.data-card:nth-child(3) { animation-delay: 0.3s; }

.data-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

/* Footer - 現代化 SaaS 風格（輕量版） */
.footer-modern {
  background: linear-gradient(180deg, #F5F8FC 0%, #E9EFF6 100%);
  color: #475569;
  margin-top: 4rem;
  position: relative;
  /* 與上方內容的過渡處理 */
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  /* 進場動畫 - 僅淡入 */
  opacity: 0;
  animation: footerFadeIn 0.25s ease-out forwards;
}

@keyframes footerFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.footer-modern .container {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

/* 上層：品牌介紹、資料來源、網站定位 */
.footer-upper {
  margin-bottom: 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
  }
}

/* 品牌介紹 */
.footer-brand {
  max-width: 100%;
}

.footer-brand-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.footer-brand-tagline {
  font-size: 0.875rem;
  line-height: 1.7;
  color: #64748B;
  margin: 0;
}

/* 區塊標題 */
.footer-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.75rem;
  letter-spacing: 0.01em;
}

/* 區塊內容 */
.footer-section {
  max-width: 100%;
}

.footer-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-list li {
  font-size: 0.85rem;
  line-height: 1.7;
  color: #64748B;
  margin-bottom: 0.4rem;
  padding-left: 1.25rem;
  position: relative;
}

.footer-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: #94A3B8;
}

.footer-text {
  font-size: 0.85rem;
  line-height: 1.7;
  color: #64748B;
  margin: 0;
}

.footer-text strong {
  color: #475569;
  font-weight: 600;
}

/* 下層：法律與醫療免責聲明（視覺弱化） */
.footer-lower {
  border-top: 1px solid rgba(226, 232, 240, 0.6);
  padding-top: 2rem;
  margin-top: 2rem;
}

/* 醫療免責聲明卡片 */
.footer-disclaimer-card {
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 18px;
  padding: 1.25rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  /* 僅淡入動畫 */
  opacity: 0;
  animation: disclaimerFadeIn 0.25s ease-out 0.05s forwards;
}

@keyframes disclaimerFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.footer-disclaimer-text {
  font-size: 0.75rem;
  line-height: 1.8;
  color: #94A3B8;
  margin: 0 0 0.6rem 0;
  text-align: center;
}

.footer-disclaimer-text:last-child {
  margin-bottom: 0;
}

.footer-disclaimer-emphasis {
  color: #64748B;
  font-weight: 500;
}

/* 版權資訊 */
.footer-copyright {
  text-align: center;
  padding-top: 1rem;
}

.footer-copyright p {
  font-size: 0.8rem;
  color: #94A3B8;
  margin: 0;
}

/* 響應式調整 */
@media (max-width: 768px) {
  .footer-modern .container {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }
  
  .footer-grid {
    gap: 2rem;
  }
  
  .footer-brand-name {
    font-size: 1.35rem;
  }
  
  .footer-disclaimer-card {
    padding: 1rem 1.25rem;
  }
  
  .footer-disclaimer-text {
    font-size: 0.7rem;
    text-align: left;
  }
}
