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

:root {
  --green: #07c160;
  --green-dark: #06ad56;
  --green-bg: #e8f8ee;
  --bg: #f5f5f5;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-sec: #666;
  --text-light: #999;
  --border: #e8e8e8;
  --sidebar-bg: #fafafa;
  --sidebar-w: 220px;
}

* { 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;
  display: flex;
  align-items: center;
}

.nav-inner {
  width: 100%;
  max-width: 1200px;
  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; }

.nav-admin-link {
  font-size: 13px; color: var(--green); text-decoration: none;
  padding: 4px 12px; border: 1px solid var(--green); border-radius: 4px;
}

.nav-admin-link:hover { background: var(--green-bg); }

.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=""] { display: none; }

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

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

/* ===========================
   飞书风格文档布局
   =========================== */

.doc-layout {
  display: flex;
  margin-top: 52px;
  min-height: calc(100vh - 52px);
}

/* 左侧导航 */
.doc-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
}

.sidebar-section { margin-bottom: 8px; }

.sidebar-label {
  font-size: 11px; font-weight: 600; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 8px 20px 4px;
}

.sidebar-item {
  padding: 7px 20px; font-size: 14px; color: var(--text-sec);
  cursor: pointer; transition: all 0.12s; border-left: 3px solid transparent;
}

.sidebar-item:hover { color: var(--text); background: #f0f0f0; }

.sidebar-item.active {
  color: var(--green); background: var(--green-bg);
  border-left-color: var(--green); font-weight: 500;
}

/* 右侧内容 */
.doc-main {
  flex: 1;
  padding: 32px 44px;
  max-width: 780px;
  background: var(--card);
}

.doc-page { display: none; }

.doc-page.active { display: block; }

.doc-page h1 {
  font-size: 26px; font-weight: 700; margin-bottom: 4px;
}

.doc-page h2 {
  font-size: 20px; font-weight: 600; margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
}

.page-sub {
  color: var(--text-sec); font-size: 14px; margin-bottom: 20px;
}

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

.doc-page h3 {
  font-size: 15px; font-weight: 600; margin: 16px 0 8px;
}

/* 标签 */
.tag-get, .tag-post {
  font-size: 12px; font-weight: 700; padding: 2px 10px;
  border-radius: 4px; color: white;
}

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

/* API 端点 */
.api-box {
  display: flex; align-items: center; gap: 8px;
  background: #f5f5f5; border: 1px solid var(--border);
  padding: 10px 14px; border-radius: 6px; margin-bottom: 14px;
}

.api-box .method {
  font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 4px; color: white;
}

.api-box .method.get { background: #1a8cff; }
.api-box .method.post { background: var(--green); }

.api-box code {
  font-size: 14px; font-family: 'SFMono-Regular', Consolas, monospace;
}

.auth-badge {
  font-size: 11px; padding: 2px 10px;
  background: #fff3cd; color: #856404; border-radius: 4px;
}

/* 代码块 */
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;
  margin-bottom: 16px;
}

pre .c { color: #999; }

/* 表格 */
.doc-page table {
  width: 100%; border-collapse: collapse; font-size: 14px;
  margin-bottom: 16px;
}

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

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

/* 滚动条 */
.doc-sidebar::-webkit-scrollbar { width: 4px; }
.doc-sidebar::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* ===========================
   左右分栏登录弹窗
   =========================== */

.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 200;
  align-items: center; justify-content: center;
}

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

.modal-card {
  background: var(--card); border-radius: 16px;
  box-shadow: 0 16px 60px rgba(0,0,0,0.15);
  animation: fadeUp 0.25s ease-out;
  overflow: hidden;
}

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

/* 左右布局 */
.modal-lr {
  display: flex;
  min-height: 400px;
}

.modal-left {
  width: 280px;
  background: #f8fffb;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px;
  border-right: 1px solid var(--border);
}

#modalQrcode {
  width: 200px; height: 200px;
  border: 2px solid var(--border);
  border-radius: 12px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--card);
}

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

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

.modal-right {
  flex: 1;
  padding: 36px 32px;
  display: flex; flex-direction: column;
  justify-content: center;
}

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

.modal-desc {
  font-size: 14px; color: var(--text-sec); margin-bottom: 20px;
}

.modal-steps {
  margin-bottom: 20px; padding: 0;
}

.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: 4px; }

.modal-code-label {
  display: block; font-size: 15px; font-weight: 700;
  margin-bottom: 10px;
}

#modalCodeInput {
  width: 100%; padding: 14px 16px;
  border: 2px solid var(--border); border-radius: 10px;
  font-size: 26px; font-weight: 700; letter-spacing: 10px;
  text-align: center; outline: none; transition: border-color 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: 10px 0; font-size: 14px; min-height: 22px; color: var(--green); }
.modal-msg.error { color: #d93025; }

.modal-close-btn {
  margin-top: 16px; padding: 8px 0;
  background: transparent; border: none;
  color: var(--text-light); font-size: 14px; cursor: pointer;
}

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

/* 弹窗-已登录 */
.modal-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  object-fit: cover; background: var(--green-bg);
}

.modal-meta { font-size: 13px; color: var(--text-sec); }

.modal-points-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; 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: 24px; font-weight: 700; color: var(--green); }

.btn-checkin-sm {
  padding: 8px 18px; background: var(--green); color: white;
  border: none; border-radius: 6px; 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: 16px;
}

.modal-admin-link { margin: 8px 0; }
.modal-admin-link a {
  color: var(--green); text-decoration: none; font-size: 14px;
  font-weight: 500;
}

.modal-admin-link a:hover { text-decoration: underline; }

.btn-logout-modal {
  width: 100%; padding: 10px;
  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: 768px) {
  .doc-sidebar { display: none; }
  .doc-main { padding: 24px 20px; }

  .modal-lr { flex-direction: column; min-height: auto; }
  .modal-left { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 24px; }
  .modal-right { padding: 28px 24px; }
}
