/* Hope CMS — 统一应用列表卡片（首页 / 应用中心 / 详情相似） */

.apps-grid,
.marketplace-grid.apps-grid,
.home-hot-apps-grid.apps-grid,
.app-similar-grid.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 18px;
    align-items: stretch;
}

.apps-card {
    --apps-ink: var(--heading, #0f172a);
    --apps-muted: var(--text-muted, #64748b);
    --apps-line: var(--border-soft, rgba(15, 23, 42, 0.08));
    --apps-surface: var(--surface, #fff);
    --apps-accent: var(--primary, #1a73e8);
    --apps-accent-soft: rgba(26, 115, 232, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    border-radius: 16px;
    border: 1px solid var(--apps-line);
    background: var(--apps-surface);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

html[data-theme="dark"] .apps-card {
    --apps-accent-soft: rgba(122, 176, 255, 0.14);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.apps-card[style*="--apps-i"] {
    animation: apps-card-up 0.45s ease both;
    animation-delay: calc(0.035s * min(var(--apps-i), 12));
}

.apps-card:hover {
    transform: translateY(-4px);
    border-color: rgba(26, 115, 232, 0.22);
    box-shadow: 0 14px 32px rgba(26, 115, 232, 0.1);
}

.apps-card-hit {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* 主题 / 插件统一媒体比例；无封面时压矮，少留白 */
.apps-card-media {
    position: relative;
    aspect-ratio: 16 / 10;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(145deg, #f1f5f9 0%, #e8f0fe 100%);
    flex-shrink: 0;
}

.apps-card-media.is-empty {
    aspect-ratio: auto;
    height: 72px;
    padding: 0;
}

html[data-theme="dark"] .apps-card-media {
    background: linear-gradient(145deg, #1a2230 0%, #243044 100%);
}

.apps-card[data-category="plugin"] .apps-card-media:not(.is-empty) {
    padding: 14px;
    background:
        radial-gradient(120% 90% at 50% 0%, #fff 0%, #f4f8ff 55%, #eef3fa 100%);
}

html[data-theme="dark"] .apps-card[data-category="plugin"] .apps-card-media:not(.is-empty) {
    background:
        radial-gradient(120% 90% at 50% 0%, #243044 0%, #1a2230 100%);
}

.apps-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.apps-card[data-category="plugin"] .apps-card-media img {
    object-fit: contain;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
}

html[data-theme="dark"] .apps-card[data-category="plugin"] .apps-card-media img {
    background: #151b24;
}

.apps-card:hover .apps-card-media img {
    transform: scale(1.03);
}

.apps-card[data-category="plugin"]:hover .apps-card-media img {
    transform: translateY(-2px) scale(1.02);
}

.apps-card-mono {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: Outfit, "Source Sans 3", sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: var(--apps-accent);
    background: rgba(255, 255, 255, 0.85);
    box-shadow: none;
}

html[data-theme="dark"] .apps-card-mono {
    background: #151b24;
}

.apps-card-badge {
    position: absolute;
    left: 10px;
    top: 10px;
    z-index: 2;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
}

.apps-card[data-category="theme"] .apps-card-badge {
    background: rgba(26, 115, 232, 0.9);
}

.apps-card[data-category="plugin"] .apps-card-badge {
    background: rgba(15, 118, 110, 0.9);
}

.apps-card-body {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 6px;
    padding: 12px 12px 13px;
    pointer-events: none;
    min-height: 0;
}

.apps-card-title {
    margin: 0;
    font-family: Outfit, "Source Sans 3", sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.35;
    color: var(--apps-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.apps-card-summary {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--apps-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.apps-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    pointer-events: auto;
}

.apps-card-tag {
    position: relative;
    z-index: 3;
    display: inline-flex;
    max-width: 100%;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    color: var(--apps-muted);
    background: rgba(15, 23, 42, 0.045);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html[data-theme="dark"] .apps-card-tag {
    background: rgba(255, 255, 255, 0.06);
}

.apps-card-tag:hover,
.apps-card-tag.is-active {
    color: var(--apps-accent);
    background: var(--apps-accent-soft);
}

.apps-card-meta {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
    pointer-events: auto;
}

.apps-card-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
    min-width: 0;
}

.apps-card .plugin-price,
.apps-card .plugin-price.is-promo {
    font-family: Outfit, "Source Sans 3", sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--apps-ink);
    line-height: 1.2;
}

.apps-card .plugin-price.is-free {
    color: #0f766e;
}

.apps-card .plugin-price.is-promo {
    color: #c2410c;
}

.apps-card .plugin-price-old {
    font-size: 12px;
    color: var(--apps-muted);
    text-decoration: line-through;
}

.apps-card .app-promo-countdown,
.apps-card-price .app-promo-countdown {
    width: 100%;
    font-size: 11px;
    color: #c2410c;
    line-height: 1.3;
}

.apps-card-likes {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--apps-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

@keyframes apps-card-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .apps-card[style*="--apps-i"] {
        animation: none;
    }
    .apps-card,
    .apps-card-media img {
        transition: none;
    }
}

@media (max-width: 640px) {
    .apps-grid,
    .marketplace-grid.apps-grid,
    .home-hot-apps-grid.apps-grid,
    .app-similar-grid.apps-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .apps-card-body {
        padding: 10px 10px 12px;
        gap: 6px;
    }

    .apps-card-title {
        font-size: 14px;
    }

    .apps-card-summary {
        display: none;
    }

    .apps-card-media.is-empty {
        height: 56px;
    }
}

@media (max-width: 420px) {
    .apps-grid,
    .marketplace-grid.apps-grid,
    .home-hot-apps-grid.apps-grid,
    .app-similar-grid.apps-grid {
        grid-template-columns: 1fr;
    }

    .apps-card-summary {
        display: -webkit-box;
    }
}
