/* ============================================================
   responsive.css - CAIE Web Pages 全局响应式样式
   断点：768px (tablet/mobile), 480px (small mobile)
   原则：PC 端完全不受影响，所有样式在 @media 内
   ============================================================ */

/* ------ 移动端 Sidebar Toggle 按钮（PC 端隐藏） ------ */
.sidebar-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: #f0f5ff;
  border: 1px solid #d6e4ff;
  border-radius: 8px;
  color: #0052d9;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 16px;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-toggle-btn:active {
  background: #d6e4ff;
}

/* ------ 汉堡菜单按钮（PC 端隐藏） ------ */
.hamburger-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
  -webkit-tap-highlight-color: transparent;
}
.hamburger-btn span {
  width: 24px;
  height: 2px;
  background: #333;
  border-radius: 2px;
  transition: all 0.3s ease;
}
.hamburger-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.hamburger-btn.active span:nth-child(2) {
  opacity: 0;
}
.hamburger-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ------ 移动端导航覆盖层（PC 端隐藏） ------ */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.mobile-nav-overlay.active {
  display: block;
  opacity: 1;
}
.mobile-nav {
  background: #1a3d72;
  padding: 80px 24px 24px;
  display: flex;
  flex-direction: column;
  max-width: 280px;
  height: 100%;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}
.mobile-nav-overlay.active .mobile-nav {
  transform: translateX(0);
}
.mobile-nav a {
  color: #fff;
  font-size: 16px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav a:active {
  opacity: 0.7;
}

/* ============================================================
   768px 断点 - Tablet / Mobile
   ============================================================ */
@media (max-width: 768px) {

  /* === 全局溢出控制 === */
  html {
    overflow-x: hidden !important;
  }
  body {
    overflow-x: hidden !important;
    padding-top: 50px !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* === 强制覆盖 CDN PC CSS 所有固定宽度容器 === */
  .center,
  .logo-login .center,
  .border_bot .center,
  .footer_main,
  .summary {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0 16px !important;
    box-sizing: border-box !important;
  }

  /* === Header 移动端适配 === */
  .border_bot {
    width: 100% !important;
    max-width: 100% !important;
  }
  .logo-login {
    width: 100% !important;
    max-width: 100% !important;
    height: 50px !important;
  }
  .logo-login .content-box {
    width: 100% !important;
    max-width: 100% !important;
  }
  /* Logo 缩小（只针对大尺寸 logo，不影响 40px 头像） */
  .logo-login .content-box img[style*="width:273px"],
  .logo-login .content-box img[style*="width: 273px"],
  .logo-login .content-box .left-logo-wrap img,
  .logo-login .content-box .newLogo {
    width: 140px !important;
    height: auto !important;
  }
  /* 头像保持原始小尺寸 */
  .logo-login .content-box img[style*="border-radius"] {
    width: 32px !important;
    height: 32px !important;
  }

  /* --- PC 导航栏隐藏 --- */
  .border_bot .opcity-bg {
    display: none !important;
  }
  .hamburger-btn {
    display: flex;
  }

  /* === Sidebar 布局改造 (C类页面) === */
  .personal_p {
    flex-direction: column !important;
    padding: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .myCenter-L {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    display: none !important;
    margin-bottom: 16px;
  }
  .myCenter-R {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    float: none !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }
  .sidebar-toggle-btn {
    display: none !important;
  }

  /* 移动端返回栏（JS 动态注入） */
  .mobile-back-bar {
    display: flex;
    align-items: center;
    padding: 12px 0;
    margin-bottom: 12px;
  }
  .mobile-back-bar a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #0052d9;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-back-bar a:active {
    opacity: 0.7;
  }

  /* === 居中内容容器 (B类页面) === */
  .page-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px !important;
    box-sizing: border-box !important;
  }

  /* === 底部固定栏 === */
  .bottom-bar {
    width: 100% !important;
    padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
  }
  .bottom-bar .inner {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 16px !important;
    box-sizing: border-box !important;
  }

  /* === 表单响应式 === */
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }
  .form-card {
    padding: 16px !important;
    border-radius: 8px;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .form-row {
    flex-direction: column;
    gap: 8px;
  }
  .form-row .form-input {
    width: 100%;
  }
  .form-row .verify-btn {
    width: 100%;
    text-align: center;
  }

  /* === 信息网格 === */
  .info-grid {
    grid-template-columns: 1fr !important;
  }

  /* === 等级选择卡片 === */
  .level-cards {
    flex-direction: column;
  }
  .level-card {
    min-width: auto;
  }

  /* === 菜单网格 === */
  .menu-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }

  /* === 订单网格 === */
  .order-grid {
    grid-template-columns: 1fr !important;
  }

  /* === 订单卡片内容溢出控制 === */
  .order-card,
  .detail-card,
  .info-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  .order-info-row,
  .detail-row,
  .info-row {
    flex-wrap: wrap !important;
    word-break: break-all !important;
  }

  /* === Debug 面板移动端隐藏 === */
  .debug-panel,
  .debug-toggle {
    display: none !important;
  }

  /* === 按钮组全宽 === */
  .action-btns {
    flex-direction: column;
    gap: 12px;
  }
  .action-btns .btn {
    width: 100%;
  }

  /* === 内容标题 === */
  .myCenter-R h4 {
    font-size: 16px;
  }
  /* 移动端隐藏标题内的返回链接（已由 .mobile-back-bar 统一显示） */
  .myCenter-R h4 a[href] {
    display: none !important;
  }
  .section-title {
    font-size: 17px;
  }

  /* === 通用子元素溢出保护（不影响小图标） === */
  .page-content img,
  .myCenter-R img,
  video, iframe {
    max-width: 100% !important;
  }
  table {
    display: block !important;
    overflow-x: auto !important;
    max-width: 100% !important;
  }

  /* === Footer 全宽 === */
  footer, .footer, .foot-wrap {
    width: 100% !important;
    max-width: 100% !important;
  }
  footer .center, .footer .center, .foot-wrap .center {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* ============================================================
   480px 断点 - Small Mobile
   ============================================================ */
@media (max-width: 480px) {

  /* --- 表单输入框防 iOS 缩放 --- */
  .form-input,
  .form-select,
  .form-textarea {
    height: 48px;
    font-size: 16px !important;
  }
  .form-textarea {
    height: 80px;
  }

  /* --- 等级卡片紧凑 --- */
  .level-card {
    padding: 20px 16px;
  }
  .level-price {
    font-size: 20px;
  }

  /* --- 菜单网格极窄屏 --- */
  .menu-grid {
    grid-template-columns: 1fr !important;
  }

  /* --- 按钮全宽 --- */
  .card-actions .btn {
    min-width: auto;
    width: 100%;
  }
}
