/* API卡片链接样式 */
.api-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* API卡片容器样式 */
.api-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* 固定间距，更容易计算 */
    width: 100%;
    justify-content: flex-start;
    box-sizing: border-box;
}

/* API卡片样式 */
.api-list {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    min-height: 300px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* 修改为使用grid布局替代flex，确保每行对齐 */
.api-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4列布局 */
    grid-gap: 20px; /* 统一间距 */
    margin-top: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

/* 标准卡片样式 - 使用grid-item */
.api-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    height: 200px; /* 固定卡片高度 */
    width: 100%; /* 确保宽度填满单元格 */
    cursor: pointer; /* 添加手型光标，表明可点击 */
}

/* 少量卡片的布局 (2-4张卡片) */
.api-grid.few-cards {
    grid-template-columns: repeat(4, 1fr); /* 保持4列 */
}

/* 单个卡片时的样式 */
.api-grid.single-card {
    grid-template-columns: 1fr; /* 单列 */
    max-width: 450px;
    margin-left: 0;
    margin-right: auto;
}

.api-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #d0d0d0;
}

.status-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.status-dot:hover {
    transform: scale(1.2);
}

.status-dot[data-status="在线"] {
    background-color: #4caf50;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
}

.status-dot[data-status="维护中"] {
    background-color: #ff9800;
    box-shadow: 0 0 5px rgba(255, 152, 0, 0.5);
}

.status-dot[data-status="离线"] {
    background-color: #f44336;
    box-shadow: 0 0 5px rgba(244, 67, 54, 0.5);
}

.api-title {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    margin-right: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
    max-width: 100%;
    box-sizing: border-box;
    color: #000000;
}

.api-description {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    word-break: break-word;
    height: 4.2em; /* 固定高度：3 lines * 1.4 line-height */
    width: 100%;
    flex-shrink: 0; /* 防止高度被压缩 */
}

/* 移除描述悬停提示效果 */
.api-description::after {
    display: none;
}

.api-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #999;
    margin-top: auto;
    width: 100%;
    flex-shrink: 0; /* 防止被压缩 */
}

.star-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.star-svg {
    vertical-align: middle;
    display: inline-block;
}

.RESTAPI-text {
    color: #999;
    font-size: 0.8rem;
    background: #f3f3f3;
    border-radius: 6px 6px 6px 6px;
    padding: 0.4em 0.4em;
    display: inline-block;
}

/* 响应式设计 - 使用媒体查询控制每行卡片数 */

/* 特殊情况：3个卡片/行 (1200px-1600px) */
@media (max-width: 1600px) {
    .api-grid {
        grid-template-columns: repeat(3, 1fr); /* 3列布局 */
    }
    
    .api-grid.few-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 平板端：2个卡片/行 (768px-1200px) */
@media (max-width: 1200px) {
    .api-grid {
        grid-template-columns: repeat(2, 1fr); /* 2列布局 */
    }
    
    .api-grid.few-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 移动端：1个卡片/行 (小于768px) */
@media (max-width: 768px) {
    .api-list {
        padding: 1rem;
    }
    
    .api-grid, .api-grid.few-cards {
        grid-template-columns: 1fr; /* 1列布局 */
    }
    
    .api-title {
        width: calc(100% - 20px); /* 留出状态点的空间 */
    }
}

/* 小屏幕移动端优化 */
@media (max-width: 480px) {
    .api-card {
        padding: 1rem;
        height: auto; /* 在超小屏幕上允许卡片高度自适应 */
        min-height: 180px; /* 设置最小高度确保统一 */
    }
    
    .api-title {
        font-size: 1.1rem;
        margin-bottom: 0.3rem;
    }
}
