/* ===========================
   微信公众号登录系统 - 样式
   =========================== */

:root {
  --green: #07c160;
  --green-dark: #06ad56;
  --green-bg: #e8f8ee;
  --bg: #f5f5f5;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-sec: #666;
  --text-light: #999;
  --border: #e8e8e8;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===========================
   导航栏
   =========================== */

.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.nav-inner {
  max-width: 1000px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-title { font-size: 16px; font-weight: 600; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-mode {
  font-size: 11px;
  padding: 2px 8px;
  background: #fff3cd;
  color: #856404;
  border-radius: 4px;
}

.nav-mode.production { background: #d4edda; color: #155724; }

.btn-login-nav {
  padding: 7px 20px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-login-nav:hover { background: var(--green-dark); }

.user-info-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.nav-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-avatar[src=""], .nav-avatar:not([src]) { display: none; }

.nav-name { font-size: 14px; font-weight: 500; }

.nav-points {
  font-size: 12px;
  color: var(--green);
  font-weight: 600;
}

/* ===========================
   文档区域
   =========================== */

.doc-container {
  max-width: 900px;
  margin: 72px auto 40px;
  padding: 0 24px;
}

/* 一级标题 - 独立的大区块 */
.doc-section {
  background: var(--card);
  border-radius: 12px;
  padding: 36px 40px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.doc-section h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}

.doc-section .sub {
  color: var(--text-sec);
  font-size: 14px;
  margin-bottom: 4px;
}

.doc-section hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* 二级标题 - 每个功能独立卡片 */
.doc-func {
  background: var(--card);
  border-radius: 12px;
  padding: 28px 36px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.doc-func h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.doc-func h2 .func-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 4px;
  color: white;
}

.func-tag.get { background: #1a8cff; }
.func-tag.post { background: var(--green); }

.doc-func .desc {
  font-size: 14px;
  color: var(--text-sec);
  margin-bottom: 12px;
  line-height: 1.6;
}

.doc-func .endpoint {
  font-size: 14px;
  background: #f5f5f5;
  padding: 10px 14px;
  border-radius: 6px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.doc-func .endpoint .method {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  color: white;
  margin-right: 8px;
}

.doc-func pre {
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  font-family: 'SFMono-Regular', Consolas, monospace;
}

.doc-func pre .c { color: #999; }

/* 数据表 */
.doc-func table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 8px;
}

.doc-func th, .doc-func td {
  padding: 8px 12px;
  text-align: left;
  border: 1px solid var(--border);
}

.doc-func th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 13px;
}

.doc-func .req-auth {
  display: inline-block;
  font-size: 11px;
  padding: 2px 10px;
  background: #fff3cd;
  color: #856404;
  border-radius: 4px;
  margin-left: 8px;
}

/* ===========================
   全屏弹窗
   =========================== */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
}

.modal-overlay.show {
  display: block;
}

.modal-card {
  width: 100vw;
  height: 100vh;
  background: var(--bg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

.modal-inner {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 16px;
  padding: 36px 28px 28px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
  text-align: center;
  animation: fadeUp 0.25s ease-out;
  margin-top: 40px;
}

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

/* 弹窗头部 */
.modal-header { margin-bottom: 24px; }

.modal-header h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.modal-header p {
  font-size: 14px;
  color: var(--text-sec);
}

/* 二维码 */
#modalQrcode {
  width: 200px;
  height: 200px;
  margin: 0 auto 20px;
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}

#modalQrcode img { width: 100%; height: 100%; object-fit: contain; }

#modalQrcode .qrcode-placeholder {
  font-size: 13px; color: var(--text-light);
}

/* 步骤 */
.modal-steps {
  text-align: left;
  margin-bottom: 24px;
  padding: 0 4px;
}

.ms-item {
  font-size: 14px;
  color: var(--text-sec);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ms-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--green-bg);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* 验证码 */
.modal-code-section { margin-bottom: 8px; }

.modal-code-label {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  text-align: left;
}

#modalCodeInput {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 12px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: var(--text);
  caret-color: var(--green);
}

#modalCodeInput:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.12);
}

#modalCodeInput::placeholder {
  font-size: 14px;
  letter-spacing: normal;
  font-weight: 400;
  color: var(--text-light);
}

.modal-msg {
  margin: 12px 0;
  font-size: 14px;
  min-height: 22px;
  color: var(--green);
}

.modal-msg.error { color: #d93025; }

.modal-close-btn {
  margin-top: 24px;
  padding: 10px 0;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-light);
  font-size: 15px;
  cursor: pointer;
}

.modal-close-btn:hover { color: var(--text); }

/* 弹窗已登录 */
.modal-profile { text-align: center; padding: 20px 0; }

.modal-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--green-bg);
  margin-bottom: 16px;
}

.modal-profile h2 { font-size: 20px; margin-bottom: 2px; }
.modal-meta { font-size: 13px; color: var(--text-sec); margin-bottom: 24px; }

.modal-points-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  background: #f8fffb;
  border: 1px solid #d4edda;
  border-radius: 10px;
  margin-bottom: 4px;
}

.mp-label { font-size: 14px; color: var(--text-sec); }
.mp-value { font-size: 28px; font-weight: 700; color: var(--green); }

.btn-checkin-sm {
  padding: 9px 20px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-checkin-sm:hover:not(:disabled) { background: var(--green-dark); }

.btn-checkin-sm:disabled,
.btn-checkin-sm.checked {
  background: #e8e8e8;
  color: #999;
  cursor: not-allowed;
}

.modal-checkin-msg {
  font-size: 13px;
  color: var(--text-light);
  min-height: 22px;
  margin-bottom: 20px;
}

.btn-logout-modal {
  width: 100%;
  padding: 11px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-sec);
  font-size: 14px;
  cursor: pointer;
  margin-top: 6px;
}

.btn-logout-modal:hover { background: #f5f5f5; }

/* ===========================
   响应式
   =========================== */

@media (max-width: 640px) {
  .doc-container { padding: 0 12px; }
  .doc-section { padding: 24px 20px; }
  .doc-func { padding: 20px 18px; }
  .modal-card { padding: 20px 12px; }
  .modal-inner { padding: 28px 18px 24px; margin-top: 20px; }
  #modalCodeInput { font-size: 24px; letter-spacing: 8px; }
}
