/* ==========================================================
   嘿思API 站点样式
   ========================================================== */

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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --warn: #d97706;
  --success: #16a34a;
  --radius: 10px;
  --shadow: 0 4px 16px rgba(17, 24, 39, .08);
}

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

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { vertical-align: middle; }
code { font-family: Consolas, Monaco, monospace; background: rgba(37, 99, 235, .08); color: var(--primary-dark); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
pre { background: #0f172a; color: #e2e8f0; padding: 12px 16px; border-radius: 8px; overflow-x: auto; margin-top: 6px; }
pre code { background: none; color: inherit; padding: 0; }

.mono { font-family: Consolas, Monaco, monospace; font-size: 12px; }

/* ============ 顶部导航 + Hero ============ */
.header {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #2563eb 100%);
  padding-bottom: 56px;
}
.header-mini { padding-bottom: 0; }

.nav { padding: 14px 0; }
.nav-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; color: #fff; }
.logo-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; font-weight: 800;
}
.logo-text { letter-spacing: 1px; }

.nav-list { display: flex; gap: 22px; margin-left: auto; }
.nav-list a { color: rgba(255,255,255,.82); font-size: 15px; }
.nav-list a:hover { color: #fff; }

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

/* ---- 未登录 ---- */
.login-area { display: flex; align-items: center; gap: 12px; }
.login-status { color: rgba(255,255,255,.75); font-size: 14px; }
.btn-qq-login {
  display: inline-flex; align-items: center; gap: 7px;
  background: linear-gradient(135deg, #12b7f5, #1e90ff);
  color: #fff; font-size: 14px; font-weight: 600;
  padding: 7px 18px; border-radius: 999px;
  box-shadow: 0 4px 12px rgba(30, 144, 255, .4);
  transition: transform .15s, box-shadow .15s;
}
.btn-qq-login:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(30,144,255,.5); }
.qq-icon { flex: none; }

/* ---- 已登录: 头像下拉 ---- */
.user-menu { position: relative; }
.user-trigger { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 10px; border-radius: 999px; }
.user-trigger:hover { background: rgba(255,255,255,.12); }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.5); }
.avatar-sm { width: 28px; height: 28px; border: none; }
.nickname { color: #fff; font-size: 14px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arrow { color: rgba(255,255,255,.7); font-size: 10px; }

.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 150px; background: #fff; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.16);
  padding: 6px; opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: all .18s ease; z-index: 50;
}
.user-menu:hover .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown a { display: block; padding: 9px 12px; border-radius: 6px; color: var(--text); font-size: 14px; }
.dropdown a:hover { background: #eef2ff; color: var(--primary-dark); }

/* ---- Hero ---- */
.hero { text-align: center; padding: 46px 20px 8px; color: #fff; }
.hero h1 { font-size: 42px; font-weight: 800; letter-spacing: 2px; }
.hero h4 { font-weight: 400; font-size: 17px; color: rgba(255,255,255,.85); margin-top: 10px; }
.hero-stats { margin-top: 18px; font-size: 14px; color: rgba(255,255,255,.7); }
.hero-stats b { color: #93c5fd; font-size: 16px; margin: 0 2px; }

/* ============ 主体 ============ */
.container { max-width: 1160px; margin: 0 auto; padding: 30px 20px; }

.api-section { margin-top: -34px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-title h2 { font-size: 22px; }
.search-box input {
  width: 240px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 14px; outline: none; background: #fff;
}
.search-box input:focus { border-color: var(--primary); }

.api-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.api-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; display: flex; flex-direction: column; gap: 10px;
  transition: transform .15s, box-shadow .15s;
}
.api-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(17,24,39,.12); }
.api-card-head { display: flex; justify-content: space-between; align-items: center; }
.api-category { font-size: 12px; color: var(--primary-dark); background: #eff6ff; padding: 3px 10px; border-radius: 999px; }
.api-calls { font-size: 12px; color: var(--text-light); }
.api-name { font-size: 17px; }
.api-desc { font-size: 13.5px; color: var(--text-light); min-height: 40px; }
.api-route { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.btn-try {
  font-size: 13px; color: #fff; background: var(--primary);
  padding: 5px 14px; border-radius: 6px;
}
.btn-try:hover { background: var(--primary-dark); }

.empty-tip { color: var(--text-light); text-align: center; padding: 30px 0; }

/* ============ 关于 ============ */
.about-section { margin-top: 46px; }
.about-section > h2 { text-align: center; font-size: 22px; margin-bottom: 8px; }
.about-section > p { text-align: center; color: var(--text-light); font-size: 14px; max-width: 720px; margin: 0 auto 22px; }
.about-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.about-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; text-align: center; }
.about-card h4 { color: var(--primary-dark); margin-bottom: 6px; }
.about-card p { font-size: 13px; color: var(--text-light); }

/* ============ 底部 ============ */
.footer { background: #0f172a; color: rgba(255,255,255,.7); padding: 26px 20px; text-align: center; font-size: 13px; margin-top: 60px; }
.footer p { margin: 4px 0; }
.footer a { color: #93c5fd; }

/* ============ 按钮 ============ */
.btn { display: inline-block; border: none; cursor: pointer; font-size: 13px; padding: 6px 14px; border-radius: 6px; transition: opacity .15s; }
.btn:hover { opacity: .88; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-plain { background: #eef2ff; color: var(--primary-dark); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-warn { background: #fef3c7; color: var(--warn); }

/* ============ 标签 ============ */
.tag { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; }
.tag-admin { background: #fef3c7; color: #b45309; }
.tag-user { background: #e0e7ff; color: #4338ca; }
.tag-normal { background: #dcfce7; color: #15803d; }
.tag-banned { background: #fee2e2; color: #b91c1c; }

/* ============ 个人主页 ============ */
.profile-container { max-width: 900px; }
.profile-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; }
.profile-head { display: flex; align-items: center; gap: 18px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.profile-avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid #dbeafe; }
.profile-id h2 { font-size: 22px; }
.profile-id p { margin-top: 8px; display: flex; gap: 8px; }
.profile-section { margin-top: 24px; }
.profile-section h3 { font-size: 16px; margin-bottom: 12px; color: var(--text); border-left: 4px solid var(--primary); padding-left: 10px; }

.key-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.api-key { font-size: 15px; background: #eef2ff; padding: 10px 14px; border-radius: 8px; letter-spacing: 1px; user-select: all; }
.key-actions { display: flex; gap: 8px; }
.tip { font-size: 12.5px; color: var(--text-light); margin-top: 8px; }
.usage-example { margin-top: 14px; }

.info-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.info-table th, .info-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.info-table th { width: 150px; color: var(--text-light); font-weight: 500; background: #f9fafb; }
.info-table thead th { color: var(--text); background: #eef2ff; }
.ok { color: var(--success); }
.fail { color: var(--danger); }

/* ============ 管理面板 ============ */
.admin-title { font-size: 24px; margin-bottom: 18px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat-card span { font-size: 13px; color: var(--text-light); display: block; }
.stat-card b { font-size: 24px; color: var(--primary-dark); }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-btn { border: none; background: #e5e7eb; color: var(--text); font-size: 14px; padding: 8px 18px; border-radius: 8px; cursor: pointer; }
.tab-btn.active { background: var(--primary); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); font-size: 13px; }
.admin-table th, .admin-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.admin-table thead th { background: #eef2ff; font-weight: 600; white-space: nowrap; }
.admin-table tbody tr:hover { background: #f9fafb; }
.row-banned { background: #fff7f7; }
.row-banned td { color: #6b7280; }
.user-cell { display: flex; align-items: center; gap: 8px; }
.op-cell { white-space: nowrap; }
.op-cell .btn { margin-right: 4px; }
.ua-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 弹窗 ============ */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 12px; width: 92%; max-width: 640px; max-height: 85vh; overflow-y: auto; padding: 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-user { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: #0f172a; color: #fff; padding: 10px 22px; border-radius: 8px; font-size: 14px;
  opacity: 0; visibility: hidden; transition: all .25s; z-index: 200;
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  .nav-list { display: none; }
  .hero h1 { font-size: 30px; }
  .api-grid { grid-template-columns: 1fr; }
  .section-title { flex-direction: column; align-items: flex-start; }
  .search-box input { width: 100%; }
  .nickname { max-width: 70px; }
}