/* ============================================================
   IDC 服务商查询系统 - 全局样式
   极简黑白风格 / 亮暗模式(CSS 变量) / 无渐变 / 无阴影 / 微圆角
   ============================================================ */

/* ---- 主题变量 ---- */
:root {
    --bg: #ffffff;
    --fg: #111111;
    --muted: #6b6b6b;
    --border: #e6e6e6;
    --border-strong: #111111;
    --hover: #f5f5f5;
    --accent: #111111;
    --code-bg: #f7f7f7;
}
[data-theme="dark"] {
    --bg: #0f0f0f;
    --fg: #eeeeee;
    --muted: #9a9a9a;
    --border: #333333;
    --border-strong: #eeeeee;
    --hover: #1c1c1c;
    --accent: #eeeeee;
    --code-bg: #1a1a1a;
}

/* ---- 基础 ---- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}
a { color: var(--fg); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.container { max-width: 900px; margin: 0 auto; padding: 0 20px; }
.main { min-height: 60vh; padding-top: 32px; padding-bottom: 64px; }

/* ---- 顶部导航 ---- */
.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.logo { font-size: 17px; font-weight: 600; letter-spacing: 0.5px; }
.site-nav { display: flex; gap: 20px; }
.site-nav a { color: var(--muted); font-size: 14px; }
.site-nav a:hover { color: var(--fg); text-decoration: none; }

/* ---- 页脚 ---- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    color: var(--muted);
    font-size: 13px;
}

/* ---- 按钮: 1px 边框, hover 反色, 无阴影无位移 ---- */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    background: transparent;
    color: var(--fg);
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--fg); color: var(--bg); text-decoration: none; }
.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary:hover { background: transparent; color: var(--fg); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-danger { border-color: var(--border-strong); }
.btn-block { display: block; width: 100%; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ---- 表单 ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--muted); }
.form-group-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-group-row .form-group { flex: 1; min-width: 120px; }}
.form-group .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--bg);
    color: var(--fg);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s ease;
}
.form-control:focus { outline: none; border-color: var(--border-strong); }
textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { appearance: auto; }

/* ---- 首页搜索区 ---- */
.hero { text-align: center; padding: 48px 0 24px; }
.hero h1 { font-size: 26px; font-weight: 600; margin: 0 0 8px; }
.hero p { color: var(--muted); font-size: 14px; margin: 0 0 28px; }
.search-form { display: flex; gap: 8px; max-width: 560px; margin: 0 auto; }
.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    background: var(--bg);
    color: var(--fg);
    font-size: 15px;
    font-family: inherit;
}
.search-input:focus { outline: none; }
.search-submit { padding: 12px 24px; }

/* ---- 热门标签 ---- */
.hot-tags { text-align: center; margin-top: 24px; }
.hot-tags .label { color: var(--muted); font-size: 13px; margin-right: 8px; }
.tag {
    display: inline-block;
    padding: 3px 10px;
    margin: 4px 4px 0 0;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 13px;
    color: var(--muted);
}
.tag:hover { border-color: var(--border-strong); color: var(--fg); text-decoration: none; }

/* ---- 搜索页 ---- */
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.result-count { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

/* ---- 卡片列表: 1px 细线分隔, 无阴影包裹 ---- */
.card-list { border-top: 1px solid var(--border); }
.card {
    display: block;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}
.card:hover { text-decoration: none; }
.card-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.card-title { font-size: 17px; font-weight: 600; }
.card-meta { font-size: 13px; color: var(--muted); }
.card-summary { margin: 8px 0 10px; color: var(--muted); font-size: 14px; }
.card-tags { margin-top: 6px; }

/* ---- 状态标签 ---- */
.badge {
    display: inline-block;
    padding: 1px 8px;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 12px;
    color: var(--muted);
}
.badge-ok { border-color: var(--border-strong); color: var(--fg); }
.badge-warn { border-color: var(--border-strong); }
.badge-danger { border-color: var(--border-strong); }

/* ---- 分页 ---- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 32px; }
.page-info { color: var(--muted); font-size: 13px; }

/* ---- 详情页 ---- */
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--fg); }
.detail-title { font-size: 26px; font-weight: 600; margin: 0 0 8px; }
.detail-sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.section { margin-bottom: 32px; }
.section h2 {
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    margin: 0 0 16px;
}
.params-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.params-table th, .params-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
.params-table th { width: 120px; color: var(--muted); font-weight: 400; }
.risk-box { display: flex; align-items: baseline; gap: 12px; }
.risk-score { font-size: 34px; font-weight: 700; line-height: 1; }
.risk-text { font-size: 15px; }
.risk-note { color: var(--muted); font-size: 13px; margin-top: 6px; }
.prose { font-size: 15px; }
.prose p { margin: 0 0 12px; }
.prose h3 { font-size: 16px; margin: 20px 0 8px; }
.prose ul, .prose ol { padding-left: 20px; margin: 0 0 12px; }

/* ---- 产品推荐卡片 ---- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.product-card {
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 14px 16px;
    font-size: 14px;
}
.product-card:hover { border-color: var(--border-strong); text-decoration: none; }

/* ---- 弹窗/模态框: 纯边框矩形 ---- */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
    width: 100%;
    max-width: 480px;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    padding: 24px;
}
[data-theme="dark"] .modal { border-color: #333333; }
.modal h3 { margin: 0 0 16px; font-size: 18px; font-weight: 600; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal-msg { margin-top: 12px; font-size: 14px; }

/* ---- 亮暗模式切换按钮(固定右下角) ---- */
.theme-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: var(--bg);
    color: var(--fg);
    cursor: pointer;
    z-index: 90;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover { background: var(--fg); color: var(--bg); }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }

/* ---- 提示信息 ---- */
.alert { padding: 12px 16px; border: 1px solid var(--border); border-radius: 2px; font-size: 14px; margin-bottom: 16px; }
.alert-error { border-color: var(--border-strong); }
.alert-success { border-color: var(--border-strong); }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* ---- 中转页 ---- */
.jump-box { max-width: 480px; margin: 40px auto; border: 1px solid var(--border); border-radius: 2px; padding: 24px; text-align: center; }
.jump-box .url { word-break: break-all; color: var(--muted); font-size: 13px; margin: 12px 0 20px; }

/* ---- 后台表格 ---- */
.admin-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-bar h1 { font-size: 20px; font-weight: 600; margin: 0; }
.admin-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.admin-nav a { color: var(--muted); font-size: 14px; }
.admin-nav a:hover { color: var(--fg); text-decoration: none; }
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.data-table th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.data-table tr:hover td { background: var(--hover); }
.data-table .actions { white-space: nowrap; }
.data-table .actions a { margin-right: 10px; font-size: 13px; }
.data-table .num { font-variant-numeric: tabular-nums; }
.login-wrap { max-width: 360px; margin: 60px auto; }
.login-wrap h1 { font-size: 20px; font-weight: 600; margin: 0 0 24px; text-align: center; }

/* ---- 响应式(移动端) ---- */
@media (max-width: 600px) {
    .hero { padding: 32px 0 16px; }
    .hero h1 { font-size: 22px; }
    .search-form { flex-direction: column; }
    .search-submit { width: 100%; }
    .header-inner { height: 52px; }
    .site-nav { gap: 12px; }
    .detail-title { font-size: 22px; }
    .params-table th { width: 90px; }
    .theme-toggle { right: 14px; bottom: 14px; width: 38px; height: 38px; }
}

/* ============================================================
   新增: 页脚内容 / 友链 / 弹窗广告 / 后台设置
   ============================================================ */

/* ---- 页脚内容(后台可编辑) ---- */
.footer-content { font-size: 13px; color: var(--muted); }
.footer-content p { margin: 0 0 6px; }

/* ---- 友链区 ---- */
.friend-links {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 14px;
}
.friend-links-label { color: var(--muted); }
.friend-link { color: var(--muted); }
.friend-link:hover { color: var(--fg); }
.friend-apply-btn {
    border: none;
    background: none;
    padding: 0;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
}
.friend-apply-btn:hover { color: var(--fg); }

/* ---- 弹窗广告 ---- */
.ad-popup-mask { z-index: 110; }
.ad-popup { max-width: 420px; padding: 0; overflow: hidden; }
.ad-popup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}
.ad-popup-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.ad-popup-close {
    border: none;
    background: none;
    font-size: 20px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0 4px;
}
.ad-popup-close:hover { color: var(--fg); }
.ad-popup-body { padding: 20px; font-size: 14px; }

/* ---- 后台设置/广告/友链页面辅助 ---- */
.form-section-title {
    font-size: 15px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    margin: 28px 0 16px;
}
.form-section-title:first-of-type { margin-top: 0; }
.checkbox-line { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.checkbox-line input { width: 16px; height: 16px; }
.ad-type-badge { font-size: 12px; color: var(--muted); }
.inline-form { display: inline; }

/* ---- 首页顶部横幅广告 ---- */
.banner-ads {
    margin-bottom: 28px;
    border: 1px solid var(--border);
}
.banner-ad {
    padding: 12px 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.banner-ad + .banner-ad { border-top: 1px solid var(--border); }
.banner-ad p { margin: 0; }
.banner-ad-link {
    flex-shrink: 0;
    font-size: 13px;
    color: var(--fg);
    border: 1px solid var(--border);
    padding: 4px 10px;
    text-decoration: none;
}
.banner-ad-link:hover { background: var(--fg); color: var(--bg); }

/* ---- 登录验证码 ---- */
.captcha-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.captcha-row .form-control { flex: 1; }
.captcha-img {
    width: 130px;
    height: 44px;
    flex: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    display: block;
    background: var(--bg);
    user-select: none;
}
.captcha-img:hover { border-color: var(--border-strong); }

/* ============================================================
   新增: 服务商图标 / 关键词高亮 / 相关推荐 / 回到顶部 / 体验优化
   ============================================================ */

/* ---- 服务商图标: 固定尺寸防布局抖动, 失败回退首字母 ---- */
.provider-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--hover);
    overflow: hidden;
    vertical-align: middle;
}
.provider-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.provider-icon.fallback::after {
    content: attr(data-char);
    font-weight: 600;
    color: var(--muted);
    line-height: 1;
}

/* ---- 后台列表: 图标 + 名称 ---- */
.cell-with-icon { display: inline-flex; align-items: center; gap: 8px; }
.domain-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- 搜索卡片域名 ---- */
.card-domain { font-variant-numeric: tabular-nums; }

/* ---- 后台表单: 图标字段预览 ---- */
.icon-field-row { display: flex; align-items: center; gap: 10px; }
.icon-field-row .form-control { flex: 1; }
.icon-field-preview { width: 40px; height: 40px; }
.icon-field-preview.fallback::after { font-size: 18px; }

/* ---- 搜索卡片: 图标 + 内容布局 ---- */
.card-head { display: flex; align-items: flex-start; gap: 14px; }
.card-head-main { flex: 1; min-width: 0; }

/* ---- 关键词高亮 ---- */
mark.hl {
    background: transparent;
    color: var(--fg);
    border-bottom: 2px solid var(--border-strong);
    padding: 0;
    font-weight: 600;
}

/* ---- 详情页头部: 图标 + 标题 ---- */
.detail-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.detail-head-main { flex: 1; min-width: 0; }
.detail-head .detail-title { margin: 0 0 8px; }
.detail-head .detail-sub { margin-bottom: 0; }
.btn-copy { margin-left: 8px; vertical-align: middle; }

/* ---- 相关服务商推荐 ---- */
.related-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}
.related-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 14px;
}
.related-item:hover { border-color: var(--border-strong); text-decoration: none; }
.related-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related-meta { color: var(--muted); font-size: 12px; flex-shrink: 0; }

/* ---- 回到顶部按钮 ---- */
.back-top {
    position: fixed;
    right: 20px;
    bottom: 68px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: var(--bg);
    color: var(--fg);
    cursor: pointer;
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease, background-color 0.15s ease, color 0.15s ease;
}
.back-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-top:hover { background: var(--fg); color: var(--bg); }

/* ---- 响应式补充 ---- */
@media (max-width: 600px) {
    .detail-head { gap: 12px; }
    .related-list { grid-template-columns: 1fr 1fr; }
    .back-top { right: 14px; bottom: 62px; width: 38px; height: 38px; }
}
