/* ============================================================
   MJ7 三站点统一响应式 CSS — 手机端完美适配
   应用于: person_profile.html / company_profile.html / school_profile.html
   以及 mj7.cn / mfgabc.com / deepseeks.com.cn
   设计系统: CSS Variables + Mobile-first
   ============================================================ */

/* ── 设计令牌 ── */
:root {
  --mj7-primary: #f59e0b;
  --mj7-primary-dark: #d97706;
  --mj7-primary-light: #fef3c7;
  --mj7-blue: #165DFF;
  --mj7-blue-light: #e8f0fe;
  --mj7-purple: #7c3aed;
  --mj7-purple-light: #ede9fe;
  --mj7-bg: #f5f6fa;
  --mj7-card: #ffffff;
  --mj7-text: #1a1a2e;
  --mj7-text-secondary: #6b7280;
  --mj7-text-muted: #9ca3af;
  --mj7-border: #e5e7eb;
  --mj7-success: #10b981;
  --mj7-danger: #ef4444;
  --mj7-radius: 12px;
  --mj7-radius-sm: 8px;
  --mj7-shadow: 0 1px 3px rgba(0,0,0,0.06);
  --mj7-shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
  --mj7-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mj7-transition: 0.2s ease;
  --mj7-max-width: 1100px;
}

/* ── 全局重置 ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { 
  font-family: var(--mj7-font); 
  background: var(--mj7-bg); 
  color: var(--mj7-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── 容器 ── */
.mj7-container { 
  max-width: var(--mj7-max-width); 
  margin: 0 auto; 
  padding: 16px; 
}

/* ── 头部 ── */
.mj7-header {
  border-radius: var(--mj7-radius);
  margin-bottom: 20px;
  padding: 32px 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.mj7-header::after {
  content: ''; position: absolute; top: -50%; right: -20%; width: 200px; height: 200px;
  background: rgba(255,255,255,0.1); border-radius: 50%;
}
.mj7-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; position: relative; z-index: 1; }
.mj7-header .meta { font-size: 0.875rem; opacity: 0.85; position: relative; z-index: 1; }

/* ── 头像 ── */
.mj7-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(255,255,255,0.3); display: flex;
  align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; flex-shrink: 0;
  overflow: hidden;
}

/* ── 卡片 ── */
.mj7-card {
  background: var(--mj7-card); border-radius: var(--mj7-radius);
  padding: 20px; margin-bottom: 16px;
  box-shadow: var(--mj7-shadow);
}
.mj7-card h2 {
  font-size: 1.125rem; margin-bottom: 14px;
  padding-bottom: 8px; border-bottom: 2px solid var(--mj7-primary-light);
}

/* ── 统计条 ── */
.mj7-stats { display: flex; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.mj7-stat { 
  background: var(--mj7-card); padding: 12px 18px; border-radius: var(--mj7-radius-sm);
  text-align: center; min-width: 72px; box-shadow: var(--mj7-shadow); flex: 1;
}
.mj7-stat .num { font-size: 1.25rem; font-weight: 700; color: var(--mj7-primary); }
.mj7-stat .label { font-size: 0.688rem; color: var(--mj7-text-secondary); margin-top: 2px; }

/* ── 标签 ── */
.mj7-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.mj7-tag { 
  padding: 4px 12px; border-radius: 20px; font-size: 0.813rem; 
  background: var(--mj7-primary-light); color: #92400e; display: inline-block;
}

/* ── 信息行 ── */
.mj7-row { display: flex; padding: 10px 0; border-bottom: 1px solid var(--mj7-border); align-items: center; }
.mj7-row .label { width: 72px; color: var(--mj7-text-secondary); font-size: 0.813rem; flex-shrink: 0; }
.mj7-row .value { font-size: 0.875rem; flex: 1; }

/* ── 网格 ── */
.mj7-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mj7-grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

/* ── 产品卡片 ── */
.mj7-product-card {
  border: 1px solid var(--mj7-border); border-radius: var(--mj7-radius-sm);
  padding: 14px; cursor: pointer; transition: var(--mj7-transition);
}
.mj7-product-card:hover { box-shadow: var(--mj7-shadow-lg); transform: translateY(-2px); }
.mj7-product-card img { width: 100%; height: 130px; object-fit: cover; border-radius: 6px; margin-bottom: 8px; }
.mj7-product-card h4 { font-size: 0.875rem; margin-bottom: 4px; }
.mj7-product-card .price { font-size: 1.125rem; font-weight: 700; color: #e53e3e; }

/* ── Badge ── */
.mj7-badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 0.688rem; font-weight: 600; }
.mj7-badge-success { background: #d1fae5; color: #065f46; }
.mj7-badge-warning { background: #fef3c7; color: #92400e; }
.mj7-badge-info { background: var(--mj7-blue-light); color: var(--mj7-blue); }

/* ── Loading / Empty / Error ── */
.mj7-loading, .mj7-empty, .mj7-error { text-align: center; padding: 48px 16px; }
.mj7-loading { color: var(--mj7-text-secondary); }
.mj7-error { color: var(--mj7-danger); }
.mj7-empty { color: var(--mj7-text-muted); }
.mj7-spinner {
  width: 36px; height: 36px; border: 3px solid var(--mj7-border);
  border-top-color: var(--mj7-primary); border-radius: 50%;
  animation: mj7-spin 0.8s linear infinite; margin: 0 auto 12px;
}
@keyframes mj7-spin { to { transform: rotate(360deg); } }

/* ── 底部导航 (移动端) ── */
.mj7-mobile-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
  background: var(--mj7-card); border-top: 1px solid var(--mj7-border);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.mj7-mobile-nav-inner { display: flex; justify-content: space-around; align-items: center; max-width: 500px; margin: 0 auto; }
.mj7-mobile-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--mj7-text-muted); font-size: 0.625rem; padding: 4px 8px;
}
.mj7-mobile-nav a.active { color: var(--mj7-primary); }
.mj7-mobile-nav .nav-icon { font-size: 1.25rem; }

/* ── 汉堡菜单 (移动端) ── */
.mj7-hamburger { display: none; }

/* ═══════════════════════════════════════════
   手机端 (< 768px) 响应式覆盖
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  html { font-size: 15px; }

  .mj7-container { padding: 10px; }

  .mj7-header { 
    padding: 24px 16px; 
    border-radius: var(--mj7-radius-sm);
    flex-direction: column; 
    text-align: center; 
  }
  .mj7-header h1 { font-size: 1.25rem; }

  .mj7-avatar { width: 56px; height: 56px; font-size: 1.25rem; margin: 0 auto; }

  .mj7-grid-2 { grid-template-columns: 1fr; }
  .mj7-grid-3 { grid-template-columns: 1fr 1fr; }

  .mj7-card { padding: 14px; margin-bottom: 10px; }

  .mj7-stats { gap: 6px; }
  .mj7-stat { padding: 10px 8px; min-width: 60px; }
  .mj7-stat .num { font-size: 1.125rem; }

  .mj7-row { flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 0; }
  .mj7-row .label { width: auto; }

  /* 底部导航 */
  .mj7-mobile-nav { display: block; }
  body { padding-bottom: 70px; }

  /* 汉堡菜单 */
  .mj7-hamburger { 
    display: block; position: fixed; top: 12px; right: 12px; z-index: 1001;
    width: 36px; height: 36px; background: var(--mj7-card); border: 1px solid var(--mj7-border);
    border-radius: 8px; display: flex; flex-direction: column; 
    align-items: center; justify-content: center; gap: 4px; cursor: pointer;
    box-shadow: var(--mj7-shadow);
  }
  .mj7-hamburger span { width: 18px; height: 2px; background: var(--mj7-text); border-radius: 1px; }

  /* 触控优化 */
  button, a, .mj7-tag, .mj7-product-card { 
    min-height: 44px; min-width: 44px; /* WCAG 触控目标 */
  }
  input, select, textarea { font-size: 16px; } /* 防止 iOS 缩放 */

  /* 表格横向滚动 */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── 小屏手机 (< 375px) ── */
@media (max-width: 375px) {
  html { font-size: 14px; }
  .mj7-grid-3 { grid-template-columns: 1fr; }
  .mj7-header { padding: 20px 12px; }
  .mj7-product-card img { height: 100px; }
}

/* ── 平板 (768-1024px) ── */
@media (min-width: 769px) and (max-width: 1024px) {
  .mj7-container { padding: 16px 24px; }
  .mj7-grid-3 { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* ── 暗色模式支持 ── */
@media (prefers-color-scheme: dark) {
  :root {
    --mj7-bg: #0f172a;
    --mj7-card: #1e293b;
    --mj7-text: #e2e8f0;
    --mj7-text-secondary: #94a3b8;
    --mj7-text-muted: #64748b;
    --mj7-border: #334155;
  }
}
