/* 工具卡片样式 */
.tool-card {
    cursor: pointer;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border: 1px solid var(--border-color);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,.15);
}

.tool-card .tool-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.tool-card .tool-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.tool-card .tool-name {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-color);
    flex: 1;
    height: 50px;
    overflow: hidden;
}

.tool-card .tool-name a {
    color: inherit;
    text-decoration: none;
}

.tool-card .tool-name a:hover {
    color: var(--primary-color);
}

.tool-card .tool-description {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.tool-card .tool-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-light);
    margin-top: auto;
    margin-bottom: 8px; /* 下方留出空间 */
    line-height: 1.4;
    max-height: 2.8em; /* 最多两行 (2 * 1.4em) */
    overflow: hidden;
    flex-wrap: wrap; /* 允许换行 */
}

.tool-card .tool-category {
    background: rgba(123, 104, 238, 0.1);
    color: var(--primary-color);
    padding: 3px 8px;
    border-radius: 4px;
}

/* 工具卡片容器布局 - 使用 flex 布局 */
.tools-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* 大于 798px 时，每行 4 个卡片 */
@media (min-width: 799px) {
    .tools-grid .tool-card {
        flex: 0 0 calc(25% - 15px); /* 4 列，减去间隙 */
    }
}

/* 小于等于 798px 时，每行 2 个卡片 */
@media (max-width: 798px) {
    .tools-grid .tool-card {
        flex: 0 0 calc(50% - 10px); /* 2 列，减去间隙 */
    }
}

/* 手机端进一步调整 */
@media (max-width: 480px) {
    .tools-grid .tool-card {
        flex: 0 0 100%; /* 1 列 */
    }
}

/* 列表视图 - 单列 */
.tools-grid.list-view {
    flex-direction: column;
}

.tools-grid.list-view .tool-card {
    flex: 0 0 100%;
    max-width: 100%;
}