/* =========================================
   layout.css - 布局样式
   Header / Tab栏 / 主内容区
   ========================================= */

/* ---------- App容器 ---------- */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Header ---------- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-4);
  padding-top: calc(var(--safe-top) + var(--space-4));
  background: linear-gradient(to bottom, var(--bg-primary) 0%, transparent 100%);
  /* 渐变遮罩让状态栏区域也覆盖 */
}

.header-inner {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.header-title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.1em;
}

.header-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.2em;
  margin-top: var(--space-1);
}

/* ---------- 主内容区 ---------- */
.main {
  flex: 1;
  padding: calc(var(--space-4) + 40px + var(--safe-top)) var(--space-4) calc(70px + var(--safe-bottom)) var(--space-4);
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- 页面容器 ---------- */
.page {
  display: none;
  animation: fadeIn var(--transition-base);
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- 底部Tab栏 ---------- */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--tab-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--tab-border);
  padding-bottom: var(--safe-bottom);
}

.tab-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 56px;
  max-width: 600px;
  margin: 0 auto;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2);
  color: var(--tab-inactive);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
}

.tab-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--tab-active);
  border-radius: var(--radius-full);
  transition: width var(--transition-fast);
}

.tab-item.active {
  color: var(--tab-active);
}

.tab-item.active::before {
  width: 24px;
}

.tab-icon {
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  transition: all 0.25s ease;
}

.tab-item.active .tab-icon {
  filter: drop-shadow(0 2px 8px currentColor);
}

.tab-label {
  font-size: var(--text-xs);
  font-weight: 500;
  margin-top: 2px;
}

/* ---------- 安全区域占位 ---------- */
.safe-area-bottom {
  height: var(--safe-bottom);
}

/* ---------- 沉浸式状态栏处理 ---------- */
@supports (padding-top: env(safe-area-inset-top)) {
  .header {
    padding-top: calc(env(safe-area-inset-top) + var(--space-4));
  }
  
  .main {
    padding-top: calc(var(--space-4) + 40px + env(safe-area-inset-top));
  }
}

/* ---------- 手机适配（375px基准） ---------- */
@media (max-width: 375px) {
  .header-title {
    font-size: var(--text-base);
  }
  
  .tab-label {
    font-size: 0.65rem;
  }
  
  .tab-icon {
    font-size: 1.1rem;
  }
}

/* ---------- 平板横屏 ---------- */
@media (min-width: 768px) and (orientation: landscape) {
  .main {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }
}

/* ---------- 底部备案信息（每一页底部都能看到） ---------- */
.footer-icp {
  text-align: center;
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: var(--text-xs);
}

.footer-icp a {
  color: var(--text-muted);
  text-decoration: none;
  display: inline-block;
}

.footer-icp a:hover {
  color: var(--accent);
}
