/* 数智课堂 PWA 移动端样式 */

/* ===== 移动端底部导航栏 ===== */
.pwa-bottom-nav {
  display: none; /* 默认隐藏，移动端显示 */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1050;
  background: #fff;
  border-top: 1px solid #e9ecef;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom); /* iPhone 底部安全区 */
}

.pwa-bottom-nav .nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 56px;
}

.pwa-bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #6c757d;
  font-size: 10px;
  line-height: 1.2;
  padding: 4px 8px;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

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

.pwa-bottom-nav .nav-item.active {
  color: #3498db;
}

.pwa-bottom-nav .nav-item:active {
  color: #2980b9;
  transform: scale(0.95);
}

/* ===== 移动端适配 ===== */
@media (max-width: 767.98px) {
  /* 显示底部导航 */
  .pwa-bottom-nav {
    display: block;
  }

  /* 页面底部留出导航栏空间 */
  body {
    padding-bottom: 70px !important;
  }

  /* 优化容器边距 */
  .container, .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* 卡片优化 */
  .card {
    margin-bottom: 12px;
    border-radius: 10px;
  }

  .card-body {
    padding: 12px;
  }

  /* 表格卡片式布局 */
  .table-mobile-cards thead {
    display: none;
  }

  .table-mobile-cards tbody tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 12px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  }

  .table-mobile-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border: none;
    border-bottom: 1px solid #f8f9fa;
    font-size: 14px;
  }

  .table-mobile-cards tbody td:last-child {
    border-bottom: none;
  }

  .table-mobile-cards tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6c757d;
    margin-right: 12px;
    white-space: nowrap;
    min-width: 70px;
  }

  /* 按钮优化 */
  .btn {
    min-height: 44px; /* iOS 推荐最小触摸目标 */
  }

  /* 表单输入框优化 */
  .form-control, .form-select {
    font-size: 16px; /* 避免 iOS 自动缩放 */
  }

  /* 标题字号调整 */
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.15rem; }
  h4 { font-size: 1.05rem; }

  /* ECharts 图表高度适配 */
  [id*="chart"], [class*="chart-box"] {
    height: 280px !important;
  }
}

/* ===== PWA 安装引导横幅 ===== */
.pwa-install-banner {
  display: none;
  position: fixed;
  bottom: 70px;
  left: 12px;
  right: 12px;
  z-index: 1060;
  background: linear-gradient(135deg, #3498db, #2c3e50);
  color: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  animation: slideUp 0.3s ease-out;
}

.pwa-install-banner.show {
  display: block;
}

.pwa-install-banner .banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pwa-install-banner .banner-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  flex-shrink: 0;
}

.pwa-install-banner .banner-text h6 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}

.pwa-install-banner .banner-text p {
  margin: 0;
  font-size: 12px;
  opacity: 0.85;
}

.pwa-install-banner .banner-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.pwa-install-banner .btn-install {
  background: #fff;
  color: #3498db;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
}

.pwa-install-banner .btn-dismiss {
  background: transparent;
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
}

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

/* ===== 离线状态提示 ===== */
.pwa-offline-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #e74c3c;
  color: #fff;
  text-align: center;
  padding: 8px;
  font-size: 13px;
}

.pwa-offline-bar.show {
  display: block;
}
