/* -------- 横幅区（产品介绍） -------- */
.api-hero {
    background: linear-gradient(145deg, #f0f4fa 0%, #e6edf6 100%);
    min-height: 300px;
    padding: 4.5rem 0 3rem;
    border-bottom: 1px solid rgba(0, 106, 205, 0.08);
    text-align: center;
}
.api-hero h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #0b1a33;
    letter-spacing: -0.3px;
    margin-bottom: 0.3rem;
}
.api-hero h1 > i {
    color: #006ACD;
    font-size: 0.9em;
}
.api-title-emphasis {
    display: inline-block;
    position: relative;
}
.api-title-emphasis::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: -0.35rem;
    left: 0;
    height: 3px;
    background: #006ACD;
    border-radius: 3px;
}
.api-hero .sub-text {
    font-size: 1.05rem;
    color: #6c7a8a;
    max-width: 620px;
    margin: 0 auto;
}

/* -------- API 商城主体 -------- */
.api-section {
    padding: 3rem 0 60px;
    background: #f8faff;
}

/* 产品优势卡片 */
.advantage-card {
    background: #fff;
    border-radius: 1.2rem;
    padding: 2rem 1.5rem;
    text-align: center;
    height: 100%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    border: 1px solid transparent;
}
.advantage-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 36px rgba(0, 106, 205, 0.08);
    border-color: rgba(0, 106, 205, 0.12);
}
.advantage-card .icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(0, 106, 205, 0.08);
    color: #006ACD;
    font-size: 2.2rem;
    margin-bottom: 1rem;
}
.advantage-card h5 {
    font-weight: 600;
    color: #0b1a33;
}
.advantage-card p {
    color: #6c7a8a;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0;
}

/* -------- 搜索框（位于优势卡片下方） -------- */
.search-wrapper {
    max-width: 580px;
    margin: 1.8rem auto 0;
}
.search-wrapper .input-group {
    background: #fff;
    border-radius: 60px;
    box-shadow: 0 4px 20px rgba(0, 106, 205, 0.06);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}
.search-wrapper .input-group:focus-within {
    box-shadow: 0 8px 30px rgba(0, 106, 205, 0.12);
}
.search-wrapper .form-control {
    border: none;
    padding: 0.85rem 1.8rem;
    font-size: 1rem;
    border-radius: 60px 0 0 60px;
    background: transparent;
}
.search-wrapper .form-control:focus {
    box-shadow: none;
    border-color: transparent;
}
.search-wrapper .btn-search {
    border: none;
    background: #006ACD;
    color: #fff;
    padding: 0 2rem;
    border-radius: 0 60px 60px 0;
    font-weight: 500;
    transition: background 0.2s;
}
.search-wrapper .btn-search:hover {
    background: #0052a3;
}
.search-wrapper .btn-search i {
    font-size: 1.1rem;
}

/* 搜索无结果提示 */
.no-result {
    display: none;
    text-align: center;
    padding: 3rem 0;
    color: #8a98a8;
}
.no-result i {
    font-size: 3rem;
    color: #dde2eb;
    display: block;
    margin-bottom: 1rem;
}

/* -------- API 列表（一行 4 个） -------- */
.api-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-top: 1rem;
}
.api-card {
    position: relative;
    background: #fff;
    border-radius: 1.2rem;
    padding: 1.5rem 1.2rem 1.2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
}
.api-card .api-card-cover {
    position: absolute;
    z-index: 1;
    inset: 0;
    border-radius: inherit;
    cursor: pointer;
}
.api-card .api-card-cover:focus-visible {
    outline: 3px solid #006ACD;
    outline-offset: 3px;
}
.api-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 106, 205, 0.07);
    border-color: rgba(0, 106, 205, 0.10);
}
.api-card .api-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .4rem;
    margin-bottom: 0.4rem;
}
.api-favorite-filter {
    display: flex;
    justify-content: flex-end;
    margin-top: -1.5rem;
    margin-bottom: 0.55rem;
}
.api-favorite-filter button {
    border: 1px solid #f3cc72;
    border-radius: 999px;
    padding: 0.38rem 0.9rem;
    color: #9a6100;
    background: #fff8e7;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
}
.api-favorite-filter button:hover,
.api-favorite-filter button.active {
    color: #9a6100;
    border-color: #e8af3f;
    background: #fff0c9;
    box-shadow: 0 3px 10px rgba(154, 97, 0, .12);
}
.api-card .api-favorite {
    position: relative;
    z-index: 2;
    display: grid;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    place-items: center;
    padding: 0;
    border: 1px solid #e5ecf4;
    border-radius: 50%;
    background: #fff;
    color: #97a6b7;
    cursor: pointer;
    line-height: 1;
    transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s ease;
}
.api-card .api-favorite:hover {
    color: #e09a00;
    border-color: #f3cc72;
    background: #fff8e7;
    transform: scale(1.08);
}
.api-card .api-favorite.is-favorited {
    color: #e09a00;
    border-color: #f3cc72;
    background: #fff4d9;
}
.api-card .api-favorite:disabled { opacity: .5; cursor: wait; }
.api-card .api-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #0b1a33;
    flex: 1;
    min-width: 0;
}
.api-card .api-name i {
    color: #006ACD;
    margin-right: .28rem;
}
.api-card .api-meta .price .free-text {
    background: rgba(34, 197, 94, 0.10);
    color: #16a34a;
}
.api-card .api-desc {
    color: #4b5a6a;
    font-size: 0.9rem;
    line-height: 1.6;
    flex: 1;
    margin: 0.2rem 0 0.8rem;
}
.api-card .api-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #8a98a8;
    border-top: 1px solid #f0f4fa;
    padding-top: 0.8rem;
    margin-top: auto;
}
.api-card .api-meta .price {
    font-weight: 600;
    color: #006ACD;
    font-size: 0.95rem;
}
.api-card .api-meta .price-paid {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.api-card .api-meta .point-icon {
    width: 1rem;
    height: 1rem;
    object-fit: contain;
}
.api-card .api-meta .price .free-text {
    display: inline-block;
    padding: 0.15rem 0.7rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}
.api-card .api-meta .calls i {
    margin-right: 4px;
}

/* 分类标题（含右侧展开图标） */
.category-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #0b1a33;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}
.category-title .cat-line {
    flex: 1;
    height: 1px;
    background: #e9edf4;
}
.category-title i:first-child {
    color: #006ACD;
    font-size: 1.2rem;
}

/* 右侧展开图标 */
.category-expand-icon {
    font-size: 1.3rem;
    color: #006ACD;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-left: auto;
    padding: 0.2rem 0.4rem;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 106, 205, 0.05);
    line-height: 1;
}
.category-expand-icon:hover {
    background: rgba(0, 106, 205, 0.12);
}
.category-expand-icon i {
    display: block;
    transition: transform 0.3s ease;
}
.category-expand-icon[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* 默认隐藏第 5 个及之后的卡片（折叠状态） */
.category-wrap .api-card:nth-child(n+5) {
    display: none;
}
/* 展开状态：显示所有卡片 */
.category-wrap.expanded .api-card {
    display: flex !important;
}
.category-wrap.expanded .api-card[style*="display: none"] {
    display: none !important;
}
/* 搜索时覆盖展开状态 */
.category-wrap.searching .api-card {
    display: flex !important;
}
.category-wrap.searching .api-card[style*="display: none"] {
    display: none !important;
}

/* 响应式 */
@media (max-width: 1199.98px) {
    .api-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 991.98px) {
    .api-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 575.98px) {
    .api-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    .api-hero .sub-text {
        font-size: 0.95rem;
    }
    .search-wrapper .form-control {
        padding: 0.6rem 1.2rem;
        font-size: 0.95rem;
    }
    .search-wrapper .btn-search {
        padding: 0 1.2rem;
        font-size: 0.95rem;
    }
    .api-card .api-header {
        flex-wrap: wrap;
    }
}
