/* ==========================================
   A.Y.百宝箱 PWA 移动端样式
   Safe Area + 底部导航 + 触摸优化
   ========================================== */

/* ---------- Safe Area 适配 ---------- */
:root {
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

body {
  padding-top: var(--safe-top);
  padding-bottom: calc(60px + var(--safe-bottom));
  -webkit-tap-highlight-color: transparent;
  -webkit-overflow-scrolling: touch;
}

/* ---------- 底部 TabBar ---------- */
.pwa-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(60px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: #ffffff;
  border-top: 1px solid #f0e0cc;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 -2px 12px rgba(245, 124, 0, 0.08);
}

.pwa-tabbar .tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  text-decoration: none;
  color: #bcaaa4;
  font-size: 10px;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.pwa-tabbar .tab-item.active {
  color: #f57c00;
}

.pwa-tabbar .tab-item .tab-icon {
  font-size: 22px;
  margin-bottom: 2px;
}

/* ---------- 触摸优化 ---------- */
@media (max-width: 768px) {
  /* 确保触摸目标 ≥ 44px */
  button, .btn, [role="button"], .option-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 16px;
    cursor: pointer;
  }

  /* 链接间距防误触 */
  a + a, button + button {
    margin-left: 8px;
  }

  /* 输入框优化 */
  input, textarea, select {
    font-size: 16px; /* 防止 iOS 缩放 */
    padding: 10px;
  }
}

/* ---------- 下拉刷新视觉 ---------- */
.pwa-pull-indicator {
  text-align: center;
  padding: 12px;
  color: #bcaaa4;
  font-size: 13px;
  display: none;
}

.pwa-pull-indicator.pulling {
  display: block;
  animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ---------- 仅在 PWA 模式下显示 ---------- */
@media (display-mode: browser) {
  .pwa-tabbar {
    display: none;
  }
  body {
    padding-bottom: 0;
  }
}
