/* ============ 网址导航站 样式(360 新标签页风格,自写实现) ============ */
:root {
  --primary: #3b82f6;
  --primary-dark: #1d4ed8;
  --text: #1e293b;
  --text-sub: #64748b;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.55);
  --card-hover: rgba(255, 255, 255, 0.95);
  --radius: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  color: var(--text);
  background: #0f172a;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
/* 内置壁纸(渐变) */
.wp-g1 { background: linear-gradient(160deg, #4facfe 0%, #00f2fe 100%); }
.wp-g2 { background: linear-gradient(160deg, #5b247a 0%, #1bcedf 100%); }
.wp-g3 { background: linear-gradient(160deg, #11998e 0%, #38ef7d 100%); }
.wp-g4 { background: linear-gradient(160deg, #f7971e 0%, #ffd200 100%); }
.wp-g5 { background: linear-gradient(160deg, #0f2027 0%, #203a43 50%, #2c5364 100%); }
.wp-g6 { background: #f4f1ec; }
.wp-file { background: center / cover no-repeat fixed; }

/* 浅色壁纸下的文字适配 */
body.light .site-head { color: var(--text); text-shadow: none; }
body.light .ann-bar { background: rgba(15,23,42,.06); color: var(--text-sub); }
body.light .cat-tab { background: rgba(15,23,42,.05); color: var(--text); }
body.light .cat-tab:hover { background: rgba(15,23,42,.12); }
body.light .cat-tab.active { background: var(--primary); color: #fff; }
body.light .engine-btn { background: rgba(15,23,42,.06); color: var(--text); }
body.light .engine-btn:hover { background: rgba(15,23,42,.12); }
body.light .link-card, body.light .search-panel {
  background: rgba(255,255,255,.85);
  border-color: rgba(15,23,42,.08);
  box-shadow: 0 4px 20px rgba(15,23,42,.08);
}
body.light .link-card:hover { background: #fff; box-shadow: 0 14px 30px rgba(15,23,42,.14); }
body.light .empty-tip { color: var(--text-sub); }
body.light .foot { color: rgba(15,23,42,.55); }
body.light .foot a { color: rgba(15,23,42,.8); }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
}

/* ---------- 前台 ---------- */
.page-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 14px 20px 30px; }
.ann-bar {
  width: 100%; max-width: 860px; margin-bottom: 14px; padding: 7px 18px;
  text-align: center; color: #fff; font-size: 13px;
  background: rgba(15, 23, 42, 0.38); border-radius: 999px;
}
.site-head { text-align: center; margin: 8px 0 0; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.25); }
.site-head h1 { font-size: 34px; font-weight: 700; letter-spacing: 1px; }
.site-head p  { margin-top: 6px; font-size: 15px; opacity: .92; }
.site-logo { width: 400px; height: 170px; object-fit: contain; max-width: 92vw; filter: drop-shadow(0 6px 18px rgba(0,0,0,.3)); }

.search-panel { width: 100%; max-width: 640px; margin: 14px auto 20px; padding: 10px 12px; display: flex; align-items: center; position: relative; z-index: 50; }
.engine-btn {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; border: none; border-radius: 10px;
  background: rgba(255,255,255,.18); color: #fff; font-size: 15px; cursor: pointer; white-space: nowrap;
}
.engine-btn:hover { background: rgba(255,255,255,.3); }
.engine-menu {
  position: absolute; margin-top: 8px; background: #fff; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.18);
  padding: 6px; z-index: 30; min-width: 150px;
}
.engine-menu button {
  display: block; width: 100%; text-align: left; padding: 9px 14px; border: none; background: none;
  font-size: 14px; border-radius: 8px; cursor: pointer; color: var(--text);
}
.engine-menu button:hover { background: #eff6ff; color: var(--primary-dark); }
.search-input {
  flex: 1; margin: 0 10px; padding: 12px 18px; font-size: 16px; border: none; outline: none;
  background: rgba(255,255,255,.9); border-radius: 12px; color: var(--text);
}
.search-input:focus { box-shadow: 0 0 0 3px rgba(59,130,246,.55); }
.search-btn {
  padding: 12px 26px; border: none; border-radius: 12px; background: var(--primary); color: #fff;
  font-size: 16px; cursor: pointer; font-weight: 600;
}
.search-btn:hover { background: var(--primary-dark); }

.nav-wrap { width: 100%; max-width: 960px; }
.cat-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.cat-tab {
  padding: 9px 22px; border: none; border-radius: 999px; background: rgba(255,255,255,.16);
  color: #fff; font-size: 15px; cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.cat-tab:hover { background: rgba(255,255,255,.3); }
.cat-tab.active { background: #fff; color: var(--primary-dark); font-weight: 700; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.link-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 10px 16px;
  text-decoration: none; color: var(--text); border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.link-card:hover { transform: translateY(-4px); background: var(--card-hover); box-shadow: 0 16px 34px rgba(15,23,42,.16); }
.link-icon {
  width: 48px; height: 48px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #fff; border: 1px solid rgba(15,23,42,.08);
}
.link-icon img { width: 100%; height: 100%; object-fit: contain; padding: 3px; box-sizing: border-box; border-radius: 13px; }
.link-icon span {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #60a5fa, #3b82f6); color: #fff; font-size: 21px; font-weight: 700; border-radius: 13px;
}
.link-card .l-name { font-size: 14px; text-align: center; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.link-card .l-domain { font-size: 11px; color: var(--text-sub); }
.empty-tip { padding: 60px 0; text-align: center; color: #fff; opacity: .9; font-size: 15px; }

/* 加密分类:输入访问密码(在网格里横跨整行并水平居中)*/
.lock-panel {
  grid-column: 1 / -1;
  justify-self: center;
  width: 100%;
  max-width: 420px;
  margin: 6px 0 40px;
  padding: 28px 22px 24px;
  text-align: center;
  box-sizing: border-box;
}
.lock-panel .lock-icon { font-size: 34px; line-height: 1; }
.lock-panel h3 { margin: 12px 0 6px; font-size: 17px; color: var(--text); }
.lock-panel p { margin: 0; font-size: 13px; color: var(--text-sub); }
.lock-row { display: flex; gap: 8px; margin-top: 18px; }
.lock-input {
  flex: 1; min-width: 0; padding: 11px 13px; border-radius: 10px; border: 1px solid rgba(148,163,184,.5);
  background: rgba(255,255,255,.9); color: var(--text); font-size: 14px; outline: none;
}
.lock-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.25); }
.lock-btn {
  padding: 0 18px; border: none; border-radius: 10px; background: var(--primary); color: #fff;
  font-size: 14px; cursor: pointer;
}
.lock-btn:hover { background: var(--primary-dark); }
.lock-tip { min-height: 18px; margin-top: 10px; font-size: 12.5px; color: #dc2626; }

/* 后台:分类列表里的「已加密」标记 */
.tag-lock {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 11.5px; color: #b45309; background: #fef3c7; border: 1px solid #fde68a; vertical-align: middle;
}

.foot { margin-top: 36px; padding: 0 16px 10px; max-width: 900px; text-align: center; font-size: 12px; line-height: 1.8; white-space: pre-line; color: rgba(255,255,255,.72); }

/* ---------- 后台 ---------- */
.admin-body { background: #f1f5f9; }
.admin-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; height: 56px; background: #0f172a; color: #fff;
  position: sticky; top: 0; z-index: 50;
}
.admin-top .brand { font-size: 17px; font-weight: 700; }
.admin-nav { display: flex; gap: 4px; margin-left: 34px; flex: 1; }
.admin-nav button {
  border: none; background: transparent; color: #cbd5e1; font-size: 14px; padding: 8px 16px;
  border-radius: 8px; cursor: pointer;
}
.admin-nav button:hover { color: #fff; background: rgba(255,255,255,.1); }
.admin-nav button.active { color: #fff; background: var(--primary); }
.admin-body-inner { max-width: 1080px; margin: 26px auto; padding: 0 18px 60px; }
.panel { display: none; }
.panel.active { display: block; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h2 { font-size: 20px; color: var(--text); }

.btn {
  border: none; border-radius: 9px; padding: 9px 18px; font-size: 14px; cursor: pointer;
  background: var(--primary); color: #fff; transition: filter .12s;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid #e2e8f0; }
.btn.danger { background: #ef4444; }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 7px; }
.btn.plain { background: none; color: var(--primary-dark); padding: 5px 8px; }
.btn.plain.danger { color: #dc2626; background: none; }

.cards { background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: 0 1px 3px rgba(15,23,42,.06); }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th {
  text-align: left; padding: 10px 12px; color: var(--text-sub); font-weight: 600; font-size: 13px;
  border-bottom: 1px solid #e2e8f0; white-space: nowrap;
}
table.list td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table.list tr:last-child td { border-bottom: none; }
table.list tr:hover td { background: #f8fafc; }
.row-actions { white-space: nowrap; }
.row-actions button { margin-right: 2px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-item label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
.form-item.full { grid-column: 1 / -1; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid #e2e8f0; border-radius: 9px; font-size: 14px;
  outline: none; background: #fff; color: var(--text); font-family: inherit;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); display: none;
  align-items: center; justify-content: center; z-index: 100;
}
.modal-mask.show { display: flex; }
.modal { width: 480px; max-width: 92vw; background: #fff; border-radius: 16px; padding: 22px; }
.modal h3 { margin-bottom: 16px; font-size: 17px; }
.modal .form-item { margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.wp-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: 12px; }
.wp-item { cursor: pointer; border-radius: 12px; overflow: hidden; border: 3px solid transparent; position: relative; }
.wp-item.selected { border-color: var(--primary); }
.wp-thumb { height: 74px; background-size: cover; background-position: center; }
.wp-item.g1 .wp-thumb { background: linear-gradient(160deg,#4facfe,#00f2fe); }
.wp-item.g2 .wp-thumb { background: linear-gradient(160deg,#5b247a,#1bcedf); }
.wp-item.g3 .wp-thumb { background: linear-gradient(160deg,#11998e,#38ef7d); }
.wp-item.g4 .wp-thumb { background: linear-gradient(160deg,#f7971e,#ffd200); }
.wp-item.g5 .wp-thumb { background: linear-gradient(160deg,#0f2027,#2c5364); }
.wp-item.g6 .wp-thumb { background: #f4f1ec; border: 1px solid #e2e8f0; }
.wp-item.file .wp-thumb { background-color:#cbd5e1; }
.wp-item .wp-name { font-size: 12px; text-align: center; padding: 5px 2px; background: #fff; }
.wp-upload { border: 2px dashed #cbd5e1; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--text-sub); font-size: 13px; cursor: pointer; min-height: 74px; }
.wp-upload:hover { border-color: var(--primary); color: var(--primary-dark); }

/* 登录遮罩 */
.login-mask {
  position: fixed; inset: 0; z-index: 200; background: linear-gradient(160deg,#4facfe,#00f2fe);
  display: none; align-items: center; justify-content: center;
}
.login-mask.show { display: flex; }
.login-box { width: 360px; background: #fff; border-radius: 18px; padding: 34px 30px; box-shadow: 0 24px 60px rgba(0,0,0,.22); }
.login-box h2 { text-align: center; margin-bottom: 22px; font-size: 20px; }
.login-box .form-item { margin-bottom: 14px; }
.login-tip { margin-top: 12px; text-align: center; font-size: 12px; color: #ef4444; min-height: 16px; }

.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 300;
  background: #0f172a; color: #fff; padding: 10px 22px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.toast.show { opacity: .95; }
.toast.err { background: #dc2626; }

@media (max-width: 640px) {
  .site-head h1 { font-size: 26px; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-top { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 8px; }
  .admin-nav { margin-left: 0; }
}
