/* ==========================================================================
   新派网络 · 全局壳（导航 / 页脚 / 通用组件）
   依赖：tokens.css（须在前引入）
   ========================================================================== */

/* --------------------------------------------------------------------------
   基础
   -------------------------------------------------------------------------- */

html {
    scroll-behavior: smooth;
    /* 根元素撑满视口，body 用百分比取高度，
       避免 vh/dvh 与浏览器实际视口不一致导致底部差一截。
       底色用墨色：万一某页没有可撑开的展示区，视口余量与页脚同色，不露浅色空白 */
    height: 100%;
    background: var(--ink);
}

body {
    font-family: var(--font-sans);
    background: var(--bg-page);
    color: var(--text-primary);
    padding-top: var(--navbar-height);
    /* 纵向弹性布局：让内容展示区撑满视口，页脚落在视口底部且不被拉伸。
       Bootstrap 已全局设置 box-sizing: border-box，min-height 已包含 padding-top，
       因此直接取 100%，不能再减导航栏高度（否则底部会少一截） */
    display: flex;
    flex-direction: column;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body > #navbar-container,
body > #footer-container {
    flex-shrink: 0;
}

/* 首页内容容器撑开 */
body > main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/* 内容展示区吸收全部剩余高度：
   首页为 .featured-software，其它页为最后一个 section。
   空白留在这里——页脚保持自然高度，紧跟其后落在视口底部 */
body > main > .featured-software,
body > section:last-of-type {
    flex: 1 0 auto;
}

/* 大屏统一内容宽度，各页居中观感一致 */
@media (min-width: 1400px) {
    .container {
        max-width: 1200px;
    }
}

img {
    max-width: 100%;
}

::placeholder {
    color: var(--text-tertiary);
}

/* --------------------------------------------------------------------------
   导航栏：白色毛玻璃 sticky
   -------------------------------------------------------------------------- */

.site-navbar {
    background: rgba(255, 255, 255, 0.82);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border-default);
    box-shadow: none;
    min-height: var(--navbar-height);
    padding: 0;
    transition: box-shadow var(--duration-fast) var(--ease),
        border-color var(--duration-fast) var(--ease);
}

.site-navbar.scrolled {
    box-shadow: var(--shadow-sm);
    border-bottom-color: var(--border-default);
}

/* 兼容旧类名（其余页面仍在使用） */
.site-navbar.glass-effect {
    background: rgba(255, 255, 255, 0.82);
}

.bg-dark-blue,
.bg-carbon-gray {
    background-color: var(--ink) !important;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    color: var(--text-primary);
}

.navbar-brand:hover {
    color: var(--text-primary);
}

/* 品牌字：系统字体栈（无版权风险）+ 800 字重 + 宽松字距，"网络"用品牌蓝点睛 */
.navbar-brand .brand-name {
    font-family: var(--font-sans);
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1;
    color: var(--text-primary);
}

.site-navbar .nav-link {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 14px !important;
    border-radius: var(--radius-sm);
    transition: color var(--duration-fast) var(--ease),
        background var(--duration-fast) var(--ease);
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link:focus {
    color: var(--text-primary);
    background: var(--gray-100);
}

.site-navbar .nav-link.active {
    color: var(--primary);
    background: var(--primary-soft);
}

/* 分类下拉：触发器为品牌色小胶囊，圆角中等，比导航项更紧凑 */
.category-dropdown .category-toggle-btn {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 6px 13px !important;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: var(--primary-soft);
    margin: 0;
    transition: background var(--duration-fast) var(--ease),
        color var(--duration-fast) var(--ease),
        box-shadow var(--duration-fast) var(--ease);
}

.category-dropdown .category-toggle-btn:hover,
.category-dropdown .category-toggle-btn.show {
    color: var(--on-primary);
    background: var(--primary);
    box-shadow: 0 3px 8px rgba(0, 82, 255, 0.22);
}

.category-dropdown .category-toggle-btn::after {
    margin-left: 6px;
    font-size: 9px;
    vertical-align: 1px;
    opacity: 0.8;
}

.dropdown-menu {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    background: var(--bg-card);
    min-width: 220px;
    margin-top: 4px !important;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--duration-fast) var(--ease);
}

.dropdown-item i {
    color: var(--gray-500);
    width: 18px;
    text-align: center;
    transition: color var(--duration-fast) var(--ease);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--gray-100);
    color: var(--text-primary);
}

.dropdown-item:hover i {
    color: var(--primary);
}

/* 导航搜索：浅色胶囊 */
.navbar-search-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 320px;
    background: var(--gray-100);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    transition: all var(--duration-fast) var(--ease);
}

.navbar-search-group:focus-within {
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.navbar-search-group .search-icon {
    position: absolute;
    left: 16px;
    color: var(--gray-500);
    font-size: 14px;
    pointer-events: none;
}

.navbar-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 9px 44px 9px 42px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    box-shadow: none;
}

.navbar-search-btn {
    position: absolute;
    right: 5px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: var(--on-primary);
    width: 28px;
    height: 28px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration-fast) var(--ease);
}

.navbar-search-btn:hover {
    background: var(--primary-hover);
}

/* 汉堡按钮 */
.navbar-toggler {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    color: var(--text-secondary);
    font-size: 18px;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* 移动端分类宫格（去彩色） */
.mobile-category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px 0 4px;
}

.mobile-category-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 8px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease);
}

.mobile-category-btn i {
    font-size: 18px;
    color: var(--gray-500);
    transition: color var(--duration-fast) var(--ease);
}

.mobile-category-btn:hover,
.mobile-category-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.mobile-category-btn:hover i,
.mobile-category-btn.active i {
    color: var(--primary);
}

/* --------------------------------------------------------------------------
   页脚：唯一深色区（墨黑 #0F1115）
   -------------------------------------------------------------------------- */

footer,
.site-footer,
.footer {
    background: var(--ink);
    color: var(--text-inverse);
}

footer a,
.site-footer a,
.footer a {
    color: var(--gray-400);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease);
}

footer a:hover,
.site-footer a:hover,
.footer a:hover {
    color: var(--white);
}

footer h5,
footer h6,
.site-footer h5,
.site-footer h6,
.footer h5,
.footer h6 {
    color: var(--white);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* 页脚骨架：品牌 + 三组链接，四列等分；
   统一最小高度并垂直居中，保证各页页脚高度一致 */
.footer-section {
    padding: 32px 0 0;
    min-height: 168px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    gap: 32px;
    padding-bottom: 24px;
}

.footer-brand .brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--white);
    font-size: 16px;
    font-weight: 700;
}

.footer-brand .brand:hover {
    color: var(--white);
}

.footer-brand .brand-name {
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.06em;
}

/* 页脚简介：只靠字号与亮度与周围链接拉开层次，不加竖线/图标等装饰 */
.footer-brand .brand-desc {
    margin: 0;
    max-width: 320px;
}

.brand-desc-main {
    display: block;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.65;
    color: var(--gray-300);
}

.footer-group-title {
    font-size: 13px;
    margin-bottom: 12px;
}

.footer-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px 24px;
    justify-content: start;
}

.footer-links-list--two {
    grid-template-columns: repeat(2, auto);
}

.footer-links-list--three {
    grid-template-columns: repeat(3, auto);
}

.footer-links-list a {
    font-size: 13px;
    color: var(--gray-400);
}

.footer-links-list a:hover {
    color: var(--white);
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--ink-border);
    padding: 14px 0;
    color: var(--gray-500);
    font-size: 12px;
}

.footer-bottom .beian-link {
    color: var(--gray-500);
    text-decoration: none;
}

.footer-bottom .beian-link:hover {
    color: var(--gray-400);
}

@media (max-width: 767.98px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }

    /* 窄屏下链接组回到两列，避免文字挤压换行 */
    .footer-links-list--three {
        grid-template-columns: repeat(2, auto);
    }

    .footer-bottom {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }
}

footer .form-control,
footer .form-select,
footer textarea,
.site-footer .form-control,
.footer .form-control {
    background: var(--ink-soft);
    border: 1px solid var(--ink-border);
    color: var(--text-inverse);
    border-radius: var(--radius-md);
    font-size: 14px;
}

footer .form-control::placeholder,
footer textarea::placeholder {
    color: var(--gray-500);
}

footer .form-control:focus,
footer textarea:focus {
    background: var(--ink-soft);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

footer .form-label,
.footer .form-label {
    color: var(--gray-400);
    font-size: 13px;
}

footer .btn,
.footer .btn {
    border-radius: var(--radius-md);
}

footer .text-muted,
.footer .text-muted {
    color: var(--gray-500) !important;
}

footer .form-control.is-invalid,
footer textarea.is-invalid {
    border-color: var(--danger);
}

/* --------------------------------------------------------------------------
   通用小组件
   -------------------------------------------------------------------------- */

/* 章节标题 */
.section-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
}

/* 渐变文字（兼容旧类名：改为纯品牌色） */
.text-gradient {
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    -webkit-text-fill-color: currentColor;
    color: var(--primary);
}

/* 返回顶部 */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all var(--duration-normal) var(--ease);
    box-shadow: var(--shadow-md);
    z-index: 1030;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* 气泡提示（点赞等） */
.bubble-tip {
    position: absolute;
    z-index: 1080;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--white);
    background: var(--gray-800);
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
    pointer-events: none;
}

.bubble-tip.bubble-success { background: var(--success); }
.bubble-tip.bubble-error { background: var(--danger); }
.bubble-tip.bubble-warning { background: var(--warning); }

/* 气泡箭头不再渲染（core.js 仍会创建该节点，此处统一隐藏） */
.bubble-tip-arrow {
    display: none;
}

/* 通用确认弹窗（core.js showConfirm） */
.xp-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(24, 24, 27, 0.42);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: xp-confirm-fade 0.2s ease both;
}

.xp-confirm {
    width: 100%;
    max-width: 360px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-default, rgba(24, 24, 27, 0.1));
    border-radius: 16px;
    box-shadow: var(--shadow-lg, 0 12px 40px rgba(31, 41, 55, 0.16));
    padding: 28px 26px 22px;
    text-align: center;
    animation: xp-confirm-pop 0.25s var(--ease, ease) both;
}

.xp-confirm-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
}

.xp-confirm-icon.tone-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.xp-confirm-icon.tone-primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary, #2563eb);
}

.xp-confirm-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 6px;
}

.xp-confirm-message {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary, #57606a);
    margin: 0 0 20px;
}

.xp-confirm-actions {
    display: flex;
    gap: 10px;
}

.xp-confirm-actions button {
    flex: 1;
    padding: 10px 0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.xp-confirm-cancel {
    border: 1px solid var(--border-default, rgba(24, 24, 27, 0.1));
    background: var(--bg-muted, #f1f4f9);
    color: var(--text-secondary, #57606a);
}

.xp-confirm-cancel:hover {
    background: #fff;
    color: var(--text-primary, #18181b);
}

.xp-confirm-ok.tone-primary {
    border: none;
    background: var(--primary, #2563eb);
    color: #fff;
}

.xp-confirm-ok.tone-danger {
    border: none;
    background: #ef4444;
    color: #fff;
}

.xp-confirm-ok:hover {
    opacity: 0.9;
}

.xp-confirm-ok:active,
.xp-confirm-cancel:active {
    transform: scale(0.97);
}

.xp-confirm-overlay.is-closing {
    animation: xp-confirm-fade 0.18s ease reverse both;
}

.xp-confirm-overlay.is-closing .xp-confirm {
    animation: xp-confirm-pop 0.18s ease reverse both;
}

@keyframes xp-confirm-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes xp-confirm-pop {
    from { opacity: 0; transform: scale(0.92) translateY(10px); }
    to { opacity: 1; transform: none; }
}

/* 全局通知 toast */
.custom-notification {
    position: fixed;
    top: calc(var(--navbar-height) + 16px);
    right: 24px;
    z-index: 1090;
    max-width: 360px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: notification-in 0.3s var(--ease);
}

@keyframes notification-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.custom-notification .notification-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    font-size: 14px;
    color: var(--text-primary);
}

.custom-notification .notification-icon {
    font-size: 16px;
    margin-top: 1px;
}

.custom-notification .notification-icon.text-success { color: var(--success) !important; }
.custom-notification .notification-icon.text-danger { color: var(--danger) !important; }
.custom-notification .notification-icon.text-warning { color: var(--warning) !important; }

/* 退场：淡出并上移，与入场动画方向呼应 */
.custom-notification.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
}

/* --------------------------------------------------------------------------
   注册/登录弹窗（navbar 触发，#loginModal 作用域，视觉与登录页一致）
   -------------------------------------------------------------------------- */

#loginModal .login-modal-dialog {
    max-width: 720px;
}

#loginModal .login-modal-content {
    border: 1px solid var(--border-default);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

#loginModal .login-modal-header {
    border-bottom: 1px solid var(--border-default);
    padding: 14px 24px;
}

#loginModal .login-modal-header .modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

#loginModal .login-pane {
    padding: 26px 26px 20px;
}

#loginModal .login-pane + .login-pane {
    border-top: 1px solid var(--border-default);
}

@media (min-width: 992px) {
    #loginModal .login-pane + .login-pane {
        border-top: none;
        border-left: 1px solid var(--border-default);
    }
}

#loginModal .login-pane-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

#loginModal .login-pane-head h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

#loginModal .login-pane-head p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--text-tertiary);
}

#loginModal .login-pane-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

#loginModal .login-pane-icon.wechat {
    background: rgba(7, 193, 96, 0.1);
    color: #07c160;
}

#loginModal .login-pane-icon.qq {
    background: rgba(0, 153, 255, 0.1);
    color: #0099ff;
}

#loginModal .wx-qrcode-box {
    display: flex;
    justify-content: center;
    padding: 8px 0 4px;
    min-height: 200px;
}

#loginModal .wx-qrcode-box iframe {
    border: none !important;
}

#loginModal .login-pane-tip {
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 10px 0 0;
}

#loginModal .qq-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px;
    border-radius: 12px;
    background: linear-gradient(135deg, #12b7f5, #0099ff);
    color: var(--white);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

#loginModal .qq-login-btn:hover {
    opacity: 0.9;
    color: var(--white);
}

#loginModal .login-benefits {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#loginModal .login-benefits li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

#loginModal .login-benefits li i {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(7, 193, 96, 0.12);
    color: #07c160;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#loginModal .login-pane-off {
    text-align: center;
    padding: 32px 12px;
    color: var(--text-tertiary);
}

#loginModal .login-pane-off i {
    font-size: 34px;
    margin-bottom: 10px;
    opacity: 0.55;
    display: block;
}

#loginModal .login-pane-off p {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 4px;
}

#loginModal .login-pane-off span {
    font-size: 12px;
}

#loginModal .login-agreement {
    margin: 14px 0 0;
    font-size: 12px;
    color: var(--text-tertiary);
}

#loginModal .login-agreement a {
    color: var(--primary);
    text-decoration: none;
}

#loginModal .login-agreement a:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */

@media (max-width: 991.98px) {
    .site-navbar .navbar-collapse {
        background: var(--bg-card);
        border: 1px solid var(--border-default);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        margin-top: 10px;
        padding: 14px;
    }

    .navbar-search-group {
        max-width: 100%;
        margin: 8px 0;
    }
}

@media (max-width: 575.98px) {
    body {
        padding-top: 58px;
    }

    .site-navbar {
        min-height: 58px;
    }

    .back-to-top {
        right: 16px;
        bottom: 16px;
        width: 40px;
        height: 40px;
    }
}

/* --------------------------------------------------------------------------
   动效无障碍
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
