/**
 * ai-apps.css - AI 应用列表页
 * ------------------------------------------------------------------
 * 设计目标：
 *   1. 三层背景（页面白 → 分类浅灰 → 卡片白），让 192 张卡有分组节奏，不再糊成一片
 *   2. 卡片信息层次：名称 → 描述（2 行）→ 数据，描述宽度从 97px 提到 135px
 *   3. 去掉斜角丝带（会压住图标）和空的圆形跳转按钮（是重复的死链接）
 *   4. 新增顶部分类胶囊 + 滚动高亮，移动端不用开抽屉也能跳分类
 * 说明：page.css 里 .content-urls-card 一套样式带 !important，本文件用
 *      .app-grid 前缀提高优先级覆盖，不要随手删掉 !important。
 * ------------------------------------------------------------------
 */

/* ============================================================
   1. 页面头部
   ============================================================ */
.apps-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    padding: 2px 2px 20px;
    margin-bottom: 18px;
    border-bottom: 1px solid #eef2f8;
}

.apps-hero-main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.apps-hero-icon {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: linear-gradient(135deg, #6b8bff, #4a6cf7);
    box-shadow: 0 6px 16px -5px rgba(74, 108, 247, 0.55);
    color: #fff;
    font-size: 22px;
    line-height: 1;
}

.apps-hero-text {
    min-width: 0;
}

.apps-hero-text h1 {
    font-size: 25px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: #131b2b;
    margin: 0;
}

.apps-hero-text p {
    margin: 5px 0 0;
    font-size: 13px;
    line-height: 1.4;
    color: #8792a6;
}

.apps-hero-stats {
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex-shrink: 0;
}

.hero-stat {
    min-width: 76px;
    padding: 8px 14px;
    text-align: center;
    background: #fff;
    border: 1px solid #eaeff7;
    border-radius: 12px;
}

.hero-stat b {
    display: block;
    font-size: 17px;
    line-height: 1.2;
    font-weight: 700;
    color: #1a2334;
    font-variant-numeric: tabular-nums;
}

.hero-stat span {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    color: #98a2b3;
}

/* ============================================================
   2. 顶部分类胶囊
   ============================================================ */
.apps-cat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 20px;
}

.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e6ecf6;
    color: #4a5568;
    font-size: 12px;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
}

.cat-chip i {
    font-size: 14px;
    color: #8896ab;
    transition: color 0.18s;
}

.cat-chip em {
    font-style: normal;
    font-size: 10.5px;
    font-weight: 500;
    color: #98a2b3;
    background: #f2f5fa;
    border-radius: 4px;
    padding: 0 4px;
    font-variant-numeric: tabular-nums;
    transition: background 0.18s, color 0.18s;
}

.cat-chip:hover {
    border-color: #c4d4ff;
    background: #f7faff;
    color: #3a55c9;
    box-shadow: 0 2px 8px -4px rgba(74, 108, 247, 0.4);
}

.cat-chip:hover i {
    color: #4a6cf7;
}

.cat-chip.on {
    background: linear-gradient(135deg, #5b7cfa, #4a6cf7);
    border-color: #4a6cf7;
    color: #fff;
    box-shadow: 0 4px 12px -5px rgba(74, 108, 247, 0.7);
}

.cat-chip.on i {
    color: #fff;
}

.cat-chip.on em {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

/* ============================================================
   3. 分类区块
   ============================================================ */
.app-category-section {
    margin-bottom: 26px;
    padding: 18px 18px 20px;
    background: #f5f8fd;
    border: 1px solid #e9eff8;
    border-radius: 18px;
    scroll-margin-top: 84px;
}

.app-category-section:last-child {
    margin-bottom: 8px;
}

.cat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.cat-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.cat-head-icon {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #eef3ff, #e0e9ff);
    color: #4a6cf7;
    font-size: 18px;
    line-height: 1;
}

.cat-head-name {
    margin: 0;
    font-size: 17px;
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: #17202f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-head-count {
    flex-shrink: 0;
    font-size: 11.5px;
    line-height: 1.6;
    font-weight: 500;
    color: #7b8698;
    background: #fff;
    border: 1px solid #e9eff8;
    border-radius: 20px;
    padding: 0 8px;
    font-variant-numeric: tabular-nums;
}

.cat-head-more {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 5px 10px 5px 12px;
    border-radius: 9px;
    background: #fff;
    border: 1px solid #e3ebfa;
    color: #4a6cf7;
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
}

.cat-head-more i {
    font-size: 15px;
    transition: transform 0.18s;
}

.cat-head-more:hover {
    background: #4a6cf7;
    border-color: #4a6cf7;
    color: #fff;
    box-shadow: 0 4px 12px -4px rgba(74, 108, 247, 0.6);
}

.cat-head-more:hover i {
    transform: translateX(2px);
}

/* ============================================================
   4. 网格
   ============================================================ */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
    gap: 13px;
    padding: 0;
}

/* ============================================================
   5. 应用卡片
   ============================================================ */
.app-grid .content-urls-card {
    position: relative !important;
    display: block !important;
    min-height: 88px !important;
    padding: 13px 14px !important;
    background: #ffffff !important;
    border: 1px solid #e8eef7 !important;
    border-radius: 13px !important;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03) !important;
    overflow: hidden !important;
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.2s !important;
}

.app-grid .content-urls-card:hover {
    background: #ffffff !important;
    border-color: #bdcffe !important;
    box-shadow: 0 10px 22px -10px rgba(74, 108, 247, 0.35),
                0 2px 6px -2px rgba(16, 24, 40, 0.06) !important;
    transform: translateY(-2px) !important;
}

/* 推荐位：左侧金色竖条 + 淡金图标底（不再用压住图标的斜角丝带） */
.app-grid .content-urls-card.is-recommend {
    border-color: #f2e4c2 !important;
    background: linear-gradient(180deg, #fffdf7, #ffffff 62%) !important;
}

.app-grid .content-urls-card.is-recommend::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3.5px;
    background: linear-gradient(180deg, #ffc46b, #f79a3c);
}

.app-grid .content-urls-card.is-recommend:hover {
    border-color: #efd39a !important;
    box-shadow: 0 10px 22px -10px rgba(226, 152, 55, 0.45),
                0 2px 6px -2px rgba(16, 24, 40, 0.06) !important;
}

/* hover 时右上角浮现的箭头（原来是一个空的重复链接，占掉 38px 宽度） */
.app-grid .content-urls-card::after {
    content: "\ea70"; /* ri-arrow-right-up-line */
    font-family: "remixicon" !important;
    font-style: normal;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #eef3ff;
    color: #4a6cf7;
    font-size: 13px;
    opacity: 0;
    transform: translate(-3px, 3px);
    transition: opacity 0.18s, transform 0.18s;
    pointer-events: none;
}

.app-grid .content-urls-card:hover::after {
    opacity: 1;
    transform: translate(0, 0);
}

.app-card-link {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

/* ---- 图标 ---- */
.app-card-icon {
    position: relative;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #f6f8fd;
    overflow: hidden;
}

.app-grid .content-urls-card.is-recommend .app-card-icon {
    background: #fdf7ea;
}

.app-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
    display: block;
}

/* 图标抓不到时的首字占位（原来这套类根本没写样式，坏了就是一片空白） */
.app-card-ph {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0;
}

.app-card-ph.ph-1 { background: linear-gradient(135deg, #6b8bff, #4a6cf7); }
.app-card-ph.ph-2 { background: linear-gradient(135deg, #67c8b7, #22a08c); }
.app-card-ph.ph-3 { background: linear-gradient(135deg, #ffa96b, #f2793c); }
.app-card-ph.ph-4 { background: linear-gradient(135deg, #f58ab5, #e05a92); }
.app-card-ph.ph-5 { background: linear-gradient(135deg, #9b8bfa, #7159e0); }
.app-card-ph.ph-6 { background: linear-gradient(135deg, #6ec1f0, #2b8fd6); }
.app-card-ph.ph-7 { background: linear-gradient(135deg, #8fd06a, #57a83a); }
.app-card-ph.ph-8 { background: linear-gradient(135deg, #f2c15b, #d99f1e); }

/* ---- 文字区 ---- */
.app-card-main {
    flex: 1;
    min-width: 0;
    display: block;
    padding-top: 1px;
}

.app-card-titlerow {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    /* 给 hover 浮现的右上角箭头让位，避免长标题被盖住 */
    padding-right: 16px;
}

.app-grid .app-card-titlerow strong,
.app-grid .content-urls-card .app-card-titlerow strong {
    flex: 1;
    min-width: 0;
    display: block !important;
    font-size: 15px !important;
    line-height: 1.35 !important;
    font-weight: 650 !important;
    color: #131b2b !important;
    letter-spacing: -0.1px;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 !important;
    transition: color 0.18s !important;
}

.app-grid .content-urls-card:hover .app-card-titlerow strong {
    color: #3a55c9 !important;
}

.app-card-tag {
    flex-shrink: 0;
    font-style: normal;
    font-size: 10.5px;
    line-height: 1.5;
    font-weight: 600;
    padding: 0 5px;
    border-radius: 5px;
    letter-spacing: 0.2px;
    color: #fff;
}

.app-card-tag.tag-rec { background: linear-gradient(135deg, #ffa447, #f2703c); }
.app-card-tag.tag-hot { background: linear-gradient(135deg, #ff7a7a, #e5484d); }
.app-card-tag.tag-def { background: linear-gradient(135deg, #7e9bff, #4a6cf7); }

.app-card-desc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    min-height: 38px; /* 固定两行，卡片高度才整齐（描述短的也不会塌） */
    margin-top: 3px;
    font-size: 12.5px;
    line-height: 1.5;
    color: #76839a;
    word-break: break-word;
}

.app-card-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    font-size: 11.5px;
    line-height: 1;
    color: #8b95a7;
    font-variant-numeric: tabular-nums;
}

.app-card-stats > span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.app-card-stats i {
    font-size: 12.5px;
    color: #aab4c4;
    line-height: 1;
}

.app-grid .content-urls-card:hover .app-card-stats i {
    color: #8ba3e8;
}

/* ============================================================
   6. 空状态
   ============================================================ */
.apps-empty {
    text-align: center;
    color: #98a2b3;
    padding: 70px 0;
}

.apps-empty i {
    display: block;
    font-size: 44px;
    margin-bottom: 12px;
    color: #c6cfdd;
}

/* ============================================================
   7. 响应式
   ============================================================ */
@media (max-width: 1400px) {
    .app-grid { grid-template-columns: repeat(auto-fill, minmax(206px, 1fr)); }
}

@media (max-width: 1200px) {
    .app-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
    .apps-hero-text h1 { font-size: 23px; }
}

@media (max-width: 992px) {
    .app-grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
    .app-category-section { padding: 16px 15px 17px; border-radius: 16px; }
    .cat-head-name { font-size: 16px; }
}

@media (max-width: 768px) {
    .apps-hero { gap: 12px; padding-bottom: 16px; margin-bottom: 14px; }
    .apps-hero-icon { flex-basis: 40px; width: 40px; height: 40px; border-radius: 11px; font-size: 19px; }
    .apps-hero-text h1 { font-size: 21px; }
    .apps-hero-text p { font-size: 12px; }
    .apps-hero-stats { gap: 8px; }
    .hero-stat { min-width: 66px; padding: 6px 11px; }

    /* 胶囊横滑，不换行占高 */
    .apps-cat-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin: 0 -2px 18px;
        padding: 2px;
    }
    .apps-cat-chips::-webkit-scrollbar { display: none; }
    /* 右边缘渐隐，提示「还能往右滑」 */
    .apps-cat-chips {
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent 100%);
        mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent 100%);
    }

    /* 平板竖屏还放得下 3 列，不要急着掉到 2 列（2 列时单卡会宽到 350px） */
    .app-grid { grid-template-columns: repeat(auto-fill, minmax(198px, 1fr)); gap: 11px; }
    .app-category-section { padding: 14px 12px 15px; border-radius: 15px; margin-bottom: 16px; }
    .cat-head { margin-bottom: 12px; }
    .cat-head-icon { flex-basis: 30px; width: 30px; height: 30px; font-size: 15px; border-radius: 9px; }
    .cat-head-name { font-size: 15px; }
    .cat-head-count { font-size: 11px; }
    .cat-head-more { padding: 4px 8px 4px 10px; font-size: 12px; }

    .app-grid .content-urls-card { min-height: 80px !important; padding: 11px 12px !important; }
    .app-card-link { gap: 10px; }
    .app-card-icon { flex-basis: 40px; width: 40px; height: 40px; border-radius: 10px; }
    .app-card-ph { font-size: 16px; }
    .app-grid .app-card-titlerow strong { font-size: 13.5px !important; }
    .app-card-desc { min-height: 36px; }
    .app-card-stats { margin-top: 5px; gap: 10px; font-size: 11px; }
}

@media (max-width: 600px) {
    /* 手机上描述放不下（每行只剩 6~7 字），收起来只留名称和数据 */
    .app-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .app-card-desc { display: none; }
    .app-card-titlerow { padding-right: 0; }
}

@media (max-width: 480px) {
    .apps-hero-stats { display: none; }
    .apps-hero-text h1 { font-size: 19px; }
    .app-grid { gap: 9px; }
    .app-category-section { padding: 12px 10px 13px; }
    .app-grid .content-urls-card { min-height: 72px !important; padding: 10px !important; border-radius: 12px !important; }
    .app-card-icon { flex-basis: 36px; width: 36px; height: 36px; border-radius: 9px; }
    .app-grid .app-card-titlerow strong { font-size: 13px !important; }
    .app-card-tag { display: none; }
    .app-card-stats { gap: 8px; font-size: 10.5px; }
}

/* ============================================================
   8. 深色模式
   ============================================================ */
body.dark-mode .apps-hero { border-bottom-color: #27354f; }
body.dark-mode .apps-hero-text h1 { color: #e8eefb; }
body.dark-mode .apps-hero-text p { color: #8592a8; }
body.dark-mode .apps-hero-icon { box-shadow: 0 6px 16px -5px rgba(74, 108, 247, 0.5); }

body.dark-mode .hero-stat { background: #1b2740; border-color: #2a3852; }
body.dark-mode .hero-stat b { color: #e8eefb; }
body.dark-mode .hero-stat span { color: #7c8aa2; }

body.dark-mode .cat-chip { background: #1b2740; border-color: #2a3852; color: #b6c2d6; }
body.dark-mode .cat-chip i { color: #7c8aa2; }
body.dark-mode .cat-chip em { background: #24314c; color: #8b98ae; }
body.dark-mode .cat-chip:hover { background: #22304c; border-color: #3a55c9; color: #a8bcff; }
body.dark-mode .cat-chip.on { background: linear-gradient(135deg, #4a6cf7, #3a55c9); border-color: #4a6cf7; color: #fff; }
body.dark-mode .cat-chip.on i { color: #fff; }

body.dark-mode .app-category-section { background: #141e34; border-color: #223049; }
body.dark-mode .cat-head-icon { background: linear-gradient(135deg, #24314c, #2c3c5c); color: #8fa8ff; }
body.dark-mode .cat-head-name { color: #e8eefb; }
body.dark-mode .cat-head-count { background: #1e2a44; border-color: #2a3852; color: #9aa7bd; }
body.dark-mode .cat-head-more { background: #1e2a44; border-color: #2a3852; color: #8fa8ff; }
body.dark-mode .cat-head-more:hover { background: #4a6cf7; border-color: #4a6cf7; color: #fff; }

body.dark-mode .app-grid .content-urls-card {
    background: #1b2740 !important;
    border-color: #2f3d59 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}
body.dark-mode .app-grid .content-urls-card:hover {
    background: #202e4a !important;
    border-color: #3f5bc4 !important;
    box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.6) !important;
}
body.dark-mode .app-grid .content-urls-card.is-recommend {
    background: linear-gradient(180deg, #262236, #1b2740 62%) !important;
    border-color: #453a2a !important;
}
body.dark-mode .app-grid .content-urls-card::after {
    background: #26334f;
    color: #8fa8ff;
}

body.dark-mode .app-card-icon { background: #22304c; }
body.dark-mode .app-grid .content-urls-card.is-recommend .app-card-icon { background: #2c2740; }
body.dark-mode .app-grid .app-card-titlerow strong { color: #e8eefb !important; }
body.dark-mode .app-grid .content-urls-card:hover .app-card-titlerow strong { color: #a8bcff !important; }
body.dark-mode .app-card-desc { color: #93a0b6; }
body.dark-mode .app-card-stats { color: #7c8aa2; }
body.dark-mode .app-card-stats i { color: #6d7b92; }
body.dark-mode .apps-empty { color: #7c8aa2; }
body.dark-mode .apps-empty i { color: #40506c; }

/* ============================================================
   9. 无障碍 / 动效偏好
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .app-grid .content-urls-card,
    .app-grid .content-urls-card::after,
    .cat-chip,
    .cat-head-more {
        transition: none !important;
    }
    .app-grid .content-urls-card:hover { transform: none !important; }
}
