/* ========== 网址导航 公共样式 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --nav-primary: #667eea;
    --nav-primary-2: #764ba2;
    --nav-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --nav-card: rgba(255, 255, 255, 0.95);
    --nav-card-text: #333;
    --nav-muted: #999;
    --nav-border: #f0f0f0;
    --nav-tag-bg: #f0f0f0;
}

[data-theme="dark"] {
    --nav-primary: #7c8df0;
    --nav-primary-2: #8e6fd0;
    --nav-bg: linear-gradient(135deg, #1f2233 0%, #2b2342 100%);
    --nav-card: rgba(40, 42, 58, 0.92);
    --nav-card-text: #e8e8ef;
    --nav-muted: #9a9ab0;
    --nav-border: #3a3c52;
    --nav-tag-bg: #33354a;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: var(--nav-bg);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    color: var(--nav-card-text);
    transition: background .4s, color .3s;
}

/* 顶部导航栏 */
.navbar {
    background: var(--nav-card);
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 18px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.12);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}
.navbar-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; width: 100%; }
.logo { font-size: 22px; font-weight: bold; color: var(--nav-primary); text-decoration: none; white-space: nowrap; }

.search-box { position: relative; flex: 1; max-width: 560px; display: flex; gap: 8px; min-width: 240px; }
.search-box select {
    border: 2px solid var(--nav-border); border-radius: 25px; padding: 0 12px; outline: none;
    background: transparent; color: var(--nav-card-text); cursor: pointer;
}
.search-box input {
    flex: 1; padding: 10px 16px; border: 2px solid var(--nav-border); border-radius: 25px; outline: none;
    background: transparent; color: var(--nav-card-text); transition: all .3s;
}
.search-box input:focus { border-color: var(--nav-primary); box-shadow: 0 0 10px rgba(102,126,234,.3); }
.search-box button {
    background: var(--nav-primary); color: #fff; border: none; padding: 10px 18px; border-radius: 25px;
    cursor: pointer; transition: all .3s; white-space: nowrap;
}
.search-box button:hover { filter: brightness(1.08); transform: translateY(-1px); }

.nav-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nav-links { display: flex; gap: 14px; flex-wrap: wrap; }
.nav-links a { color: var(--nav-card-text); text-decoration: none; padding: 8px 14px; border-radius: 20px; transition: all .3s; font-weight: 500; }
.nav-links a:hover, .nav-links a.active { background: var(--nav-primary); color: #fff; }
.icon-btn {
    background: var(--nav-tag-bg); border: none; cursor: pointer; width: 38px; height: 38px; border-radius: 50%;
    font-size: 18px; color: var(--nav-card-text); transition: all .3s; line-height: 38px;
}
.icon-btn:hover { background: var(--nav-primary); color: #fff; transform: translateY(-2px); }

.main-content { max-width: 1200px; margin: 0 auto; }

/* 我的导航（收藏） */
.mynav {
    background: var(--nav-card); border-radius: 12px; padding: 14px 18px; margin-bottom: 18px;
    box-shadow: 0 2px 15px rgba(0,0,0,.12);
}
.mynav-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mynav-head h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.mynav-head .tip { font-size: 12px; color: var(--nav-muted); }
.mynav-list { display: flex; flex-wrap: wrap; gap: 10px; min-height: 40px; }
.mynav-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--nav-tag-bg);
    border-radius: 20px; cursor: grab; position: relative; transition: all .2s;
}
.mynav-item:active { cursor: grabbing; }
.mynav-item img { width: 18px; height: 18px; border-radius: 4px; }
.mynav-item a { color: var(--nav-card-text); text-decoration: none; font-size: 14px; }
.mynav-item .del { margin-left: 4px; color: var(--nav-muted); cursor: pointer; font-size: 13px; }
.mynav-empty { color: var(--nav-muted); font-size: 13px; padding: 6px 0; }

/* 分类 */
.section-title {display:flex;justify-content:space-between; background: var(--nav-card); padding: 10px 16px; border-radius: 10px 10px 0 0; margin-bottom: 5px; box-shadow: 0 2px 15px rgba(0,0,0,.1); }
.section-title h2 { font-size: 18px; }
.section-title h2 a { color: var(--nav-card-text); text-decoration: none; }

.website-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 16px; margin-bottom: 22px; }
/* 二级子分类区块 */
.sub-category { margin: 14px 0 4px; }
.sub-category .sub-title { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; font-size: 15px; font-weight: 700; color: var(--nav-card-text); }
.sub-category .sub-title::before { content: ""; width: 4px; height: 15px; border-radius: 2px; background: var(--nav-primary); display: inline-block; }
.sub-category .website-grid { margin-bottom: 6px; }
.sub-category .sub-more { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--nav-muted); text-decoration: none; }
.sub-category .sub-more:hover { color: var(--nav-primary); }
.website-card {
    background: var(--nav-card); border-radius: 10px; padding: 12px 8px; text-align: center; transition: all .3s;
    box-shadow: 0 2px 10px rgba(0,0,0,.1); cursor: pointer; position: relative;
}
.website-card:hover { transform: translateY(-5px); box-shadow: 0 5px 16px rgba(0,0,0,.2); background: var(--nav-primary); color: #fff; }
.website-card:hover .website-name, .website-card:hover .website-fav { color: #fff; }
.website-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto; background: var(--nav-tag-bg); font-size: 18px; }
.website-icon img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.website-name { font-size: 14px; font-weight: 400; color: var(--nav-card-text); transition: color .3s; margin-top: 6px; word-break: break-all; }
.fav-btn {
    position: absolute; top: 4px; right: 6px; font-size: 13px; color: #f5a623; cursor: pointer; opacity: .6; transition: opacity .2s;
}
.website-card:hover .fav-btn { opacity: 1; color: #fff; }
.qr-btn { position: absolute; top: 4px; left: 6px; font-size: 12px; cursor: pointer; opacity: 0; color: var(--nav-muted); transition: opacity .2s; }
.website-card:hover .qr-btn { opacity: 1; }

/* 热门 / 友情链接 横向卡片 */
.hot-recommend { border-radius: 10px; padding: 4px 0 14px; margin-bottom: 14px; }
.hot-recommend h3 { font-size: 20px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; color: var(--nav-card-text); }
.hot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.hot-item { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--nav-card); border-radius: 8px; transition: all .3s; cursor: pointer; position: relative; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.hot-item:hover { background: var(--nav-primary); color: #fff; }
.hot-item:hover .hot-info h4, .hot-item:hover .hot-info p { color: #fff; }
.hot-icon { width: 46px; height: 46px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--nav-tag-bg); font-size: 18px; overflow: hidden; flex-shrink: 0; }
.hot-icon img { width: 100%; height: 100%; object-fit: cover; }
.hot-info { min-width: 0; }
.hot-info h4 { font-size: 15px; margin-bottom: 4px; color: var(--nav-card-text); transition: color .3s; }
.hot-info p { font-size: 12px; color: var(--nav-muted); transition: color .3s; line-height: 18px; max-height: 36px; overflow: hidden; }
.hot-item .qr-btn { position: absolute; right: 8px; top: 6px; opacity: 0; font-size: 12px; cursor: pointer; color: var(--nav-muted); }
.hot-item:hover .qr-btn { opacity: 1; color: #fff; }

/* 排行 / 搜索结果 */
.rank-list, .search-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.rank-item, .search-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--nav-card); border-radius: 10px;
    text-decoration: none; color: var(--nav-card-text); transition: all .3s; box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.rank-item:hover, .search-item:hover { background: var(--nav-primary); color: #fff; transform: translateY(-2px); }
.rank-no { width: 28px; height: 28px; border-radius: 50%; background: var(--nav-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 13px; flex-shrink: 0; }
.rank-item:hover .rank-no { background: #fff; color: var(--nav-primary); }
.rank-icon { width: 40px; height: 40px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--nav-tag-bg); }
.rank-icon img { width: 100%; height: 100%; object-fit: cover; }
.rank-meta { min-width: 0; }
.rank-meta h4 { font-size: 15px; margin-bottom: 3px; }
.rank-meta p { font-size: 12px; color: var(--nav-muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rank-item:hover .rank-meta p { color: rgba(255,255,255,.8); }
.rank-clicks { margin-left: auto; font-size: 12px; color: var(--nav-muted); white-space: nowrap; }
.dead-badge { font-size: 11px; color: #e74c3c; margin-left: 6px; }

/* 投稿表单 */
.submit-box { background: var(--nav-card); border-radius: 12px; padding: 24px; max-width: 560px; margin: 0 auto; box-shadow: 0 2px 15px rgba(0,0,0,.12); }
.submit-box h2 { margin-bottom: 18px; font-size: 20px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--nav-card-text); }
.form-row input, .form-row select, .form-row textarea {
    width: 100%; padding: 10px 12px; border: 2px solid var(--nav-border); border-radius: 8px; outline: none;
    background: transparent; color: var(--nav-card-text); font-size: 14px;
}
.form-row textarea { resize: vertical; min-height: 70px; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--nav-primary); }
.btn-primary { background: var(--nav-primary); color: #fff; border: none; padding: 12px 28px; border-radius: 25px; cursor: pointer; font-size: 15px; }
.btn-primary:hover { filter: brightness(1.08); }
.form-msg { margin-top: 14px; font-size: 14px; min-height: 20px; }
.form-msg.ok { color: #2ecc71; }
.form-msg.err { color: #e74c3c; }

/* 二维码弹层为 haonav 自身功能（nav.js 控制），样式保留在此；
   登录弹层 / 会员区 / 头像下拉 等样式已由全局组件 auth.js 自动注入（自带 --ua-* 变量），
   全站任意页面无需引入本协议即可使用登录弹窗。 */
.qr-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; z-index: 999; }
.qr-mask.show { display: flex; }
.qr-box { background: #fff; border-radius: 12px; padding: 20px; text-align: center; max-width: 90%; }
.qr-box img { width: 220px; height: 220px; }
.qr-box p { margin-top: 10px; font-size: 12px; color: #666; word-break: break-all; }
.qr-box .close { margin-top: 12px; display: inline-block; padding: 8px 20px; background: #667eea; color: #fff; border-radius: 20px; cursor: pointer; }

/* 页脚 */
.footer { text-align: center; color: rgba(255,255,255,.75); margin-top: 36px; padding: 20px; font-size: 14px; }
.footer a { color: inherit; }

/* 响应式 */
@media (max-width: 768px) {
    body { padding: 12px; }
    .navbar { padding: 12px; }
    .navbar-content { flex-direction: column; align-items: stretch; }
    .search-box { max-width: 100%; }
    .nav-actions { justify-content: space-between; }
    .website-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
    .hot-grid { grid-template-columns: 1fr; }
    .rank-list, .search-list { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .website-grid { grid-template-columns: repeat(3, 1fr); }
    .nav-links { justify-content: center; }
}

/* 搜索自动补全下拉 */
.suggest-box {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 1000;
    background: var(--nav-card); border: 1px solid var(--nav-border); border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.18); display: none; max-height: 340px; overflow-y: auto;
}
.suggest-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer;
    color: var(--nav-card-text); border-bottom: 1px solid var(--nav-border);
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item img { width: 22px; height: 22px; border-radius: 5px; flex-shrink: 0; background: var(--nav-tag-bg); }
.suggest-item .s-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-item .s-url { font-size: 12px; color: var(--nav-muted); margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.suggest-item.active, .suggest-item:hover { background: var(--nav-primary); color: #fff; }
.suggest-item.active .s-url, .suggest-item:hover .s-url { color: rgba(255,255,255,.8); }

/* 卡片 / 排行评分角标 */
.website-rating { font-size: 11px; color: var(--nav-muted); margin-top: 4px; }
.website-rating .rc { opacity: .8; }
.website-card:hover .website-rating { color: rgba(255,255,255,.85); }
.hot-item .website-rating { display: block; margin-top: 4px; }
.hot-item:hover .website-rating { color: rgba(255,255,255,.85); }
.rank-rating { display: block; font-size: 11px; color: #f5a623; margin-top: 3px; }

/* 详情页星星评分 */
.rating-box { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 8px 0 6px; }
.stars { display: inline-flex; gap: 4px; }
.star { font-size: 26px; color: var(--nav-border); cursor: pointer; transition: color .15s, transform .15s; line-height: 1; }
.star.on, .star:hover { color: #f5a623; }
.star:hover { transform: scale(1.15); }
.rating-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.3; }
.rating-score { font-size: 18px; font-weight: 700; color: #f5a623; }
.rating-count { font-size: 12px; color: var(--nav-muted); }
.rating-tip { font-size: 12px; color: var(--nav-muted); margin-bottom: 8px; }

/* 广告位 */
.ad-box { margin: 14px 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
.ad-box .ad-label { width: 100%; text-align: center; font-size: 11px; color: var(--nav-muted); letter-spacing: 2px; }
.ad-box .ad-item { display: inline-block; max-width: 100%; transition: transform .15s; }
.ad-box .ad-item:hover { transform: translateY(-2px); }
.ad-box .ad-item img { max-width: 100%; border-radius: 10px; display: block; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.ad-box.ad-detail-inline { max-width: 480px; margin: 18px auto; }
