/* 1. 基礎設定：消除邊距，設定背景色 */
body, html {
  margin: 0;
  padding: 0;
  font-family: "Helvetica Neue", Arial, sans-serif;
  background-color: #f4f6fa;
  color: #333;
  
  /* 👇 就是這兩行魔法！鎖死水平方向，禁止超出邊界拉扯 👇 */
  overflow-x: hidden;
  overscroll-behavior-x: none; 
}

/* 2. APP 總容器：鎖定全螢幕，讓中間可以獨立滑動 */
.app-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 500px;
  margin: 0 auto;
  background-color: #f4f6fa;
  box-shadow: 0 0 20px rgba(0,0,0,0.1);
  
  /* 👇 加上這行，把翻頁動畫完美藏在框框內 👇 */
  overflow-x: hidden; 
}

/* 3. 頂部漸層標題：藍紫漸層，無縫接軌 */
.gradient-header {
  /* 參考截圖的左紫右青漸層 */
  background: linear-gradient(135deg, #6b66fa 0%, #0cbaba 100%);
  color: white;
  padding: 30px 25px 50px 25px; /* 下方多留一點空間給卡片覆蓋 */
}

.gradient-header h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 1px;
}

.gradient-header p {
  margin: 8px 0 0 0;
  font-size: 14px;
  opacity: 0.85;
}

/* 4. 中間內容區：自動佔滿剩餘空間，支援滑動 */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px;
  margin-top: -20px; /* 讓內容稍微往上推，製造覆蓋在漸層上的層次感 */
  z-index: 10;
}

/* 5. 底部導覽列：固定在最下方，白色背景帶點陰影 */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  background-color: white;
  padding: 10px 0 15px 0;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  border-radius: 20px 20px 0 0; /* 頂部微微圓角 */
  z-index: 20;
}

.nav-item {
  text-align: center;
  color: #999;
  font-size: 12px;
  cursor: pointer;
}

.nav-item .icon {
  font-size: 22px;
  margin-bottom: 2px;
}

/* 導覽列作用中的狀態 (藍色字體) */
.nav-item.active {
  color: #2f80ed;
}

/* 6. 懸浮新增按鈕 (FAB)：固定在右下角，超搶眼的藍色漸層圓形 */
.fab {
  position: absolute;
  bottom: 80px; /* 避開底部導覽列 */
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4481eb 0%, #04befe 100%);
  color: white;
  font-size: 32px;
  border: none;
  box-shadow: 0 6px 15px rgba(4, 190, 254, 0.4);
  cursor: pointer;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab:active {
  transform: scale(0.95); /* 按下時稍微縮小的互動感 */
}
/* 7. 彈出視窗 (Modal) 與現代化輸入框設計 */
.modal-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); /* 半透明黑底遮罩 */
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
}

.modal-content {
  background: white; width: 85%; padding: 25px;
  border-radius: 20px; box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.modern-input {
  width: 100%; padding: 12px; margin-bottom: 15px; margin-top: 5px;
  border: 1px solid #ddd; border-radius: 10px;
  box-sizing: border-box; background-color: #f9f9f9;
  font-size: 16px;
}

.btn-cancel {
  flex: 1; padding: 12px; border: none; border-radius: 10px;
  background-color: #f0f0f0; color: #555; font-weight: bold; cursor: pointer; font-size: 16px;
}

.btn-save {
  flex: 1; padding: 12px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, #4481eb 0%, #04befe 100%); /* 呼應加號按鈕的漸層 */
  color: white; font-weight: bold; cursor: pointer; font-size: 16px;
}
/* 8. 紀錄頁面：統計摘要與彩色數據卡片 */
.stats-summary {
  background: white; 
  padding: 15px; 
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
  margin-bottom: 20px;
  display: flex; 
  justify-content: space-around;
  position: relative; /* 配合往上提的立體感 */
}

.stat-box {
  text-align: center;
}

.stat-label {
  font-size: 12px; 
  color: #888; 
  margin-bottom: 5px;
}

.stat-value {
  font-size: 20px; 
  font-weight: bold; 
}

.record-card {
  background: white; 
  border-radius: 15px; 
  padding: 15px;
  margin-bottom: 15px; 
  box-shadow: 0 4px 10px rgba(0,0,0,0.03);
  border-left: 6px solid #0cbaba; /* 左側水藍色粗線條，增加設計感 */
}

.record-header {
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  border-bottom: 1px dashed #eee; 
  padding-bottom: 10px; 
  margin-bottom: 10px;
}

.record-date {
  font-weight: bold; 
  color: #333; 
  font-size: 16px;
}

/* 最低體重的專屬小皇冠標籤 */
.record-badge {
  background: #ffebee; 
  color: #e53935; 
  font-size: 12px;
  padding: 4px 10px; 
  border-radius: 12px; 
  font-weight: bold;
}

.record-data-grid {
  display: grid; 
  grid-template-columns: 1fr 1fr; /* 切成左右兩格 */
  gap: 10px;
}

.data-item {
  background: #f8f9fa; 
  padding: 10px; 
  border-radius: 10px; 
  font-size: 14px;
  color: #666;
}

.data-item span {
  font-weight: bold;
  font-size: 16px;
}

/* 用不同顏色區分不同數值 */
.color-weight { color: #0cbaba; } /* 體重用水藍色 */
.color-sugar { color: #ff5252; }  /* 血糖用紅色 */
/* --- 9. 翻頁轉場動畫 (Swipe Animation) --- */
@keyframes slideInFromRight {
  0% { transform: translateX(40px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes slideInFromLeft {
  0% { transform: translateX(-40px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

/* 手指向左滑 (往右翻頁)：畫面從右邊進來 */
.swipe-left {
  animation: slideInFromRight 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* 手指向右滑 (往左翻頁)：畫面從左邊進來 */
.swipe-right {
  animation: slideInFromLeft 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}
/* 圖表時間範圍按鈕 */
.range-btn {
  border: 1px solid #d5dcf0;
  background: #f4f6fa;
  color: #4481eb;
  border-radius: 14px;
  padding: 4px 14px;
  font-size: 13px;
  cursor: pointer;
}
.range-btn:active { background: #e3e9fb; }
