/* ============================================================
 *  APP 模块专用样式（仿华为应用市场风格）
 *  - 包含前台列表页 app.php + 详情页 app_detail.php
 *  - 主色：华为橙 #ff6700 / 蓝 #1890ff
 *  - 灰阶：#f5f5f5 / #fafafa / #e5e5e5
 *  - 圆角：12-24px
 * ============================================================ */

/* ============== 全局变量 ============== */
:root {
    --app-primary: #1890ff;
    --app-primary-dark: #096dd9;
    --app-accent: #ff6700;
    --app-text: #1f2937;
    --app-text-muted: #64748b;
    --app-bg: #f5f5f7;
    --app-card-bg: #ffffff;
    --app-border: #e5e7eb;
    --app-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --app-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.1);
    --app-radius: 16px;
    --app-radius-sm: 10px;
    --app-android: #3ddc84;
    --app-ios: #000000;
}

/* ============== 列表页 hero ============== */
.app-list-page,
.app-detail-page {
    background: var(--app-bg);
    min-height: 60vh;
    padding-bottom: 40px;
}

.app-hero {
    background: linear-gradient(135deg, #1d4ed8 0%, #1890ff 50%, #06b6d4 100%);
    color: #fff;
    border-radius: var(--app-radius);
    padding: 48px 36px;
    margin: 20px 0 24px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(24, 144, 255, 0.25);
}
.app-hero::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15), transparent 70%);
    pointer-events: none;
}
.app-hero-inner { position: relative; z-index: 1; max-width: 720px; }
.app-hero-text h1 {
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 12px;
    letter-spacing: 1px;
}
.app-hero-text p {
    font-size: 16px;
    margin: 0 0 20px;
    opacity: 0.92;
}
.app-hero-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.app-hero-tag {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    backdrop-filter: blur(4px);
}

/* ============== 区块标题 ============== */
.app-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
}
.app-section-title h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--app-text);
}
.app-section-title-icon {
    font-size: 22px;
}

/* ============== 筛选区 ============== */
.app-filter { background: #fff; border-radius: var(--app-radius); padding: 22px 24px; margin: 0 0 24px; box-shadow: var(--app-shadow); }
.app-filter-bar { margin-bottom: 12px; }
.app-platform-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; padding: 8px 0; border-top: 1px dashed var(--app-border); }
.app-platform-filter .filter-item { font-size: 13px; padding: 6px 14px; }

/* ============== 卡片网格 ============== */
.app-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    margin: 0 0 24px;
}
.app-card-grid-featured {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.app-card {
    background: var(--app-card-bg);
    border-radius: var(--app-radius);
    padding: 18px;
    display: flex;
    gap: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--app-shadow);
    border: 1px solid transparent;
}
.app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--app-shadow-hover);
    border-color: rgba(24, 144, 255, 0.2);
}
.app-card-icon-wrap {
    position: relative;
    flex-shrink: 0;
    width: 84px;
    height: 84px;
}
.app-card-icon {
    width: 84px;
    height: 84px;
    border-radius: 18px;
    object-fit: cover;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.app-card-badge-star {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--app-accent);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}
.app-card-body { flex: 1; min-width: 0; }
.app-card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--app-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-card-subtitle {
    font-size: 12px;
    color: var(--app-text-muted);
    margin: 0 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.5;
    min-height: 36px;
}
.app-card-rating { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; }
.app-card-stars { color: #f59e0b; font-size: 13px; letter-spacing: 1px; }
.app-card-rating-num { font-size: 12px; font-weight: 600; color: #f59e0b; }
.app-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 0 0 6px; }
.app-card-version, .app-card-size { font-size: 11px; color: var(--app-text-muted); background: #f1f5f9; padding: 2px 6px; border-radius: 4px; }
.app-card-footer { border-top: 1px solid var(--app-border); padding-top: 8px; margin-top: 4px; }
.app-card-cta { color: var(--app-primary); font-size: 12px; font-weight: 600; }

/* 平台徽标 */
.app-plat-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1.3;
    background: #f1f5f9;
    color: #475569;
}
.app-plat-android { background: rgba(61, 220, 132, 0.15); color: #047857; }
.app-plat-ios { background: rgba(0, 0, 0, 0.85); color: #fff; }

/* ============== 详情页 Hero ============== */
.app-detail-hero {
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
    border-radius: var(--app-radius);
    padding: 32px 36px;
    margin: 20px 0 24px;
    box-shadow: var(--app-shadow);
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 36px;
    align-items: center;
}
.app-detail-hero-left { display: flex; gap: 24px; align-items: flex-start; }
.app-detail-hero-icon {
    width: 120px;
    height: 120px;
    border-radius: 24px;
    object-fit: cover;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}
.app-detail-hero-info { flex: 1; min-width: 0; }
.app-detail-hero-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--app-text);
}
.app-detail-hero-subtitle {
    font-size: 14px;
    color: var(--app-text-muted);
    margin: 0 0 14px;
}
.app-detail-hero-developer {
    font-size: 13px;
    color: var(--app-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 12px;
}
.app-detail-hero-sep { opacity: 0.4; }
.app-detail-hero-rating { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.app-detail-hero-stars { color: #f59e0b; font-size: 18px; letter-spacing: 2px; }
.app-detail-hero-rating-num { font-size: 18px; font-weight: 700; color: #f59e0b; }
.app-detail-hero-rating-count { font-size: 12px; color: var(--app-text-muted); }
.app-detail-hero-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.app-detail-hero-tag {
    background: linear-gradient(135deg, rgba(24, 144, 255, 0.08), rgba(6, 182, 212, 0.08));
    color: var(--app-primary);
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid rgba(24, 144, 255, 0.2);
}

/* Hero 右侧下载按钮区 */
.app-detail-hero-right { display: flex; flex-direction: column; gap: 12px; }
.app-dl-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 14px;
    text-decoration: none;
    color: #fff;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.app-dl-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); color: #fff; text-decoration: none; }
.app-dl-btn-android { background: linear-gradient(135deg, #3ddc84 0%, #22c55e 100%); }
.app-dl-btn-ios { background: linear-gradient(135deg, #1f2937 0%, #000 100%); }
.app-dl-btn-icon { font-size: 24px; }
.app-dl-btn-text { display: flex; flex-direction: column; line-height: 1.3; }
.app-dl-btn-text strong { font-size: 16px; font-weight: 700; }
.app-dl-btn-text span { font-size: 12px; opacity: 0.85; }
.app-dl-btn[onclick] { opacity: 0.5; cursor: not-allowed; pointer-events: auto; }
.app-dl-btn[onclick]:hover { transform: none; }

.app-dl-share-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 12px;
}
.app-dl-share-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--app-text);
    transition: background 0.2s;
}
.app-dl-share-btn:hover { background: #eef2ff; }
.app-dl-qrcode {
    width: 64px;
    height: 64px;
    margin-left: auto;
}
.app-dl-qrcode img, .app-dl-qrcode canvas { width: 64px !important; height: 64px !important; }
.app-dl-qrcode-wrap {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.app-dl-qrcode-wrap .app-dl-qrcode { margin-left: 0; }
.app-dl-qrcode-label {
    font-size: 10px;
    color: var(--app-text-muted);
    line-height: 1;
}

/* ============== 详情页主区 ============== */
.app-detail-main {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    margin: 0 0 24px;
}
.app-detail-screenshots {
    background: #fff;
    border-radius: var(--app-radius);
    padding: 20px;
    box-shadow: var(--app-shadow);
}
.app-ss-stage {
    position: relative;
    width: 100%;
    background: #f1f5f9;
    border-radius: var(--app-radius-sm);
    overflow: hidden;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.app-ss-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s;
    cursor: zoom-in;
}
.app-ss-img.active { opacity: 1; }
.app-ss-empty { color: #94a3b8; font-size: 14px; }
.app-ss-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s;
}
.app-ss-nav:hover { background: rgba(0, 0, 0, 0.7); }
.app-ss-nav-prev { left: 12px; }
.app-ss-nav-next { right: 12px; }

.app-ss-thumbs {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    gap: 8px;
    overflow-x: auto;
}
.app-ss-thumb {
    width: 80px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    background: #f1f5f9;
}
.app-ss-thumb.active { border-color: var(--app-primary); }
.app-ss-thumb img { width: 100%; height: 100%; object-fit: cover; }

.app-ss-video { margin-top: 20px; }
.app-ss-video h3 { font-size: 14px; margin: 0 0 10px; }
.app-ss-video video { width: 100%; border-radius: var(--app-radius-sm); background: #000; }

/* Lightbox */
.app-ss-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* 关键：[hidden] 属性默认 display:none，但 .app-ss-lightbox{display:flex} 会覆盖它，
   导致 lightbox 永远显示成全屏黑块盖住整个页面。必须显式声明 */
.app-ss-lightbox[hidden] { display: none !important; }
.app-ss-lightbox img { max-width: 92vw; max-height: 92vh; object-fit: contain; }
.app-ss-lightbox-close {
    position: absolute;
    top: 24px;
    right: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    font-size: 28px;
    cursor: pointer;
}
.app-ss-lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }

/* 参数表 */
.app-detail-params {
    background: #fff;
    border-radius: var(--app-radius);
    padding: 20px 24px;
    box-shadow: var(--app-shadow);
    align-self: start;
}
.app-detail-params-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 14px;
    color: var(--app-text);
    border-left: 4px solid var(--app-primary);
    padding-left: 10px;
}
.app-detail-params-table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}
.app-detail-params-table th, .app-detail-params-table td {
    padding: 8px 0;
    border-bottom: 1px dashed var(--app-border);
    text-align: left;
    vertical-align: top;
}
.app-detail-params-table th {
    width: 80px;
    color: var(--app-text-muted);
    font-weight: 500;
}
.app-detail-params-table td { color: var(--app-text); }
.app-detail-params-table code {
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #475569;
}

/* ============== 通用 section ============== */
.app-detail-section {
    background: #fff;
    border-radius: var(--app-radius);
    padding: 24px 28px;
    margin: 0 0 20px;
    box-shadow: var(--app-shadow);
}
.app-detail-section-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--app-text);
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
}
.app-detail-section-icon { font-size: 22px; }

/* 更新日志 */
.app-log-list { display: flex; flex-direction: column; gap: 16px; }
.app-log-item { background: #f8fafc; border-radius: 10px; padding: 12px 18px; border-left: 3px solid var(--app-primary); }
.app-log-version { font-weight: 600; color: var(--app-primary); font-size: 14px; margin: 0 0 6px; }
.app-log-changes { list-style: none; padding: 0; margin: 0; }
.app-log-changes li { padding: 3px 0 3px 18px; position: relative; font-size: 13px; color: #475569; }
.app-log-changes li::before { content: "•"; position: absolute; left: 6px; color: var(--app-primary); }

/* 富文本正文 */
.app-detail-content, .app-detail-notice {
    font-size: 14px;
    line-height: 1.85;
    color: #334155;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.app-detail-content p { margin: 10px 0; }
.app-detail-content p:first-child { margin-top: 0; }
.app-detail-content p:last-child { margin-bottom: 0; }
.app-detail-content img { max-width: 100%; border-radius: 8px; margin: 12px 0; }
.app-detail-content h2, .app-detail-content h3, .app-detail-content h4 { margin: 18px 0 10px; color: #1f2937; }
.app-detail-content table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.app-detail-content th, .app-detail-content td { border: 1px solid var(--app-border); padding: 8px 12px; }
.app-detail-content pre, .app-detail-content code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-family: monospace; }
.app-detail-content pre { padding: 12px; overflow-x: auto; }
.app-detail-content blockquote { border-left: 4px solid var(--app-primary); padding: 8px 14px; background: #f1f5f9; margin: 12px 0; color: #475569; }
.app-detail-notice { white-space: pre-wrap; font-size: 13px; color: #92400e; background: #fffbeb; padding: 14px 18px; border-radius: 10px; border: 1px solid #fde68a; }

/* 相关推荐 */
.app-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.app-related-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}
.app-related-card:hover { background: #eef2ff; text-decoration: none; color: inherit; }
.app-related-icon { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; }
.app-related-card h4 { font-size: 14px; margin: 0 0 2px; }
.app-related-card p { font-size: 12px; color: var(--app-text-muted); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 下架横幅 */
.app-offline-banner {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    padding: 14px 20px;
    border-radius: var(--app-radius-sm);
    margin: 0 0 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #f59e0b;
}
.app-offline-icon { font-size: 28px; }

/* 响应式 */
@media (max-width: 992px) {
    .app-detail-hero { grid-template-columns: 1fr; }
    .app-detail-main { grid-template-columns: 1fr; }
    .app-detail-params { order: -1; }
}
@media (max-width: 768px) {
    .app-hero { padding: 32px 22px; }
    .app-hero-text h1 { font-size: 26px; }
    .app-card-grid { grid-template-columns: 1fr; }
    .app-detail-hero { padding: 22px 18px; }
    .app-detail-hero-left { flex-direction: column; gap: 14px; }
    .app-detail-hero-icon { width: 88px; height: 88px; }
    .app-detail-hero-title { font-size: 22px; }
}
