/* ==========================================================================
   新派网络 · 详情页
   依赖：tokens.css、common.css、components.css
   布局范式：白底页头 + 8/4 双栏 + 右侧 sticky 下载卡
   ========================================================================== */

/* --------------------------------------------------------------------------
   页头：软件身份
   -------------------------------------------------------------------------- */

/* 底色 / 纹理 / 微光由 page-header.css 的 .page-header-surface 提供 */
.software-header {
    padding: 32px 0 38px;
}

/* 面包屑 */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--gray-500);
}

.breadcrumb-nav a {
    color: var(--text-secondary);
    transition: color var(--duration-fast) var(--ease);
}

.breadcrumb-nav a:hover {
    color: var(--primary);
}

.breadcrumb-nav i {
    font-size: 9px;
    color: var(--gray-400);
}

.breadcrumb-nav > span {
    color: var(--gray-500);
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 身份区：分行排布（图标行 / 标题行 / 描述 / 标签） */
.software-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.software-logo-box {
    flex-shrink: 0;
    width: 104px;
    height: 104px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.software-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.software-info {
    width: 100%;
    min-width: 0;
}

.software-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}

.software-name {
    font-size: clamp(22px, 2.6vw, 28px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0;
}

.software-tagline {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.software-tags-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* 分类入口：面包屑移除后承担返回分类的导航职责 */
.software-origin {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-size: 12px;
    line-height: 1;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: var(--radius-full);
    background: var(--primary-soft);
    color: var(--primary);
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease),
        color var(--duration-fast) var(--ease);
}

.software-origin:hover {
    background: var(--primary);
    color: var(--on-primary);
}

.platform-tag-text {
    background: var(--gray-100);
    color: var(--gray-600);
}

@media (max-width: 767.98px) {
    .software-header {
        padding: 22px 0 24px;
    }

    .software-identity {
        gap: 14px;
    }

    .software-logo-box {
        width: 88px;
        height: 88px;
        padding: 10px;
    }

    .software-tagline {
        margin-bottom: 10px;
    }
}

/* --------------------------------------------------------------------------
   主体
   -------------------------------------------------------------------------- */

.software-content {
    padding: 32px 0 48px;
}

/* 富文本描述排版（safe_html 输出） */
.description-content {
    font-size: 15px;
    line-height: 2.1;
    color: var(--text-secondary);
}

/* 首段：摘要块，浅品牌底 + 品牌描边，与 .notice 提示块同源 */
.description-content > p:first-child {
    background: var(--primary-soft);
    border: 1px solid var(--primary-soft-hover);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 22px;
    line-height: 1.9;
}

.description-content p {
    margin-bottom: 16px;
}

.description-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: 8px 0;
}

.description-content ul,
.description-content ol {
    padding-left: 20px;
    margin-bottom: 16px;
}

.description-content li {
    margin-bottom: 6px;
}

.description-content h1, .description-content h2, .description-content h3 {
    font-size: 17px;
    line-height: 1.5;
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 12px;
}

.description-content a {
    color: var(--primary);
}

/* --------------------------------------------------------------------------
   截图
   -------------------------------------------------------------------------- */

.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.screenshot-item {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-default);
    cursor: zoom-in;
    transition: box-shadow var(--duration-fast) var(--ease);
    background: var(--gray-100);
}

.screenshot-item:hover {
    box-shadow: var(--shadow-md);
}

.screenshot-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

/* 截图放大层（detail.js 动态创建：.image-modal > .modal-backdrop > .modal-content > img）
   类名与 Bootstrap 冲突，必须以 .image-modal 作用域覆盖 */
.image-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    animation: image-modal-fade 0.2s var(--ease);
}

.image-modal .modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 17, 21, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    opacity: 1;
}

.image-modal .modal-content {
    position: relative;
    display: block;
    /* 贴合图片尺寸，使关闭按钮锚定在图片右上角而非页面角落 */
    width: fit-content;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    max-width: min(1080px, 92vw);
}

.image-modal .modal-content img {
    display: block;
    max-width: 100%;
    max-height: 84vh;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.image-modal .modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-full);
    /* 深色半透明底 + 模糊，保证压在浅色截图上仍清晰 */
    background: rgba(15, 17, 21, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    color: var(--white);
    font-size: 20px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    transition: background var(--duration-fast) var(--ease);
}

.image-modal .modal-close:hover {
    background: rgba(15, 17, 21, 0.78);
}

@keyframes image-modal-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --------------------------------------------------------------------------
   基本信息网格
   -------------------------------------------------------------------------- */

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px 14px 0;
    border-bottom: 1px solid var(--border-default);
}

.info-label {
    font-size: 12px;
    color: var(--text-tertiary);
}

.info-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-all;
}

.software-type-green {
    color: var(--success);
}

/* 双重审核徽章：细描边 + 柔光底 + 微投影，图标与文字留 6px 间距 */
.badge-verified {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    padding: 4px 11px 4px 9px;
    border: 1px solid rgba(0, 168, 112, 0.22);
    border-radius: var(--radius-full);
    background: var(--success-soft);
    box-shadow: 0 1px 2px rgba(0, 168, 112, 0.12);
    color: var(--success);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

.badge-verified i {
    font-size: 11px;
    line-height: 1;
}

/* --------------------------------------------------------------------------
   下载卡（sticky）
   -------------------------------------------------------------------------- */

.download-card {
    position: sticky;
    top: calc(var(--navbar-height) + 20px);
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 24px;
    /* 极近阴影：1px 描边 + 1px 偏移 / 2px 模糊，仅勾出边缘 */
    box-shadow:
        0 0 0 1px rgba(24, 24, 27, 0.03),
        0 1px 2px rgba(24, 24, 27, 0.06);
}

.price-display {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 16px;
}

.price-label {
    font-size: 13px;
    color: var(--text-tertiary);
}

.price-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.btn-download {
    padding: 12px 20px;
    font-size: 15px;
    border-radius: var(--radius-md);
}

/* 下载卡内提示条（detail.js 动态插入）：替代 Bootstrap alert
   已购 = 绿色柔光底；下载限制 = 橙色柔光底。描边/底色取自 tokens 语义色 */
.card-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.card-notice span {
    min-width: 0;
}

.card-notice i {
    flex-shrink: 0;
    /* 图标与首行文字基线光学对齐 */
    margin-top: 2px;
    font-size: 12px;
}

.card-notice-success {
    border-color: rgba(0, 168, 112, 0.22);
    background: var(--success-soft);
}

.card-notice-success i {
    color: var(--success);
}

.card-notice-warning {
    border-color: rgba(255, 149, 0, 0.26);
    background: var(--warning-soft);
}

.card-notice-warning i {
    color: var(--warning);
}

/* 订制服务已购提示：两行文案，字号加大，手机号强调 */
.card-notice-service {
    font-size: 15px;
    line-height: 1.75;
}

.card-notice-service i {
    margin-top: 3px;
    font-size: 15px;
}

.card-notice-service strong {
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
}

.download-meta {
    margin-top: 16px;
    border-top: 1px solid var(--border-default);
}

.meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 0;
    border-bottom: 1px solid var(--border-default);
}

.meta-row:last-child {
    border-bottom: none;
}

.meta-label {
    font-size: 13px;
    color: var(--text-tertiary);
}

.meta-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* 详情页点赞按钮（胶囊） */
/* 点赞：温暖浅橙（tokens 无橙系，色值局部定义） */
.btn-like-detail {
    --like-ink: #E8702A;
    --like-line: rgba(255, 138, 61, 0.45);
    --like-soft: rgba(255, 138, 61, 0.10);
    --like-soft-strong: rgba(255, 138, 61, 0.14);

    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--duration-fast) var(--ease);
}

.btn-like-detail:hover {
    border-color: var(--like-line);
    background: var(--like-soft);
    color: var(--like-ink);
}

.btn-like-detail.liked {
    border-color: var(--like-line);
    background: var(--like-soft-strong);
    color: var(--like-ink);
}

/* 小程序 / 网站（无需下载） */
.miniprogram-notice {
    text-align: center;
    padding: 16px 0 8px;
}

.miniprogram-qrcode {
    width: 180px;
    height: 180px;
    object-fit: contain;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    margin-bottom: 12px;
    background: var(--white);
}

.miniprogram-icon {
    font-size: 44px;
    color: var(--gray-500);
    margin-bottom: 12px;
    display: block;
}

.miniprogram-notice p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

/* --------------------------------------------------------------------------
   开发者 / 排行
   -------------------------------------------------------------------------- */

.developer-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

/* 容器固定方形且不参与 flex 收缩，避免被 max-width:100% 压成椭圆 */
.developer-avatar {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
}

.developer-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-default);
}

.developer-details h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.developer-details p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

.popular-downloads-content {
    display: flex;
    flex-direction: column;
}

.popular-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease);
}

.popular-item:hover {
    background: var(--gray-100);
}

.popular-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-default);
}

.popular-details {
    min-width: 0;
}

.popular-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.popular-description {
    font-size: 12px;
    color: var(--text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */

@media (max-width: 767.98px) {
    .download-card {
        position: static;
    }

    .screenshots-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}
